2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
import{j as n,d as T,aI as g,p as s}from"./mui-vendor-CkIVaoQP.js";import{M as E}from"./index-Cyn2oTqg.js";import{r as i}from"./react-vendor-CmFgShSM.js";const w=({columns:d,data:u,name:f,responsive:A,cssClass:m,headerColor:x,rowColors:p})=>{const[r,C]=i.useState(u);i.useEffect(()=>{C(u)},[u]),i.useEffect(()=>{const o=u==null?void 0:u.map(e=>e==null?void 0:e.map(t=>!t&&t!==0?"":t));C(o)},[u]);const y={viewColumns:!1,search:!1,sort:!1,pagination:!1,filter:!1,print:!1,download:!1,selectableRowsHeader:!1,selectableRowsHideCheckboxes:!0,responsive:A||"vertical",fixedHeader:!0,tableBodyMaxHeight:{xs:"auto",md:"70vh"},setRowProps:(o,e)=>({style:p?{backgroundColor:p[e%p.length]}:{}}),textLabels:{body:{noMatch:"داده ای جهت نمایش موجود نیست!",toolTip:"مرتب سازی",columnHeaderTooltip:o=>`مرتب سازی بر اساس ${o.label}`},pagination:{next:"صفحه بعد",previous:"صفحه قبل",rowsPerPage:"تعداد سطر در هر صفحه:",displayRows:"تعداد کل نتایج: "},toolbar:{search:"جستجو",downloadCsv:"دانلود CSV",print:"پرینت",viewColumns:"نمایش سطون ها",filterTable:"فیلتر جدول"},filter:{all:"همه",title:"فیلترها",reset:"پاکسازی"},viewColumns:{title:"نمایش ستون ها",titleAria:"نمایش/بستن ستون های جدول"},selectedRows:{text:"سطر انتخاب شده است",delete:"پاک کردن",deleteAria:"پاک کردن سطرهای انتخاب شده"}}},F=d.map((o,e)=>({name:o,options:{customHeadRender:t=>{let a=0;r==null||r.forEach(b=>{let l=b[e];if(typeof l=="string"){const h=l.replace(/,/g,"");l=parseFloat(h)}isNaN(l)||(a+=l)});const c=a&&!isNaN(a)?`مجموع: ${a.toLocaleString()}`:"";return n.jsx(T,{title:c,arrow:!0,placement:"top",children:n.jsx("th",{style:{backgroundColor:x||"#e3e3e3",fontSize:"14px",padding:"10px",textAlign:"center",cursor:c?"help":"default"},children:t.name},t.index)})}}}));return n.jsx(g,{className:`simple-table ${m}`,width:"100%",children:n.jsx(E,{title:f,data:r,columns:F,options:y})})};w.propTypes={columns:s.PropTypes.any,data:s.PropTypes.any,name:s.PropTypes.any,expandable:s.PropTypes.bool,responsive:s.PropTypes.any,headerColor:s.PropTypes.string,rowColors:s.PropTypes.string};export{w as S};
|