@kwantis-id3/frontend-library 1.5.0 → 1.5.1-alpha.1-tableHeaderRerenders
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -501,7 +501,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"@emotion/react/jsx-runtime";import*
|
|
|
501
501
|
max-height: 60px;
|
|
502
502
|
margin: 0 auto;
|
|
503
503
|
overflow: auto;
|
|
504
|
-
`,tr=e=>{const t=e.column.id,n=e.row.original.cells[t];return{style:{backgroundColor:n?.bgColor??void 0,color:n?.textColor??void 0}}},nr=i=>{const[o,l]=r([]),[s,c]=r(i.columns.reduce(((e,t)=>{const n={...e},i=t.meta?.isHidden??!1;return t.id&&(n[t.id]=!i),n}),{})),[d,p]=r(Object),
|
|
504
|
+
`,tr=e=>{const t=e.column.id,n=e.row.original.cells[t];return{style:{backgroundColor:n?.bgColor??void 0,color:n?.textColor??void 0}}},nr=i=>{const[o,l]=r([]),[s,c]=r(i.columns.reduce(((e,t)=>{const n={...e},i=t.meta?.isHidden??!1;return t.id&&(n[t.id]=!i),n}),{})),[d,p]=r(Object),g=Oe(),b=_(),h=u(null);a((()=>{c(i.columns.reduce(((e,t)=>{const n={...e},i=t.meta?.isHidden??!1;return t.id&&(n[t.id]=!i),n}),{}))}),[i.columns]),a((()=>{const e=h.current;if(!e)return;const t=()=>{e.classList.toggle("dg-scrolled",e.scrollTop>0)};return e.addEventListener("scroll",t,{passive:!0}),()=>{e.removeEventListener("scroll",t)}}),[]);const m=S({data:i.data||[],columns:i.columns,state:{columnFilters:o,columnVisibility:s},onColumnFiltersChange:l,getCoreRowModel:H(),getFilteredRowModel:O(),getSortedRowModel:N(),getFacetedRowModel:z(),getFacetedUniqueValues:E(),getFacetedMinMaxValues:L(),debugAll:!1}),f=u(i.onFilteredRowsChange);f.current=i.onFilteredRowsChange;const v=u([]),I=m.getRowModel().rows;return a((()=>{if(f.current){const e=I.map((e=>e.original));(e.length!==v.current.length||e.some(((e,t)=>e!==v.current[t])))&&(v.current=e,f.current(e))}}),[I]),e(Ko,{ref:h,children:t(qo,{$mobileBreakpoint:768,children:[e("colgroup",{children:g?e("col",{}):m.getHeaderGroups().map((t=>t.headers.map((t=>e("col",{style:{width:150!==t.getSize()?t.getSize():void 0}},t.id)))))}),e("thead",{children:m.getHeaderGroups().map((i=>e("tr",{className:"header",children:i.headers.map((i=>e("th",{colSpan:i.colSpan,css:{backgroundColor:"transparent",".dg-scrolled &":{backgroundColor:b.activePalette.background.main}},children:i.isPlaceholder?null:t(n,{children:[t("div",{className:"flex h-center v-center",children:[t("div",{className:i.column.getCanSort()?"cursorPointer":"",onClick:i.column.getToggleSortingHandler(),children:[D(i.column.columnDef.header,i.getContext()),{asc:" 🔼",desc:" 🔽"}[i.column.getIsSorted()]??null]}),i.column.getCanFilter()?e("div",{className:"cursorPointer",style:{height:"fit-content",display:"flex",alignItems:"center"},"data-testid":`filterIcon-${i.column.id}`,onClick:()=>{const e={...d};e[i.column.id]=!e[i.column.id],p(e)},children:e(B,{size:16})}):null]}),i.column.getCanFilter()&&d[i.column.id]?e("div",{className:"flex h-center",children:e(_o,{column:i.column,table:m})}):null]})},i.id)))},i.id)))}),e("tbody",{children:m.getRowModel().rows.map((n=>{return e("tr",{...(i=n,{style:{backgroundColor:i.original.info?.bgColor??void 0,color:i.original.info?.textColor??void 0}}),children:n.getVisibleCells().map((n=>e("td",{...tr(n.getContext()),children:t("div",{children:[g?e("div",{className:"cellContent",children:n.column.columnDef.header.charAt(0).toUpperCase()+n.column.columnDef.header.slice(1)}):null,e("div",{className:"cellContent",children:D(n.column.columnDef.cell,n.getContext())})]})},n.id)))},n.id);var i}))})]})})},ir=t=>e(er,{children:(t=>"boolean"==typeof t?e(Fo,{variant:t?"success":"error"}):t)(t)}),or=i=>{const[o,l]=r([]),[s,c]=r(i.columns.reduce(((e,t)=>{const n={...e},i=t.meta?.isHidden??!1;return t.id&&(n[t.id]=!i),n}),{})),[d,p]=r(Object),g=Oe(),b=_(),h=u(null),m=S({data:i.data||[],columns:i.columns,state:{columnFilters:o,columnVisibility:s},onColumnFiltersChange:l,getCoreRowModel:H(),getFilteredRowModel:O(),getSortedRowModel:N(),getFacetedRowModel:z(),getFacetedUniqueValues:E(),getFacetedMinMaxValues:L(),debugAll:!1}),f=u(i.onFilteredRowsChange);f.current=i.onFilteredRowsChange;const v=u([]),I=m.getRowModel().rows;return a((()=>{if(f.current){const e=I.map((e=>e.original));(e.length!==v.current.length||e.some(((e,t)=>e!==v.current[t])))&&(v.current=e,f.current(e))}}),[I]),a((()=>{c(i.columns.reduce(((e,t)=>{const n={...e},i=t.meta?.isHidden??!1;return t.id&&(n[t.id]=!i),n}),{}))}),[i.columns]),a((()=>{const e=h.current;if(!e)return;const t=()=>{e.classList.toggle("dg-scrolled",e.scrollTop>0)};return e.addEventListener("scroll",t,{passive:!0}),()=>{e.removeEventListener("scroll",t)}}),[]),e(Ko,{ref:h,children:t(qo,{$mobileBreakpoint:768,children:[e("colgroup",{children:g?e("col",{}):m.getHeaderGroups().map((t=>t.headers.map((t=>e("col",{},t.id)))))}),e("thead",{children:m.getHeaderGroups().map((i=>e("tr",{className:"header",children:i.headers.map((i=>e("th",{colSpan:i.colSpan,css:{backgroundColor:"transparent",".dg-scrolled &":{backgroundColor:b.activePalette.background.main}},children:i.isPlaceholder?null:t(n,{children:[t("div",{className:"flex h-center v-center",children:[t("div",{className:i.column.getCanSort()?"cursorPointer":"",onClick:i.column.getToggleSortingHandler(),children:[D(i.column.columnDef.header,i.getContext()),{asc:" 🔼",desc:" 🔽"}[i.column.getIsSorted()]??null]}),i.column.getCanFilter()?e("div",{className:"cursorPointer",style:{height:"fit-content",display:"flex",alignItems:"center"},"data-testid":`filterIcon-${i.column.id}`,onClick:()=>{const e={...d};e[i.column.id]=!e[i.column.id],p(e)},children:e(B,{size:16})}):null]}),i.column.getCanFilter()&&d[i.column.id]?e("div",{className:"flex h-center",children:e(_o,{column:i.column,table:m})}):null]})},i.id)))},i.id)))}),e("tbody",{children:m.getRowModel().rows.map((n=>e("tr",{children:n.getVisibleCells().map((n=>e("td",{children:t("div",{children:[g?e("div",{className:"cellContent",children:n.column.columnDef.header.charAt(0).toUpperCase()+n.column.columnDef.header.slice(1)}):null,e("div",{className:"cellContent",children:D(n.column.columnDef.cell,n.getContext())})]})},n.id)))},n.id)))})]})})},rr=C("div",He)`
|
|
505
505
|
display: grid;
|
|
506
506
|
grid-template-columns: repeat(
|
|
507
507
|
auto-fit,
|