tanstack-shadcn-table
Version:
A powerful, feature-rich React table component built on top of TanStack Table v8 with shadcn/ui styling. Optimized bundle size with 55% reduction through peer dependencies.
2 lines (1 loc) • 857 B
JavaScript
function e(e,t){return{pageIndex:Math.max(0,Math.min(1e4,Math.floor(+e||0))),pageSize:Math.max(1,Math.min(1e3,Math.floor(+t||10)))}}function t(e){return Array.isArray(e)?e.slice(0,10).map(e=>{if(!e||"object"!=typeof e)return null;const t="string"==typeof e.id?"string"!=typeof(i=e.id)?"":i.replace(/['";\\]/g,"").replace(/<[^>]*>/g,"").slice(0,1e3).trim():"";var i;const n=!!e.desc;return t?{id:t,desc:n}:null}).filter(Boolean):[]}function i(e){return e.size>10485760?{isValid:!1,error:"File size exceeds 10MB limit"}:["image/jpeg","image/png","image/gif","image/webp","application/pdf","text/csv","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"].includes(e.type)?{isValid:!0}:{isValid:!1,error:"File type not allowed"}}export{i as validateFileUpload,e as validatePaginationParams,t as validateSortingParams};