UNPKG

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) 2.57 kB
function e(e){return"string"!=typeof e?"":e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/javascript:/gi,"").replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,"").replace(/data:(?!image\/(png|jpe?g|gif|svg\+xml))[^;]*;/gi,"").replace(/style\s*=\s*["'][^"']*expression\s*\([^"']*["']/gi,"")}function t(e){return"string"!=typeof e?"":e.replace(/['";\\]/g,"").replace(/<[^>]*>/g,"").slice(0,1e3).trim()}function s(e,s){if(null==e)return e;switch(s){case"text":case"custom":return"string"==typeof e?t(e):"";case"select":case"multi-select":return Array.isArray(e)?e.map(e=>"string"==typeof e?t(e):""):"string"==typeof e?t(e):"";case"range":if(Array.isArray(e))return e.map(e=>{const t=+e;return isNaN(t)?null:Math.max(-1e6,Math.min(1e6,t))});const s=+e;return isNaN(s)?null:Math.max(-1e6,Math.min(1e6,s));case"boolean":return"boolean"==typeof e?e:!!e;case"date":case"date-range":if(Array.isArray(e))return e.map(e=>{const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString().split("T")[0]});const n=new Date(e);return isNaN(n.getTime())?null:n.toISOString().split("T")[0];default:return"string"==typeof e?t(e):e}}function n(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 r(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(s=e.id)?"":s.replace(/['";\\]/g,"").replace(/<[^>]*>/g,"").slice(0,1e3).trim():"";var s;const n=!!e.desc;return t?{id:t,desc:n}:null}).filter(Boolean):[]}function a(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"}}class i{requests=new Map;maxRequests;windowMs;constructor(e=100,t=6e4){this.maxRequests=e,this.windowMs=t}isAllowed(e){const t=Date.now(),s=(this.requests.get(e)||[]).filter(e=>t-e<this.windowMs);return s.length<this.maxRequests&&(s.push(t),this.requests.set(e,s),!0)}reset(e){e?this.requests.delete(e):this.requests.clear()}}const c={"default-src":"'self'","script-src":"'self' 'unsafe-inline'","style-src":"'self' 'unsafe-inline'","img-src":"'self' data: https:","font-src":"'self' data:","connect-src":"'self'","frame-src":"'none'","object-src":"'none'","base-uri":"'self'","form-action":"'self'"};export{c as C,i as R,s as a,n as b,e as c,a as d,t as s,r as v};