384 lines
45 KiB
JavaScript
384 lines
45 KiB
JavaScript
import{j as ie,T as rn,aA as sn}from"./mui-vendor-CkIVaoQP.js";import{r as n,b as w}from"./react-vendor-CmFgShSM.js";import{T as dn,c as j,s as b}from"./styled-components.browser.esm-gS9mh05b.js";import{G as Ne}from"./index-Cr86_nOs.js";var X;function se(e,t){return e[t]}function cn(e=[],t,o=0){return[...e.slice(0,o),t,...e.slice(o)]}function gn(e=[],t,o="id"){const a=e.slice(),l=se(t,o);return l?a.splice(a.findIndex(i=>se(i,o)===l),1):a.splice(a.findIndex(i=>i===t),1),a}function bt(e){return e.map((t,o)=>{const a=Object.assign(Object.assign({},t),{sortable:t.sortable||!!t.sortFunction||void 0});return t.id||(a.id=o+1),a})}function be(e,t){return Math.ceil(e/t)}function We(e,t){return Math.min(e,t)}(function(e){e.ASC="asc",e.DESC="desc"})(X||(X={}));const k=()=>null;function vt(e,t=[],o=[]){let a={},l=[...o];return t.length&&t.forEach(i=>{if(!i.when||typeof i.when!="function")throw new Error('"when" must be defined in the conditional style object and must be function');i.when(e)&&(a=i.style||{},i.classNames&&(l=[...l,...i.classNames]),typeof i.style=="function"&&(a=i.style(e)||{}))}),{conditionalStyle:a,classNames:l.join(" ")}}function Oe(e,t=[],o="id"){const a=se(e,o);return a?t.some(l=>se(l,o)===a):t.some(l=>l===e)}function Se(e,t){return t?e.findIndex(o=>me(o.id,t)):-1}function me(e,t){return e==t}function un(e,t){const o=!e.toggleOnSelectedRowsChange;switch(t.type){case"SELECT_ALL_ROWS":{const{keyField:a,rows:l,rowCount:i,mergeSelections:s}=t,d=!e.allSelected,u=!e.toggleOnSelectedRowsChange;if(s){const h=d?[...e.selectedRows,...l.filter(p=>!Oe(p,e.selectedRows,a))]:e.selectedRows.filter(p=>!Oe(p,l,a));return Object.assign(Object.assign({},e),{allSelected:d,selectedCount:h.length,selectedRows:h,toggleOnSelectedRowsChange:u})}return Object.assign(Object.assign({},e),{allSelected:d,selectedCount:d?i:0,selectedRows:d?l:[],toggleOnSelectedRowsChange:u})}case"SELECT_SINGLE_ROW":{const{keyField:a,row:l,isSelected:i,rowCount:s,singleSelect:d}=t;return d?i?Object.assign(Object.assign({},e),{selectedCount:0,allSelected:!1,selectedRows:[],toggleOnSelectedRowsChange:o}):Object.assign(Object.assign({},e),{selectedCount:1,allSelected:!1,selectedRows:[l],toggleOnSelectedRowsChange:o}):i?Object.assign(Object.assign({},e),{selectedCount:e.selectedRows.length>0?e.selectedRows.length-1:0,allSelected:!1,selectedRows:gn(e.selectedRows,l,a),toggleOnSelectedRowsChange:o}):Object.assign(Object.assign({},e),{selectedCount:e.selectedRows.length+1,allSelected:e.selectedRows.length+1===s,selectedRows:cn(e.selectedRows,l),toggleOnSelectedRowsChange:o})}case"SELECT_MULTIPLE_ROWS":{const{keyField:a,selectedRows:l,totalRows:i,mergeSelections:s}=t;if(s){const d=[...e.selectedRows,...l.filter(u=>!Oe(u,e.selectedRows,a))];return Object.assign(Object.assign({},e),{selectedCount:d.length,allSelected:!1,selectedRows:d,toggleOnSelectedRowsChange:o})}return Object.assign(Object.assign({},e),{selectedCount:l.length,allSelected:l.length===i,selectedRows:l,toggleOnSelectedRowsChange:o})}case"CLEAR_SELECTED_ROWS":{const{selectedRowsFlag:a}=t;return Object.assign(Object.assign({},e),{allSelected:!1,selectedCount:0,selectedRows:[],selectedRowsFlag:a})}case"SORT_CHANGE":{const{sortDirection:a,selectedColumn:l,clearSelectedOnSort:i}=t;return Object.assign(Object.assign(Object.assign({},e),{selectedColumn:l,sortDirection:a,currentPage:1}),i&&{allSelected:!1,selectedCount:0,selectedRows:[],toggleOnSelectedRowsChange:o})}case"CHANGE_PAGE":{const{page:a,paginationServer:l,visibleOnly:i,persistSelectedOnPageChange:s}=t,d=l&&s,u=l&&!s||i;return Object.assign(Object.assign(Object.assign(Object.assign({},e),{currentPage:a}),d&&{allSelected:!1}),u&&{allSelected:!1,selectedCount:0,selectedRows:[],toggleOnSelectedRowsChange:o})}case"CHANGE_ROWS_PER_PAGE":{const{rowsPerPage:a,page:l}=t;return Object.assign(Object.assign({},e),{currentPage:l,rowsPerPage:a})}}}const pn=j`
|
|
pointer-events: none;
|
|
opacity: 0.4;
|
|
`,bn=b.div`
|
|
position: relative;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
height: 100%;
|
|
max-width: 100%;
|
|
${({disabled:e})=>e&&pn};
|
|
${({theme:e})=>e.table.style};
|
|
`,mn=j`
|
|
position: sticky;
|
|
position: -webkit-sticky; /* Safari */
|
|
top: 0;
|
|
z-index: 1;
|
|
`,hn=b.div`
|
|
display: flex;
|
|
width: 100%;
|
|
${({$fixedHeader:e})=>e&&mn};
|
|
${({theme:e})=>e.head.style};
|
|
`,wn=b.div`
|
|
display: flex;
|
|
align-items: stretch;
|
|
width: 100%;
|
|
${({theme:e})=>e.headRow.style};
|
|
${({$dense:e,theme:t})=>e&&t.headRow.denseStyle};
|
|
`,St=(e,...t)=>j`
|
|
@media screen and (max-width: ${599}px) {
|
|
${j(e,...t)}
|
|
}
|
|
`,fn=(e,...t)=>j`
|
|
@media screen and (max-width: ${959}px) {
|
|
${j(e,...t)}
|
|
}
|
|
`,xn=(e,...t)=>j`
|
|
@media screen and (max-width: ${1280}px) {
|
|
${j(e,...t)}
|
|
}
|
|
`,Cn=e=>(t,...o)=>j`
|
|
@media screen and (max-width: ${e}px) {
|
|
${j(t,...o)}
|
|
}
|
|
`,ce=b.div`
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: border-box;
|
|
line-height: normal;
|
|
${({theme:e,$headCell:t})=>e[t?"headCells":"cells"].style};
|
|
${({$noPadding:e})=>e&&"padding: 0"};
|
|
`,Et=b(ce)`
|
|
flex-grow: ${({button:e,grow:t})=>t===0||e?0:t||1};
|
|
flex-shrink: 0;
|
|
flex-basis: 0;
|
|
max-width: ${({maxWidth:e})=>e||"100%"};
|
|
min-width: ${({minWidth:e})=>e||"100px"};
|
|
${({width:e})=>e&&j`
|
|
min-width: ${e};
|
|
max-width: ${e};
|
|
`};
|
|
${({right:e})=>e&&"justify-content: flex-end"};
|
|
${({button:e,center:t})=>(t||e)&&"justify-content: center"};
|
|
${({compact:e,button:t})=>(e||t)&&"padding: 0"};
|
|
|
|
/* handle hiding cells */
|
|
${({hide:e})=>e&&e==="sm"&&St`
|
|
display: none;
|
|
`};
|
|
${({hide:e})=>e&&e==="md"&&fn`
|
|
display: none;
|
|
`};
|
|
${({hide:e})=>e&&e==="lg"&&xn`
|
|
display: none;
|
|
`};
|
|
${({hide:e})=>e&&Number.isInteger(e)&&Cn(e)`
|
|
display: none;
|
|
`};
|
|
`,yn=j`
|
|
div:first-child {
|
|
white-space: ${({$wrapCell:e})=>e?"normal":"nowrap"};
|
|
overflow: ${({$allowOverflow:e})=>e?"visible":"hidden"};
|
|
text-overflow: ellipsis;
|
|
}
|
|
`,Rn=b(Et).attrs(e=>({style:e.style}))`
|
|
${({$renderAsCell:e})=>!e&&yn};
|
|
${({theme:e,$isDragging:t})=>t&&e.cells.draggingStyle};
|
|
${({$cellStyle:e})=>e};
|
|
`;var vn=n.memo(function({id:e,column:t,row:o,rowIndex:a,dataTag:l,isDragging:i,onDragStart:s,onDragOver:d,onDragEnd:u,onDragEnter:h,onDragLeave:p}){const{conditionalStyle:m,classNames:D}=vt(o,t.conditionalCellStyles,["rdt_TableCell"]);return n.createElement(Rn,{id:e,"data-column-id":t.id,role:"cell",className:D,"data-tag":l,$cellStyle:t.style,$renderAsCell:!!t.cell,$allowOverflow:t.allowOverflow,button:t.button,center:t.center,compact:t.compact,grow:t.grow,hide:t.hide,maxWidth:t.maxWidth,minWidth:t.minWidth,right:t.right,width:t.width,$wrapCell:t.wrap,style:m,$isDragging:i,onDragStart:s,onDragOver:d,onDragEnd:u,onDragEnter:h,onDragLeave:p},!t.cell&&n.createElement("div",{"data-tag":l},function(R,S,H,x){return S?H&&typeof H=="function"?H(R,x):S(R,x):null}(o,t.selector,t.format,a)),t.cell&&t.cell(o,a,t,e))});const mt="input";var Ot=n.memo(function({name:e,component:t=mt,componentOptions:o={style:{}},indeterminate:a=!1,checked:l=!1,disabled:i=!1,onClick:s=k}){const d=t,u=d!==mt?o.style:(p=>Object.assign(Object.assign({fontSize:"18px"},!p&&{cursor:"pointer"}),{padding:0,marginTop:"1px",verticalAlign:"middle",position:"relative"}))(i),h=n.useMemo(()=>function(p,...m){let D;return Object.keys(p).map(R=>p[R]).forEach((R,S)=>{typeof R=="function"&&(D=Object.assign(Object.assign({},p),{[Object.keys(p)[S]]:R(...m)}))}),D||p}(o,a),[o,a]);return n.createElement(d,Object.assign({type:"checkbox",ref:p=>{p&&(p.indeterminate=a)},style:u,onClick:i?k:s,name:e,"aria-label":e,checked:l,disabled:i},h,{onChange:k}))});const Sn=b(ce)`
|
|
flex: 0 0 48px;
|
|
min-width: 48px;
|
|
justify-content: center;
|
|
align-items: center;
|
|
user-select: none;
|
|
white-space: nowrap;
|
|
`;function En({name:e,keyField:t,row:o,rowCount:a,selected:l,selectableRowsComponent:i,selectableRowsComponentProps:s,selectableRowsSingle:d,selectableRowDisabled:u,onSelectedRow:h}){const p=!(!u||!u(o));return n.createElement(Sn,{onClick:m=>m.stopPropagation(),className:"rdt_TableCell",$noPadding:!0},n.createElement(Ot,{name:e,component:i,componentOptions:s,checked:l,"aria-checked":l,onClick:()=>{h({type:"SELECT_SINGLE_ROW",row:o,isSelected:l,keyField:t,rowCount:a,singleSelect:d})},disabled:p}))}const On=b.button`
|
|
display: inline-flex;
|
|
align-items: center;
|
|
user-select: none;
|
|
white-space: nowrap;
|
|
border: none;
|
|
background-color: transparent;
|
|
${({theme:e})=>e.expanderButton.style};
|
|
`;function $n({disabled:e=!1,expanded:t=!1,expandableIcon:o,id:a,row:l,onToggled:i}){const s=t?o.expanded:o.collapsed;return n.createElement(On,{"aria-disabled":e,onClick:()=>i&&i(l),"data-testid":`expander-button-${a}`,disabled:e,"aria-label":t?"Collapse Row":"Expand Row",role:"button",type:"button"},s)}const Pn=b(ce)`
|
|
white-space: nowrap;
|
|
font-weight: 400;
|
|
min-width: 48px;
|
|
${({theme:e})=>e.expanderCell.style};
|
|
`;function kn({row:e,expanded:t=!1,expandableIcon:o,id:a,onToggled:l,disabled:i=!1}){return n.createElement(Pn,{onClick:s=>s.stopPropagation(),$noPadding:!0},n.createElement($n,{id:a,row:e,expanded:t,expandableIcon:o,disabled:i,onToggled:l}))}const Dn=b.div`
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
${({theme:e})=>e.expanderRow.style};
|
|
${({$extendedRowStyle:e})=>e};
|
|
`;var Hn=n.memo(function({data:e,ExpanderComponent:t,expanderComponentProps:o,extendedRowStyle:a,extendedClassNames:l}){const i=["rdt_ExpanderRow",...l.split(" ").filter(s=>s!=="rdt_TableRow")].join(" ");return n.createElement(Dn,{className:i,$extendedRowStyle:a},n.createElement(t,Object.assign({data:e},o)))});const Be="allowRowEvents";var $e,Ge,ht;(function(e){e.LTR="ltr",e.RTL="rtl",e.AUTO="auto"})($e||($e={})),function(e){e.LEFT="left",e.RIGHT="right",e.CENTER="center"}(Ge||(Ge={})),function(e){e.SM="sm",e.MD="md",e.LG="lg"}(ht||(ht={}));const Fn=j`
|
|
&:hover {
|
|
${({$highlightOnHover:e,theme:t})=>e&&t.rows.highlightOnHoverStyle};
|
|
}
|
|
`,jn=j`
|
|
&:hover {
|
|
cursor: pointer;
|
|
}
|
|
`,Tn=b.div.attrs(e=>({style:e.style}))`
|
|
display: flex;
|
|
align-items: stretch;
|
|
align-content: stretch;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
${({theme:e})=>e.rows.style};
|
|
${({$dense:e,theme:t})=>e&&t.rows.denseStyle};
|
|
${({$striped:e,theme:t})=>e&&t.rows.stripedStyle};
|
|
${({$highlightOnHover:e})=>e&&Fn};
|
|
${({$pointerOnHover:e})=>e&&jn};
|
|
${({$selected:e,theme:t})=>e&&t.rows.selectedHighlightStyle};
|
|
${({$conditionalStyle:e})=>e};
|
|
`;function In({columns:e=[],conditionalRowStyles:t=[],defaultExpanded:o=!1,defaultExpanderDisabled:a=!1,dense:l=!1,expandableIcon:i,expandableRows:s=!1,expandableRowsComponent:d,expandableRowsComponentProps:u,expandableRowsHideExpander:h,expandOnRowClicked:p=!1,expandOnRowDoubleClicked:m=!1,highlightOnHover:D=!1,id:R,expandableInheritConditionalStyles:S,keyField:H,onRowClicked:x=k,onRowDoubleClicked:$=k,onRowMouseEnter:F=k,onRowMouseLeave:v=k,onRowExpandToggled:E=k,onSelectedRow:L=k,pointerOnHover:A=!1,row:C,rowCount:y,rowIndex:V,selectableRowDisabled:M=null,selectableRows:N=!1,selectableRowsComponent:U,selectableRowsComponentProps:O,selectableRowsHighlight:te=!1,selectableRowsSingle:ge=!1,selected:ne,striped:oe=!1,draggingColumnId:Pe,onDragStart:ke,onDragOver:De,onDragEnd:He,onDragEnter:B,onDragLeave:we}){const[G,fe]=n.useState(o);n.useEffect(()=>{fe(o)},[o]);const Y=n.useCallback(()=>{fe(!G),E(!G,C)},[G,E,C]),Fe=A||s&&(p||m),je=n.useCallback(P=>{P.target.getAttribute("data-tag")===Be&&(x(C,P),!a&&s&&p&&Y())},[a,p,s,Y,x,C]),xe=n.useCallback(P=>{P.target.getAttribute("data-tag")===Be&&($(C,P),!a&&s&&m&&Y())},[a,m,s,Y,$,C]),Te=n.useCallback(P=>{F(C,P)},[F,C]),q=n.useCallback(P=>{v(C,P)},[v,C]),J=se(C,H),{conditionalStyle:Ce,classNames:ye}=vt(C,t,["rdt_TableRow"]),Ie=te&&ne,Le=S?Ce:{},Ae=oe&&V%2==0;return n.createElement(n.Fragment,null,n.createElement(Tn,{id:`row-${R}`,role:"row",$striped:Ae,$highlightOnHover:D,$pointerOnHover:!a&&Fe,$dense:l,onClick:je,onDoubleClick:xe,onMouseEnter:Te,onMouseLeave:q,className:ye,$selected:Ie,$conditionalStyle:Ce},N&&n.createElement(En,{name:`select-row-${J}`,keyField:H,row:C,rowCount:y,selected:ne,selectableRowsComponent:U,selectableRowsComponentProps:O,selectableRowDisabled:M,selectableRowsSingle:ge,onSelectedRow:L}),s&&!h&&n.createElement(kn,{id:J,expandableIcon:i,expanded:G,row:C,onToggled:Y,disabled:a}),e.map(P=>P.omit?null:n.createElement(vn,{id:`cell-${P.id}-${J}`,key:`cell-${P.id}-${J}`,dataTag:P.ignoreRowClick||P.button?null:Be,column:P,row:C,rowIndex:V,isDragging:me(Pe,P.id),onDragStart:ke,onDragOver:De,onDragEnd:He,onDragEnter:B,onDragLeave:we}))),s&&G&&n.createElement(Hn,{key:`expander-${J}`,data:C,extendedRowStyle:Le,extendedClassNames:ye,ExpanderComponent:d,expanderComponentProps:u}))}const Ln=b.span`
|
|
padding: 2px;
|
|
color: inherit;
|
|
flex-grow: 0;
|
|
flex-shrink: 0;
|
|
${({$sortActive:e})=>e?"opacity: 1":"opacity: 0"};
|
|
${({$sortDirection:e})=>e==="desc"&&"transform: rotate(180deg)"};
|
|
`,An=({sortActive:e,sortDirection:t})=>w.createElement(Ln,{$sortActive:e,$sortDirection:t},"▲"),Mn=b(Et)`
|
|
${({button:e})=>e&&"text-align: center"};
|
|
${({theme:e,$isDragging:t})=>t&&e.headCells.draggingStyle};
|
|
`,_n=j`
|
|
cursor: pointer;
|
|
span.__rdt_custom_sort_icon__ {
|
|
i,
|
|
svg {
|
|
transform: 'translate3d(0, 0, 0)';
|
|
${({$sortActive:e})=>e?"opacity: 1":"opacity: 0"};
|
|
color: inherit;
|
|
font-size: 18px;
|
|
height: 18px;
|
|
width: 18px;
|
|
backface-visibility: hidden;
|
|
transform-style: preserve-3d;
|
|
transition-duration: 95ms;
|
|
transition-property: transform;
|
|
}
|
|
|
|
&.asc i,
|
|
&.asc svg {
|
|
transform: rotate(180deg);
|
|
}
|
|
}
|
|
|
|
${({$sortActive:e})=>!e&&j`
|
|
&:hover,
|
|
&:focus {
|
|
opacity: 0.7;
|
|
|
|
span,
|
|
span.__rdt_custom_sort_icon__ * {
|
|
opacity: 0.7;
|
|
}
|
|
}
|
|
`};
|
|
`,zn=b.div`
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: inherit;
|
|
height: 100%;
|
|
width: 100%;
|
|
outline: none;
|
|
user-select: none;
|
|
overflow: hidden;
|
|
${({disabled:e})=>!e&&_n};
|
|
`,Nn=b.div`
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
`;var Wn=n.memo(function({column:e,disabled:t,draggingColumnId:o,selectedColumn:a={},sortDirection:l,sortIcon:i,sortServer:s,pagination:d,paginationServer:u,persistSelectedOnSort:h,selectableRowsVisibleOnly:p,onSort:m,onDragStart:D,onDragOver:R,onDragEnd:S,onDragEnter:H,onDragLeave:x}){n.useEffect(()=>{typeof e.selector=="string"&&console.error(`Warning: ${e.selector} is a string based column selector which has been deprecated as of v7 and will be removed in v8. Instead, use a selector function e.g. row => row[field]...`)},[]);const[$,F]=n.useState(!1),v=n.useRef(null);if(n.useEffect(()=>{v.current&&F(v.current.scrollWidth>v.current.clientWidth)},[$]),e.omit)return null;const E=()=>{if(!e.sortable&&!e.selector)return;let O=l;me(a.id,e.id)&&(O=l===X.ASC?X.DESC:X.ASC),m({type:"SORT_CHANGE",sortDirection:O,selectedColumn:e,clearSelectedOnSort:d&&u&&!h||s||p})},L=O=>n.createElement(An,{sortActive:O,sortDirection:l}),A=()=>n.createElement("span",{className:[l,"__rdt_custom_sort_icon__"].join(" ")},i),C=!(!e.sortable||!me(a.id,e.id)),y=!e.sortable||t,V=e.sortable&&!i&&!e.right,M=e.sortable&&!i&&e.right,N=e.sortable&&i&&!e.right,U=e.sortable&&i&&e.right;return n.createElement(Mn,{"data-column-id":e.id,className:"rdt_TableCol",$headCell:!0,allowOverflow:e.allowOverflow,button:e.button,compact:e.compact,grow:e.grow,hide:e.hide,maxWidth:e.maxWidth,minWidth:e.minWidth,right:e.right,center:e.center,width:e.width,draggable:e.reorder,$isDragging:me(e.id,o),onDragStart:D,onDragOver:R,onDragEnd:S,onDragEnter:H,onDragLeave:x},e.name&&n.createElement(zn,{"data-column-id":e.id,"data-sort-id":e.id,role:"columnheader",tabIndex:0,className:"rdt_TableCol_Sortable",onClick:y?void 0:E,onKeyPress:y?void 0:O=>{O.key==="Enter"&&E()},$sortActive:!y&&C,disabled:y},!y&&U&&A(),!y&&M&&L(C),typeof e.name=="string"?n.createElement(Nn,{title:$?e.name:void 0,ref:v,"data-column-id":e.id},e.name):e.name,!y&&N&&A(),!y&&V&&L(C)))});const Bn=b(ce)`
|
|
flex: 0 0 48px;
|
|
justify-content: center;
|
|
align-items: center;
|
|
user-select: none;
|
|
white-space: nowrap;
|
|
font-size: unset;
|
|
`;function Gn({headCell:e=!0,rowData:t,keyField:o,allSelected:a,mergeSelections:l,selectedRows:i,selectableRowsComponent:s,selectableRowsComponentProps:d,selectableRowDisabled:u,onSelectAllRows:h}){const p=i.length>0&&!a,m=u?t.filter(S=>!u(S)):t,D=m.length===0,R=Math.min(t.length,m.length);return n.createElement(Bn,{className:"rdt_TableCol",$headCell:e,$noPadding:!0},n.createElement(Ot,{name:"select-all-rows",component:s,componentOptions:d,onClick:()=>{h({type:"SELECT_ALL_ROWS",rows:m,rowCount:R,mergeSelections:l,keyField:o})},checked:a,indeterminate:p,disabled:D}))}function $t(e=$e.AUTO){const t=typeof window=="object",[o,a]=n.useState(!1);return n.useEffect(()=>{if(t)if(e!=="auto")a(e==="rtl");else{const l=!(!window.document||!window.document.createElement),i=document.getElementsByTagName("BODY")[0],s=document.getElementsByTagName("HTML")[0],d=i.dir==="rtl"||s.dir==="rtl";a(l&&d)}},[e,t]),o}const Vn=b.div`
|
|
display: flex;
|
|
align-items: center;
|
|
flex: 1 0 auto;
|
|
height: 100%;
|
|
color: ${({theme:e})=>e.contextMenu.fontColor};
|
|
font-size: ${({theme:e})=>e.contextMenu.fontSize};
|
|
font-weight: 400;
|
|
`,Un=b.div`
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
flex-wrap: wrap;
|
|
`,wt=b.div`
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
box-sizing: inherit;
|
|
z-index: 1;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
display: flex;
|
|
${({$rtl:e})=>e&&"direction: rtl"};
|
|
${({theme:e})=>e.contextMenu.style};
|
|
${({theme:e,$visible:t})=>t&&e.contextMenu.activeStyle};
|
|
`;function qn({contextMessage:e,contextActions:t,contextComponent:o,selectedCount:a,direction:l}){const i=$t(l),s=a>0;return o?n.createElement(wt,{$visible:s},n.cloneElement(o,{selectedCount:a})):n.createElement(wt,{$visible:s,$rtl:i},n.createElement(Vn,null,((d,u,h)=>{if(u===0)return null;const p=u===1?d.singular:d.plural;return h?`${u} ${d.message||""} ${p}`:`${u} ${p} ${d.message||""}`})(e,a,i)),n.createElement(Un,null,t))}const Zn=b.div`
|
|
position: relative;
|
|
box-sizing: border-box;
|
|
overflow: hidden;
|
|
display: flex;
|
|
flex: 1 1 auto;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
width: 100%;
|
|
flex-wrap: wrap;
|
|
${({theme:e})=>e.header.style}
|
|
`,Kn=b.div`
|
|
flex: 1 0 auto;
|
|
color: ${({theme:e})=>e.header.fontColor};
|
|
font-size: ${({theme:e})=>e.header.fontSize};
|
|
font-weight: 400;
|
|
`,Xn=b.div`
|
|
flex: 1 0 auto;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
|
|
> * {
|
|
margin-left: 5px;
|
|
}
|
|
`,Yn=({title:e,actions:t=null,contextMessage:o,contextActions:a,contextComponent:l,selectedCount:i,direction:s,showMenu:d=!0})=>n.createElement(Zn,{className:"rdt_TableHeader",role:"heading","aria-level":1},n.createElement(Kn,null,e),t&&n.createElement(Xn,null,t),d&&n.createElement(qn,{contextMessage:o,contextActions:a,contextComponent:l,direction:s,selectedCount:i}));function Pt(e,t){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(o[a[l]]=e[a[l]])}return o}const Jn={left:"flex-start",right:"flex-end",center:"center"},Qn=b.header`
|
|
position: relative;
|
|
display: flex;
|
|
flex: 1 1 auto;
|
|
box-sizing: border-box;
|
|
align-items: center;
|
|
padding: 4px 16px 4px 24px;
|
|
width: 100%;
|
|
justify-content: ${({align:e})=>Jn[e]};
|
|
flex-wrap: ${({$wrapContent:e})=>e?"wrap":"nowrap"};
|
|
${({theme:e})=>e.subHeader.style}
|
|
`,eo=e=>{var{align:t="right",wrapContent:o=!0}=e,a=Pt(e,["align","wrapContent"]);return n.createElement(Qn,Object.assign({align:t,$wrapContent:o},a))},to=b.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
`,no=b.div`
|
|
position: relative;
|
|
width: 100%;
|
|
border-radius: inherit;
|
|
${({$responsive:e,$fixedHeader:t})=>e&&j`
|
|
overflow-x: auto;
|
|
|
|
// hidden prevents vertical scrolling in firefox when fixedHeader is disabled
|
|
overflow-y: ${t?"auto":"hidden"};
|
|
min-height: 0;
|
|
`};
|
|
|
|
${({$fixedHeader:e=!1,$fixedHeaderScrollHeight:t="100vh"})=>e&&j`
|
|
max-height: ${t};
|
|
-webkit-overflow-scrolling: touch;
|
|
`};
|
|
|
|
${({theme:e})=>e.responsiveWrapper.style};
|
|
`,ft=b.div`
|
|
position: relative;
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
height: 100%;
|
|
${e=>e.theme.progress.style};
|
|
`,oo=b.div`
|
|
position: relative;
|
|
width: 100%;
|
|
${({theme:e})=>e.tableWrapper.style};
|
|
`,ao=b(ce)`
|
|
white-space: nowrap;
|
|
${({theme:e})=>e.expanderCell.style};
|
|
`,lo=b.div`
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
height: 100%;
|
|
${({theme:e})=>e.noData.style};
|
|
`,ro=()=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},w.createElement("path",{d:"M7 10l5 5 5-5z"}),w.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),io=b.select`
|
|
cursor: pointer;
|
|
height: 24px;
|
|
max-width: 100%;
|
|
user-select: none;
|
|
padding-left: 8px;
|
|
padding-right: 24px;
|
|
box-sizing: content-box;
|
|
font-size: inherit;
|
|
color: inherit;
|
|
border: none;
|
|
background-color: transparent;
|
|
appearance: none;
|
|
direction: ltr;
|
|
flex-shrink: 0;
|
|
|
|
&::-ms-expand {
|
|
display: none;
|
|
}
|
|
|
|
&:disabled::-ms-expand {
|
|
background: #f60;
|
|
}
|
|
|
|
option {
|
|
color: initial;
|
|
}
|
|
`,so=b.div`
|
|
position: relative;
|
|
flex-shrink: 0;
|
|
font-size: inherit;
|
|
color: inherit;
|
|
margin-top: 1px;
|
|
|
|
svg {
|
|
top: 0;
|
|
right: 0;
|
|
color: inherit;
|
|
position: absolute;
|
|
fill: currentColor;
|
|
width: 24px;
|
|
height: 24px;
|
|
display: inline-block;
|
|
user-select: none;
|
|
pointer-events: none;
|
|
}
|
|
`,co=e=>{var{defaultValue:t,onChange:o}=e,a=Pt(e,["defaultValue","onChange"]);return n.createElement(so,null,n.createElement(io,Object.assign({onChange:o,defaultValue:t},a)),n.createElement(ro,null))},r={columns:[],data:[],title:"",keyField:"id",selectableRows:!1,selectableRowsHighlight:!1,selectableRowsNoSelectAll:!1,selectableRowSelected:null,selectableRowDisabled:null,selectableRowsComponent:"input",selectableRowsComponentProps:{},selectableRowsVisibleOnly:!1,selectableRowsSingle:!1,clearSelectedRows:!1,expandableRows:!1,expandableRowDisabled:null,expandableRowExpanded:null,expandOnRowClicked:!1,expandableRowsHideExpander:!1,expandOnRowDoubleClicked:!1,expandableInheritConditionalStyles:!1,expandableRowsComponent:function(){return w.createElement("div",null,"To add an expander pass in a component instance via ",w.createElement("strong",null,"expandableRowsComponent"),". You can then access props.data from this component.")},expandableIcon:{collapsed:w.createElement(()=>w.createElement("svg",{fill:"currentColor",height:"24",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg"},w.createElement("path",{d:"M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"}),w.createElement("path",{d:"M0-.25h24v24H0z",fill:"none"})),null),expanded:w.createElement(()=>w.createElement("svg",{fill:"currentColor",height:"24",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg"},w.createElement("path",{d:"M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"}),w.createElement("path",{d:"M0-.75h24v24H0z",fill:"none"})),null)},expandableRowsComponentProps:{},progressPending:!1,progressComponent:w.createElement("div",{style:{fontSize:"24px",fontWeight:700,padding:"24px"}},"Loading..."),persistTableHead:!1,sortIcon:null,sortFunction:null,sortServer:!1,striped:!1,highlightOnHover:!1,pointerOnHover:!1,noContextMenu:!1,contextMessage:{singular:"item",plural:"items",message:"selected"},actions:null,contextActions:null,contextComponent:null,defaultSortFieldId:null,defaultSortAsc:!0,responsive:!0,noDataComponent:w.createElement("div",{style:{padding:"24px"}},"There are no records to display"),disabled:!1,noTableHead:!1,noHeader:!1,subHeader:!1,subHeaderAlign:Ge.RIGHT,subHeaderWrap:!0,subHeaderComponent:null,fixedHeader:!1,fixedHeaderScrollHeight:"100vh",pagination:!1,paginationServer:!1,paginationServerOptions:{persistSelectedOnSort:!1,persistSelectedOnPageChange:!1},paginationDefaultPage:1,paginationResetDefaultPage:!1,paginationTotalRows:0,paginationPerPage:10,paginationRowsPerPageOptions:[10,15,20,25,30],paginationComponent:null,paginationComponentOptions:{},paginationIconFirstPage:w.createElement(()=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",role:"presentation"},w.createElement("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"}),w.createElement("path",{fill:"none",d:"M24 24H0V0h24v24z"})),null),paginationIconLastPage:w.createElement(()=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",role:"presentation"},w.createElement("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"}),w.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"})),null),paginationIconNext:w.createElement(()=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",role:"presentation"},w.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),w.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),null),paginationIconPrevious:w.createElement(()=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",role:"presentation"},w.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),w.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),null),dense:!1,conditionalRowStyles:[],theme:"default",customStyles:{},direction:$e.AUTO,onChangePage:k,onChangeRowsPerPage:k,onRowClicked:k,onRowDoubleClicked:k,onRowMouseEnter:k,onRowMouseLeave:k,onRowExpandToggled:k,onSelectedRowsChange:k,onSort:k,onColumnOrderChange:k},go={rowsPerPageText:"Rows per page:",rangeSeparatorText:"of",noRowsPerPage:!1,selectAllRowsItem:!1,selectAllRowsItemText:"All"},uo=b.nav`
|
|
display: flex;
|
|
flex: 1 1 auto;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
box-sizing: border-box;
|
|
padding-right: 8px;
|
|
padding-left: 8px;
|
|
width: 100%;
|
|
${({theme:e})=>e.pagination.style};
|
|
`,Ee=b.button`
|
|
position: relative;
|
|
display: block;
|
|
user-select: none;
|
|
border: none;
|
|
${({theme:e})=>e.pagination.pageButtonsStyle};
|
|
${({$isRTL:e})=>e&&"transform: scale(-1, -1)"};
|
|
`,po=b.div`
|
|
display: flex;
|
|
align-items: center;
|
|
border-radius: 4px;
|
|
white-space: nowrap;
|
|
${St`
|
|
width: 100%;
|
|
justify-content: space-around;
|
|
`};
|
|
`,kt=b.span`
|
|
flex-shrink: 1;
|
|
user-select: none;
|
|
`,bo=b(kt)`
|
|
margin: 0 24px;
|
|
`,mo=b(kt)`
|
|
margin: 0 4px;
|
|
`;var ho=n.memo(function({rowsPerPage:e,rowCount:t,currentPage:o,direction:a=r.direction,paginationRowsPerPageOptions:l=r.paginationRowsPerPageOptions,paginationIconLastPage:i=r.paginationIconLastPage,paginationIconFirstPage:s=r.paginationIconFirstPage,paginationIconNext:d=r.paginationIconNext,paginationIconPrevious:u=r.paginationIconPrevious,paginationComponentOptions:h=r.paginationComponentOptions,onChangeRowsPerPage:p=r.onChangeRowsPerPage,onChangePage:m=r.onChangePage}){const D=(()=>{const O=typeof window=="object";function te(){return{width:O?window.innerWidth:void 0,height:O?window.innerHeight:void 0}}const[ge,ne]=n.useState(te);return n.useEffect(()=>{if(!O)return()=>null;function oe(){ne(te())}return window.addEventListener("resize",oe),()=>window.removeEventListener("resize",oe)},[]),ge})(),R=$t(a),S=D.width&&D.width>599,H=be(t,e),x=o*e,$=x-e+1,F=o===1,v=o===H,E=Object.assign(Object.assign({},go),h),L=o===H?`${$}-${t} ${E.rangeSeparatorText} ${t}`:`${$}-${x} ${E.rangeSeparatorText} ${t}`,A=n.useCallback(()=>m(o-1),[o,m]),C=n.useCallback(()=>m(o+1),[o,m]),y=n.useCallback(()=>m(1),[m]),V=n.useCallback(()=>m(be(t,e)),[m,t,e]),M=n.useCallback(O=>p(Number(O.target.value),o),[o,p]),N=l.map(O=>n.createElement("option",{key:O,value:O},O));E.selectAllRowsItem&&N.push(n.createElement("option",{key:-1,value:t},E.selectAllRowsItemText));const U=n.createElement(co,{onChange:M,defaultValue:e,"aria-label":E.rowsPerPageText},N);return n.createElement(uo,{className:"rdt_Pagination"},!E.noRowsPerPage&&S&&n.createElement(n.Fragment,null,n.createElement(mo,null,E.rowsPerPageText),U),S&&n.createElement(bo,null,L),n.createElement(po,null,n.createElement(Ee,{id:"pagination-first-page",type:"button","aria-label":"First Page","aria-disabled":F,onClick:y,disabled:F,$isRTL:R},s),n.createElement(Ee,{id:"pagination-previous-page",type:"button","aria-label":"Previous Page","aria-disabled":F,onClick:A,disabled:F,$isRTL:R},u),!E.noRowsPerPage&&!S&&U,n.createElement(Ee,{id:"pagination-next-page",type:"button","aria-label":"Next Page","aria-disabled":v,onClick:C,disabled:v,$isRTL:R},d),n.createElement(Ee,{id:"pagination-last-page",type:"button","aria-label":"Last Page","aria-disabled":v,onClick:V,disabled:v,$isRTL:R},i)))});const ee=(e,t)=>{const o=n.useRef(!0);n.useEffect(()=>{o.current?o.current=!1:e()},t)};function wo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fo=function(e){return function(t){return!!t&&typeof t=="object"}(e)&&!function(t){var o=Object.prototype.toString.call(t);return o==="[object RegExp]"||o==="[object Date]"||function(a){return a.$$typeof===xo}(t)}(e)},xo=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function he(e,t){return t.clone!==!1&&t.isMergeableObject(e)?de((o=e,Array.isArray(o)?[]:{}),e,t):e;var o}function Co(e,t,o){return e.concat(t).map(function(a){return he(a,o)})}function xt(e){return Object.keys(e).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(o){return Object.propertyIsEnumerable.call(t,o)}):[]}(e))}function Ct(e,t){try{return t in e}catch{return!1}}function yo(e,t,o){var a={};return o.isMergeableObject(e)&&xt(e).forEach(function(l){a[l]=he(e[l],o)}),xt(t).forEach(function(l){(function(i,s){return Ct(i,s)&&!(Object.hasOwnProperty.call(i,s)&&Object.propertyIsEnumerable.call(i,s))})(e,l)||(Ct(e,l)&&o.isMergeableObject(t[l])?a[l]=function(i,s){if(!s.customMerge)return de;var d=s.customMerge(i);return typeof d=="function"?d:de}(l,o)(e[l],t[l],o):a[l]=he(t[l],o))}),a}function de(e,t,o){(o=o||{}).arrayMerge=o.arrayMerge||Co,o.isMergeableObject=o.isMergeableObject||fo,o.cloneUnlessOtherwiseSpecified=he;var a=Array.isArray(t);return a===Array.isArray(e)?a?o.arrayMerge(e,t,o):yo(e,t,o):he(t,o)}de.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(o,a){return de(o,a,t)},{})};var Ro=wo(de);const yt={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.38)"},background:{default:"#FFFFFF"},context:{background:"#e3f2fd",text:"rgba(0, 0, 0, 0.87)"},divider:{default:"rgba(0,0,0,.12)"},button:{default:"rgba(0,0,0,.54)",focus:"rgba(0,0,0,.12)",hover:"rgba(0,0,0,.12)",disabled:"rgba(0, 0, 0, .18)"},selected:{default:"#e3f2fd",text:"rgba(0, 0, 0, 0.87)"},highlightOnHover:{default:"#EEEEEE",text:"rgba(0, 0, 0, 0.87)"},striped:{default:"#FAFAFA",text:"rgba(0, 0, 0, 0.87)"}},Rt={default:yt,light:yt,dark:{text:{primary:"#FFFFFF",secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(0,0,0,.12)"},background:{default:"#424242"},context:{background:"#E91E63",text:"#FFFFFF"},divider:{default:"rgba(81, 81, 81, 1)"},button:{default:"#FFFFFF",focus:"rgba(255, 255, 255, .54)",hover:"rgba(255, 255, 255, .12)",disabled:"rgba(255, 255, 255, .18)"},selected:{default:"rgba(0, 0, 0, .7)",text:"#FFFFFF"},highlightOnHover:{default:"rgba(0, 0, 0, .7)",text:"#FFFFFF"},striped:{default:"rgba(0, 0, 0, .87)",text:"#FFFFFF"}}};function vo(e,t,o,a){const[l,i]=n.useState(()=>bt(e)),[s,d]=n.useState(""),u=n.useRef("");ee(()=>{i(bt(e))},[e]);const h=n.useCallback(x=>{var $,F,v;const{attributes:E}=x.target,L=($=E.getNamedItem("data-column-id"))===null||$===void 0?void 0:$.value;L&&(u.current=((v=(F=l[Se(l,L)])===null||F===void 0?void 0:F.id)===null||v===void 0?void 0:v.toString())||"",d(u.current))},[l]),p=n.useCallback(x=>{var $;const{attributes:F}=x.target,v=($=F.getNamedItem("data-column-id"))===null||$===void 0?void 0:$.value;if(v&&u.current&&v!==u.current){const E=Se(l,u.current),L=Se(l,v),A=[...l];A[E]=l[L],A[L]=l[E],i(A),t(A)}},[t,l]),m=n.useCallback(x=>{x.preventDefault()},[]),D=n.useCallback(x=>{x.preventDefault()},[]),R=n.useCallback(x=>{x.preventDefault(),u.current="",d("")},[]),S=function(x=!1){return x?X.ASC:X.DESC}(a),H=n.useMemo(()=>l[Se(l,o==null?void 0:o.toString())]||{},[o,l]);return{tableColumns:l,draggingColumnId:s,handleDragStart:h,handleDragEnter:p,handleDragOver:m,handleDragLeave:D,handleDragEnd:R,defaultSortDirection:S,defaultSortColumn:H}}var So=n.memo(function(e){const{data:t=r.data,columns:o=r.columns,title:a=r.title,actions:l=r.actions,keyField:i=r.keyField,striped:s=r.striped,highlightOnHover:d=r.highlightOnHover,pointerOnHover:u=r.pointerOnHover,dense:h=r.dense,selectableRows:p=r.selectableRows,selectableRowsSingle:m=r.selectableRowsSingle,selectableRowsHighlight:D=r.selectableRowsHighlight,selectableRowsNoSelectAll:R=r.selectableRowsNoSelectAll,selectableRowsVisibleOnly:S=r.selectableRowsVisibleOnly,selectableRowSelected:H=r.selectableRowSelected,selectableRowDisabled:x=r.selectableRowDisabled,selectableRowsComponent:$=r.selectableRowsComponent,selectableRowsComponentProps:F=r.selectableRowsComponentProps,onRowExpandToggled:v=r.onRowExpandToggled,onSelectedRowsChange:E=r.onSelectedRowsChange,expandableIcon:L=r.expandableIcon,onChangeRowsPerPage:A=r.onChangeRowsPerPage,onChangePage:C=r.onChangePage,paginationServer:y=r.paginationServer,paginationServerOptions:V=r.paginationServerOptions,paginationTotalRows:M=r.paginationTotalRows,paginationDefaultPage:N=r.paginationDefaultPage,paginationResetDefaultPage:U=r.paginationResetDefaultPage,paginationPerPage:O=r.paginationPerPage,paginationRowsPerPageOptions:te=r.paginationRowsPerPageOptions,paginationIconLastPage:ge=r.paginationIconLastPage,paginationIconFirstPage:ne=r.paginationIconFirstPage,paginationIconNext:oe=r.paginationIconNext,paginationIconPrevious:Pe=r.paginationIconPrevious,paginationComponent:ke=r.paginationComponent,paginationComponentOptions:De=r.paginationComponentOptions,responsive:He=r.responsive,progressPending:B=r.progressPending,progressComponent:we=r.progressComponent,persistTableHead:G=r.persistTableHead,noDataComponent:fe=r.noDataComponent,disabled:Y=r.disabled,noTableHead:Fe=r.noTableHead,noHeader:je=r.noHeader,fixedHeader:xe=r.fixedHeader,fixedHeaderScrollHeight:Te=r.fixedHeaderScrollHeight,pagination:q=r.pagination,subHeader:J=r.subHeader,subHeaderAlign:Ce=r.subHeaderAlign,subHeaderWrap:ye=r.subHeaderWrap,subHeaderComponent:Ie=r.subHeaderComponent,noContextMenu:Le=r.noContextMenu,contextMessage:Ae=r.contextMessage,contextActions:P=r.contextActions,contextComponent:Dt=r.contextComponent,expandableRows:Re=r.expandableRows,onRowClicked:Ve=r.onRowClicked,onRowDoubleClicked:Ue=r.onRowDoubleClicked,onRowMouseEnter:qe=r.onRowMouseEnter,onRowMouseLeave:Ze=r.onRowMouseLeave,sortIcon:Ht=r.sortIcon,onSort:Ft=r.onSort,sortFunction:Ke=r.sortFunction,sortServer:Me=r.sortServer,expandableRowsComponent:jt=r.expandableRowsComponent,expandableRowsComponentProps:Tt=r.expandableRowsComponentProps,expandableRowDisabled:Xe=r.expandableRowDisabled,expandableRowsHideExpander:Ye=r.expandableRowsHideExpander,expandOnRowClicked:It=r.expandOnRowClicked,expandOnRowDoubleClicked:Lt=r.expandOnRowDoubleClicked,expandableRowExpanded:Je=r.expandableRowExpanded,expandableInheritConditionalStyles:At=r.expandableInheritConditionalStyles,defaultSortFieldId:Mt=r.defaultSortFieldId,defaultSortAsc:_t=r.defaultSortAsc,clearSelectedRows:Qe=r.clearSelectedRows,conditionalRowStyles:zt=r.conditionalRowStyles,theme:et=r.theme,customStyles:tt=r.customStyles,direction:ue=r.direction,onColumnOrderChange:Nt=r.onColumnOrderChange,className:Wt,ariaLabel:nt}=e,{tableColumns:ot,draggingColumnId:at,handleDragStart:lt,handleDragEnter:rt,handleDragOver:it,handleDragLeave:st,handleDragEnd:dt,defaultSortDirection:Bt,defaultSortColumn:Gt}=vo(o,Nt,Mt,_t),[{rowsPerPage:Z,currentPage:_,selectedRows:_e,allSelected:ct,selectedCount:gt,selectedColumn:W,sortDirection:ae,toggleOnSelectedRowsChange:Vt},Q]=n.useReducer(un,{allSelected:!1,selectedCount:0,selectedRows:[],selectedColumn:Gt,toggleOnSelectedRowsChange:!1,sortDirection:Bt,currentPage:N,rowsPerPage:O,selectedRowsFlag:!1,contextMessage:r.contextMessage}),{persistSelectedOnSort:ut=!1,persistSelectedOnPageChange:ve=!1}=V,pt=!(!y||!ve&&!ut),Ut=q&&!B&&t.length>0,qt=ke||ho,Zt=n.useMemo(()=>((c={},f="default",I="default")=>{const z=Rt[f]?f:I;return Ro({table:{style:{color:(g=Rt[z]).text.primary,backgroundColor:g.background.default}},tableWrapper:{style:{display:"table"}},responsiveWrapper:{style:{}},header:{style:{fontSize:"22px",color:g.text.primary,backgroundColor:g.background.default,minHeight:"56px",paddingLeft:"16px",paddingRight:"8px"}},subHeader:{style:{backgroundColor:g.background.default,minHeight:"52px"}},head:{style:{color:g.text.primary,fontSize:"12px",fontWeight:500}},headRow:{style:{backgroundColor:g.background.default,minHeight:"52px",borderBottomWidth:"1px",borderBottomColor:g.divider.default,borderBottomStyle:"solid"},denseStyle:{minHeight:"32px"}},headCells:{style:{paddingLeft:"16px",paddingRight:"16px"},draggingStyle:{cursor:"move"}},contextMenu:{style:{backgroundColor:g.context.background,fontSize:"18px",fontWeight:400,color:g.context.text,paddingLeft:"16px",paddingRight:"8px",transform:"translate3d(0, -100%, 0)",transitionDuration:"125ms",transitionTimingFunction:"cubic-bezier(0, 0, 0.2, 1)",willChange:"transform"},activeStyle:{transform:"translate3d(0, 0, 0)"}},cells:{style:{paddingLeft:"16px",paddingRight:"16px",wordBreak:"break-word"},draggingStyle:{}},rows:{style:{fontSize:"13px",fontWeight:400,color:g.text.primary,backgroundColor:g.background.default,minHeight:"48px","&:not(:last-of-type)":{borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:g.divider.default}},denseStyle:{minHeight:"32px"},selectedHighlightStyle:{"&:nth-of-type(n)":{color:g.selected.text,backgroundColor:g.selected.default,borderBottomColor:g.background.default}},highlightOnHoverStyle:{color:g.highlightOnHover.text,backgroundColor:g.highlightOnHover.default,transitionDuration:"0.15s",transitionProperty:"background-color",borderBottomColor:g.background.default,outlineStyle:"solid",outlineWidth:"1px",outlineColor:g.background.default},stripedStyle:{color:g.striped.text,backgroundColor:g.striped.default}},expanderRow:{style:{color:g.text.primary,backgroundColor:g.background.default}},expanderCell:{style:{flex:"0 0 48px"}},expanderButton:{style:{color:g.button.default,fill:g.button.default,backgroundColor:"transparent",borderRadius:"2px",transition:"0.25s",height:"100%",width:"100%","&:hover:enabled":{cursor:"pointer"},"&:disabled":{color:g.button.disabled},"&:hover:not(:disabled)":{cursor:"pointer",backgroundColor:g.button.hover},"&:focus":{outline:"none",backgroundColor:g.button.focus},svg:{margin:"auto"}}},pagination:{style:{color:g.text.secondary,fontSize:"13px",minHeight:"56px",backgroundColor:g.background.default,borderTopStyle:"solid",borderTopWidth:"1px",borderTopColor:g.divider.default},pageButtonsStyle:{borderRadius:"50%",height:"40px",width:"40px",padding:"8px",margin:"px",cursor:"pointer",transition:"0.4s",color:g.button.default,fill:g.button.default,backgroundColor:"transparent","&:disabled":{cursor:"unset",color:g.button.disabled,fill:g.button.disabled},"&:hover:not(:disabled)":{backgroundColor:g.button.hover},"&:focus":{outline:"none",backgroundColor:g.button.focus}}},noData:{style:{display:"flex",alignItems:"center",justifyContent:"center",color:g.text.primary,backgroundColor:g.background.default}},progress:{style:{display:"flex",alignItems:"center",justifyContent:"center",color:g.text.primary,backgroundColor:g.background.default}}},c);var g})(tt,et),[tt,et]),Kt=n.useMemo(()=>Object.assign({},ue!=="auto"&&{dir:ue}),[ue]),T=n.useMemo(()=>{if(Me)return t;if(W!=null&&W.sortFunction&&typeof W.sortFunction=="function"){const c=W.sortFunction,f=ae===X.ASC?c:(I,z)=>-1*c(I,z);return[...t].sort(f)}return function(c,f,I,z){return f?z&&typeof z=="function"?z(c.slice(0),f,I):c.slice(0).sort((g,ze)=>{const re=f(g),K=f(ze);if(I==="asc"){if(re<K)return-1;if(re>K)return 1}if(I==="desc"){if(re>K)return-1;if(re<K)return 1}return 0}):c}(t,W==null?void 0:W.selector,ae,Ke)},[Me,W,ae,t,Ke]),pe=n.useMemo(()=>{if(q&&!y){const c=_*Z,f=c-Z;return T.slice(f,c)}return T},[_,q,y,Z,T]),Xt=n.useCallback(c=>{Q(c)},[]),Yt=n.useCallback(c=>{Q(c)},[]),Jt=n.useCallback(c=>{Q(c)},[]),Qt=n.useCallback((c,f)=>Ve(c,f),[Ve]),en=n.useCallback((c,f)=>Ue(c,f),[Ue]),tn=n.useCallback((c,f)=>qe(c,f),[qe]),nn=n.useCallback((c,f)=>Ze(c,f),[Ze]),le=n.useCallback(c=>Q({type:"CHANGE_PAGE",page:c,paginationServer:y,visibleOnly:S,persistSelectedOnPageChange:ve}),[y,ve,S]),on=n.useCallback(c=>{const f=be(M||pe.length,c),I=We(_,f);y||le(I),Q({type:"CHANGE_ROWS_PER_PAGE",page:I,rowsPerPage:c})},[_,le,y,M,pe.length]);if(q&&!y&&T.length>0&&pe.length===0){const c=be(T.length,Z),f=We(_,c);le(f)}ee(()=>{E({allSelected:ct,selectedCount:gt,selectedRows:_e.slice(0)})},[Vt]),ee(()=>{Ft(W,ae,T.slice(0))},[W,ae]),ee(()=>{C(_,M||T.length)},[_]),ee(()=>{A(Z,_)},[Z]),ee(()=>{le(N)},[N,U]),ee(()=>{if(q&&y&&M>0){const c=be(M,Z),f=We(_,c);_!==f&&le(f)}},[M]),n.useEffect(()=>{Q({type:"CLEAR_SELECTED_ROWS",selectedRowsFlag:Qe})},[m,Qe]),n.useEffect(()=>{if(!H)return;const c=T.filter(I=>H(I)),f=m?c.slice(0,1):c;Q({type:"SELECT_MULTIPLE_ROWS",keyField:i,selectedRows:f,totalRows:T.length,mergeSelections:pt})},[t,H]);const an=S?pe:T,ln=ve||m||R;return n.createElement(dn,{theme:Zt},!je&&(!!a||!!l)&&n.createElement(Yn,{title:a,actions:l,showMenu:!Le,selectedCount:gt,direction:ue,contextActions:P,contextComponent:Dt,contextMessage:Ae}),J&&n.createElement(eo,{align:Ce,wrapContent:ye},Ie),n.createElement(no,Object.assign({$responsive:He,$fixedHeader:xe,$fixedHeaderScrollHeight:Te,className:Wt},Kt),n.createElement(oo,null,B&&!G&&n.createElement(ft,null,we),n.createElement(bn,Object.assign({disabled:Y,className:"rdt_Table",role:"table"},nt&&{"aria-label":nt}),!Fe&&(!!G||T.length>0&&!B)&&n.createElement(hn,{className:"rdt_TableHead",role:"rowgroup",$fixedHeader:xe},n.createElement(wn,{className:"rdt_TableHeadRow",role:"row",$dense:h},p&&(ln?n.createElement(ce,{style:{flex:"0 0 48px"}}):n.createElement(Gn,{allSelected:ct,selectedRows:_e,selectableRowsComponent:$,selectableRowsComponentProps:F,selectableRowDisabled:x,rowData:an,keyField:i,mergeSelections:pt,onSelectAllRows:Yt})),Re&&!Ye&&n.createElement(ao,null),ot.map(c=>n.createElement(Wn,{key:c.id,column:c,selectedColumn:W,disabled:B||T.length===0,pagination:q,paginationServer:y,persistSelectedOnSort:ut,selectableRowsVisibleOnly:S,sortDirection:ae,sortIcon:Ht,sortServer:Me,onSort:Xt,onDragStart:lt,onDragOver:it,onDragEnd:dt,onDragEnter:rt,onDragLeave:st,draggingColumnId:at})))),!T.length&&!B&&n.createElement(lo,null,fe),B&&G&&n.createElement(ft,null,we),!B&&T.length>0&&n.createElement(to,{className:"rdt_TableBody",role:"rowgroup"},pe.map((c,f)=>{const I=se(c,i),z=function(K=""){return typeof K!="number"&&(!K||K.length===0)}(I)?f:I,g=Oe(c,_e,i),ze=!!(Re&&Je&&Je(c)),re=!!(Re&&Xe&&Xe(c));return n.createElement(In,{id:z,key:z,keyField:i,"data-row-id":z,columns:ot,row:c,rowCount:T.length,rowIndex:f,selectableRows:p,expandableRows:Re,expandableIcon:L,highlightOnHover:d,pointerOnHover:u,dense:h,expandOnRowClicked:It,expandOnRowDoubleClicked:Lt,expandableRowsComponent:jt,expandableRowsComponentProps:Tt,expandableRowsHideExpander:Ye,defaultExpanderDisabled:re,defaultExpanded:ze,expandableInheritConditionalStyles:At,conditionalRowStyles:zt,selected:g,selectableRowsHighlight:D,selectableRowsComponent:$,selectableRowsComponentProps:F,selectableRowDisabled:x,selectableRowsSingle:m,striped:s,onRowExpandToggled:v,onRowClicked:Qt,onRowDoubleClicked:en,onRowMouseEnter:tn,onRowMouseLeave:nn,onSelectedRow:Jt,draggingColumnId:at,onDragStart:lt,onDragOver:it,onDragEnd:dt,onDragEnter:rt,onDragLeave:st})}))))),Ut&&n.createElement("div",null,n.createElement(qt,{onChangePage:le,onChangeRowsPerPage:on,rowCount:M||T.length,currentPage:_,rowsPerPage:Z,direction:ue,paginationRowsPerPageOptions:te,paginationIconLastPage:ge,paginationIconFirstPage:ne,paginationIconNext:oe,paginationIconPrevious:Pe,paginationComponentOptions:De})))});const Eo={rows:{style:{minHeight:"72px"}},headCells:{style:{paddingLeft:"0px",paddingRight:"0px",backgroundColor:"#ddd"}},cells:{style:{paddingLeft:"0px",paddingRight:"0px"}}},Do=e=>{var s,d;const t=e.title;n.useEffect(()=>{if(!e.progressPending){const u=document.querySelector(".rdt_Pagination span"),h=document.querySelector(".rdt_Pagination"),p=h==null?void 0:h.querySelectorAll("span")[(h==null?void 0:h.querySelectorAll("span").length)-1];p&&(p.textContent=p.textContent.replace("of","از"),u.textContent="سطر در صفحه:")}},[e.progressPending]);const[o,a]=n.useState(window.devicePixelRatio),l=()=>{const u=window.devicePixelRatio;a(u)};n.useEffect(()=>(window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l)}),[o]),n.useEffect(()=>{const u=document.querySelectorAll(".rdt_Table"),h="There are no records to display",p="داده ای جهت نمایش وجود ندارد";u==null||u.forEach(m=>{(m==null?void 0:m.textContent).includes(h)&&(m.textContent=p)})},[]);const i=window.innerWidth<=600;return ie.jsxs(Ne,{container:!0,className:"page-table",direction:"column",alignItems:"center",children:[ie.jsx(Ne,{container:!0,alignItems:"start",justifyContent:"start",children:t}),!!((s=e==null?void 0:e.data)!=null&&s.length)&&ie.jsx(Ne,{className:"table-section",width:i?"95vw":o>=1?window.screen.width-200:window.screen.width*(10/(o*10))-250,children:ie.jsx(So,{progressComponent:null,customStyles:Eo,...e,title:null,pagination:!0,paginationRowsPerPageOptions:[10,20,50,100],fixedHeader:!0,fixedHeaderScrollHeight:"70vh"})}),!((d=e==null?void 0:e.data)!=null&&d.length)&&!e.progressPending&&ie.jsx(rn,{variant:"h6",my:1,color:"red",mt:4,children:"داده ای جهت نمایش وجود ندارد!"}),e.progressPending&&ie.jsx(sn,{style:{alignItems:"center",justifyContent:"center"}})]})};export{Do as P};
|