UNPKG

siegel

Version:

Web application development ecosystem

1 lines 1.5 kB
import e,{useState as t}from"react";import r from"../_internals/resolve_tag_attributes.js";import a from"../_internals/apply_classname.js";import l from"../_internals/component.js";import o from"../_internals/children.js";import i from"../_internals/ref_apply.js";import n from"../Table/index.js";import{getBody as s,getHead as m,getPaginationFooter as p,applyVirtualization as _}from"./helpers/index.js";import c from"./styles.sass";let d="-ui-data_grid",g,u=()=>({sortByField:{ID:g,value:1},searchByField:{},toggledColumns:new Set,showPerPage:0,currentPage:1,__resultIDs:[]}),f=l(d,{theme:{root:g,_with_footer:g,children:g,table:g,table_resizer:g,pagination_wrapper:g,pagination_single_page:g,virtualization_expander_cell:g}},l=>{let d,{theme:g,className:f,rootTagAttributes:h,withFooter:w,tableAttributes:P,virtualization:b,children:j,store:S,onScroll:x}=l,v=S||t(u()),[y]=v,D={onScroll:x,className:a(f,[[g._with_footer,w]])};w&&!y.showPerPage&&(y.showPerPage=w.defaultShowPerPage),b&&(d=_({state:y,rootAttributes:D,props:l}),D.onScroll=d.onScrollHandler),i(D,l),D=r(D,h);let{body:I,resultIDs:z,from:B,to:C}=s(l,y,d?.slideWindowRange);d?.useVirtualizationScrolling(Math.min(d.maxItemsCount,z.length));let E={body:I,head:m(l,y,z,B,C),className:a(c.table,[[g.table,!0]])};return w&&(E.foot=[{children:[{value:p(l,v,z),attributes:{colSpan:100}}]}]),E=r(E,P),y.__resultIDs=z,e.createElement("div",{...D},e.createElement(n,{...E}),o(j,g))});export default f;export{u as getDefaultState,d as componentID};