@flipdish/portal-library 1.0.49 → 1.0.50
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/components/ui/GenericTable/types.d.ts +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js.map +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/styles"),i=require("@mui/material/TableBody"),r=require("@mui/material/TableCell"),l=require("@mui/material/TableRow"),a=require("@mui/material/Skeleton"),o=require("../GenericTableBodyRow/GenericTableBodyRow.cjs.js");const n=t.styled(r,{shouldForwardProp:e=>"align"!==e&&"titleCell"!==e&&"warning"!==e&&"sticky"!==e})((({align:e,titleCell:t,warning:i,sticky:r})=>({textAlign:e,fontWeight:t?"bold":"normal",backgroundColor:i?"#ffcccb":"inherit",position:r?"sticky":"static"}))),s=({colIdx:t,colName:i,hasWarning:r,hasTitle:l,meta:a,row:o,type:s})=>{const c=o[i],m={align:a[i].align??"left",warning:r,titleCell:l,sticky:"sticky"===s&&0===t,"data-testid":`col-${i}`};switch(a[i].columnType){case"String":default:return e.jsx(n,{...m,children:c??"-"});case"Custom":return e.jsx(n,{...m,children:c?a[i].customComponent(c):"-"})}};module.exports=({columns:t,data:r,loading:c,type:m,onRowClick:d,meta:u})=>e.jsx(i,{children:c?Array.from(Array(5)).map(((i,r)=>e.jsx(l,{"data-testid":"row-loader",children:Array.from(t).map(((t,i)=>e.jsx(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${t}`,children:e.jsx(a,{width:"90%",height:22})},i)))},r))):r?.map(((i,r)=>e.jsx(o,{onRowClick:d,row:i,tableRowTestKey:r.toString(),children:Array.from(t).map(((t,r)=>e.jsx(s,{colIdx:r,colName:t,row:i,type:m,meta:u},r)))},r)))});
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/styles"),i=require("@mui/material/TableBody"),r=require("@mui/material/TableCell"),l=require("@mui/material/TableRow"),a=require("@mui/material/Skeleton"),o=require("../GenericTableBodyRow/GenericTableBodyRow.cjs.js");const n=t.styled(r,{shouldForwardProp:e=>"align"!==e&&"titleCell"!==e&&"warning"!==e&&"sticky"!==e})((({align:e,titleCell:t,warning:i,sticky:r})=>({textAlign:e,fontWeight:t?"bold":"normal",backgroundColor:i?"#ffcccb":"inherit",position:r?"sticky":"static"}))),s=({colIdx:t,colName:i,hasWarning:r,hasTitle:l,meta:a,row:o,type:s})=>{const c=o[i],m={align:a[i].align??"left",warning:r,titleCell:l,sticky:"sticky"===s&&0===t,"data-testid":`col-${i}`};switch(a[i].columnType){case"String":default:return e.jsx(n,{...m,children:c??"-"});case"Custom":return e.jsx(n,{...m,children:c?a[i].customComponent(c,o):"-"})}};module.exports=({columns:t,data:r,loading:c,type:m,onRowClick:d,meta:u})=>e.jsx(i,{children:c?Array.from(Array(5)).map(((i,r)=>e.jsx(l,{"data-testid":"row-loader",children:Array.from(t).map(((t,i)=>e.jsx(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${t}`,children:e.jsx(a,{width:"90%",height:22})},i)))},r))):r?.map(((i,r)=>e.jsx(o,{onRowClick:d,row:i,tableRowTestKey:r.toString(),children:Array.from(t).map(((t,r)=>e.jsx(s,{colIdx:r,colName:t,row:i,type:m,meta:u},r)))},r)))});
|
|
2
2
|
//# sourceMappingURL=GenericTableBody.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBody.cjs.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n textAlign: align,\n fontWeight: titleCell ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n}));\n\nexport type TableCellProps = {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\n const prop = row[colName];\n const align = meta[colName].align ?? 'left';\n const tableCellProps = {\n align,\n warning: hasWarning,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n };\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop) : '-'}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n }\n};\n\ntype TableBodyProps = {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'sticky' | 'normal';\n};\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","tableCellProps","columnType","_jsx","jsx","customComponent","columns","data","loading","onRowClick","MuiTableBody","
|
|
1
|
+
{"version":3,"file":"GenericTableBody.cjs.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n textAlign: align,\n fontWeight: titleCell ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n}));\n\nexport type TableCellProps = {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\n const prop = row[colName];\n const align = meta[colName].align ?? 'left';\n const tableCellProps = {\n align,\n warning: hasWarning,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n };\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop, row) : '-'}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n }\n};\n\ntype TableBodyProps = {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'sticky' | 'normal';\n};\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","tableCellProps","columnType","_jsx","jsx","children","customComponent","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","width","height","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"mSAUA,MAAMA,EAAkBC,EAAMA,OAACC,EAAW,CACtCC,kBAAoBC,GAAkB,UAATA,GAA6B,cAATA,GAAiC,YAATA,GAA+B,WAATA,GAD3EH,EAEqD,EAAGI,QAAOC,YAAWC,UAASC,aAAc,CACrHC,UAAWJ,EACXK,WAAYJ,EAAY,OAAS,SACjCK,gBAAiBJ,EAAU,UAAY,UACvCK,SAAUJ,EAAS,SAAW,aAc5BK,EAA4C,EAAGC,SAAQC,UAASC,aAAYC,WAAUC,OAAMC,MAAKC,WACnG,MAAMhB,EAAOe,EAAIJ,GAEXM,EAAiB,CACnBhB,MAFUa,EAAKH,GAASV,OAAS,OAGjCE,QAASS,EACTV,UAAWW,EACXT,OAAiB,WAATY,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,KAG1B,OAAQG,EAAKH,GAASO,YAClB,IAAK,SAIL,QACI,OAAOC,EAAAC,IAACxB,EAAoB,IAAAqB,WAAiBjB,GAAQ,MAHzD,IAAK,SACD,OAAOmB,EAAAA,IAACvB,EAAe,IAAKqB,EAAcI,SAAGrB,EAAOc,EAAKH,GAASW,gBAAgBtB,EAAMe,GAAO,MAGtG,iBAc8C,EAAGQ,UAASC,OAAMC,UAAST,OAAMU,aAAYZ,UAGxFK,MAACQ,EAAY,CAAAN,SACRI,EACKG,MAAMC,KAAKD,MAJL,IAIyBE,KAAI,CAACC,EAAGC,IACnCb,EAAAC,IAACa,EAA+B,CAAA,cAAA,sBAC3BL,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAYxB,IAClCS,MAACvB,GAEGK,MAAO,OACPC,WAAW,EACXC,SAAS,EACTC,QAAQ,EAAK,cACA,OAAO8B,IAEpBb,SAAAF,EAAAA,IAACgB,EAAS,CAAAC,MAAM,MAAMC,OAAQ,MAPzB3B,MAHFsB,KAenBR,GAAMM,KAAI,CAACf,EAAKuB,IACZnB,EAAAA,IAACoB,EAAmB,CAAcb,WAAYA,EAAYX,IAAKA,EAAKyB,gBAAiBF,EAAOG,WACvFpB,SAAAO,MAAMC,KAAKN,GAASO,KAAI,CAACnB,EAASD,IAC/BS,EAAAA,IAACV,EAAe,CAAcC,OAAQA,EAAQC,QAASA,EAASI,IAAKA,EAAKC,KAAMA,EAAMF,KAAMA,GAAtEJ,MAFJ4B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{styled as e}from"@mui/material/styles";import i from"@mui/material/TableBody";import r from"@mui/material/TableCell";import o from"@mui/material/TableRow";import a from"@mui/material/Skeleton";import l from"../GenericTableBodyRow/GenericTableBodyRow.js";const n=e(r,{shouldForwardProp:t=>"align"!==t&&"titleCell"!==t&&"warning"!==t&&"sticky"!==t})((({align:t,titleCell:e,warning:i,sticky:r})=>({textAlign:t,fontWeight:e?"bold":"normal",backgroundColor:i?"#ffcccb":"inherit",position:r?"sticky":"static"}))),m=({colIdx:e,colName:i,hasWarning:r,hasTitle:o,meta:a,row:l,type:m})=>{const c=l[i],s={align:a[i].align??"left",warning:r,titleCell:o,sticky:"sticky"===m&&0===e,"data-testid":`col-${i}`};switch(a[i].columnType){case"String":default:return t(n,{...s,children:c??"-"});case"Custom":return t(n,{...s,children:c?a[i].customComponent(c):"-"})}},c=({columns:e,data:r,loading:c,type:s,onRowClick:d,meta:p})=>t(i,{children:c?Array.from(Array(5)).map(((i,r)=>t(o,{"data-testid":"row-loader",children:Array.from(e).map(((e,i)=>t(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${e}`,children:t(a,{width:"90%",height:22})},i)))},r))):r?.map(((i,r)=>t(l,{onRowClick:d,row:i,tableRowTestKey:r.toString(),children:Array.from(e).map(((e,r)=>t(m,{colIdx:r,colName:e,row:i,type:s,meta:p},r)))},r)))});export{c as default};
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{styled as e}from"@mui/material/styles";import i from"@mui/material/TableBody";import r from"@mui/material/TableCell";import o from"@mui/material/TableRow";import a from"@mui/material/Skeleton";import l from"../GenericTableBodyRow/GenericTableBodyRow.js";const n=e(r,{shouldForwardProp:t=>"align"!==t&&"titleCell"!==t&&"warning"!==t&&"sticky"!==t})((({align:t,titleCell:e,warning:i,sticky:r})=>({textAlign:t,fontWeight:e?"bold":"normal",backgroundColor:i?"#ffcccb":"inherit",position:r?"sticky":"static"}))),m=({colIdx:e,colName:i,hasWarning:r,hasTitle:o,meta:a,row:l,type:m})=>{const c=l[i],s={align:a[i].align??"left",warning:r,titleCell:o,sticky:"sticky"===m&&0===e,"data-testid":`col-${i}`};switch(a[i].columnType){case"String":default:return t(n,{...s,children:c??"-"});case"Custom":return t(n,{...s,children:c?a[i].customComponent(c,l):"-"})}},c=({columns:e,data:r,loading:c,type:s,onRowClick:d,meta:p})=>t(i,{children:c?Array.from(Array(5)).map(((i,r)=>t(o,{"data-testid":"row-loader",children:Array.from(e).map(((e,i)=>t(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${e}`,children:t(a,{width:"90%",height:22})},i)))},r))):r?.map(((i,r)=>t(l,{onRowClick:d,row:i,tableRowTestKey:r.toString(),children:Array.from(e).map(((e,r)=>t(m,{colIdx:r,colName:e,row:i,type:s,meta:p},r)))},r)))});export{c as default};
|
|
2
2
|
//# sourceMappingURL=GenericTableBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBody.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n textAlign: align,\n fontWeight: titleCell ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n}));\n\nexport type TableCellProps = {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\n const prop = row[colName];\n const align = meta[colName].align ?? 'left';\n const tableCellProps = {\n align,\n warning: hasWarning,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n };\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop) : '-'}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n }\n};\n\ntype TableBodyProps = {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'sticky' | 'normal';\n};\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","tableCellProps","columnType","_jsx","customComponent","GenericTableBody","columns","data","loading","onRowClick","MuiTableBody","
|
|
1
|
+
{"version":3,"file":"GenericTableBody.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n textAlign: align,\n fontWeight: titleCell ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n}));\n\nexport type TableCellProps = {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\n const prop = row[colName];\n const align = meta[colName].align ?? 'left';\n const tableCellProps = {\n align,\n warning: hasWarning,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n };\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop, row) : '-'}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? '-'}</StyledTableCell>;\n }\n};\n\ntype TableBodyProps = {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'sticky' | 'normal';\n};\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","tableCellProps","columnType","_jsx","children","customComponent","GenericTableBody","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","width","height","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"6SAUA,MAAMA,EAAkBC,EAAOC,EAAW,CACtCC,kBAAoBC,GAAkB,UAATA,GAA6B,cAATA,GAAiC,YAATA,GAA+B,WAATA,GAD3EH,EAEqD,EAAGI,QAAOC,YAAWC,UAASC,aAAc,CACrHC,UAAWJ,EACXK,WAAYJ,EAAY,OAAS,SACjCK,gBAAiBJ,EAAU,UAAY,UACvCK,SAAUJ,EAAS,SAAW,aAc5BK,EAA4C,EAAGC,SAAQC,UAASC,aAAYC,WAAUC,OAAMC,MAAKC,WACnG,MAAMhB,EAAOe,EAAIJ,GAEXM,EAAiB,CACnBhB,MAFUa,EAAKH,GAASV,OAAS,OAGjCE,QAASS,EACTV,UAAWW,EACXT,OAAiB,WAATY,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,KAG1B,OAAQG,EAAKH,GAASO,YAClB,IAAK,SAIL,QACI,OAAOC,EAACvB,EAAoB,IAAAqB,WAAiBjB,GAAQ,MAHzD,IAAK,SACD,OAAOmB,EAACvB,EAAe,IAAKqB,EAAcG,SAAGpB,EAAOc,EAAKH,GAASU,gBAAgBrB,EAAMe,GAAO,MAGtG,EAcCO,EAA6C,EAAGC,UAASC,OAAMC,UAAST,OAAMU,aAAYZ,UAGxFK,EAACQ,EAAY,CAAAP,SACRK,EACKG,MAAMC,KAAKD,MAJL,IAIyBE,KAAI,CAACC,EAAGC,IACnCb,EAACc,EAA+B,CAAA,cAAA,sBAC3BL,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAYxB,IAClCS,EAACvB,GAEGK,MAAO,OACPC,WAAW,EACXC,SAAS,EACTC,QAAQ,EAAK,cACA,OAAO8B,IAEpBd,SAAAD,EAACgB,EAAS,CAAAC,MAAM,MAAMC,OAAQ,MAPzB3B,MAHFsB,KAenBR,GAAMM,KAAI,CAACf,EAAKuB,IACZnB,EAACoB,EAAmB,CAAcb,WAAYA,EAAYX,IAAKA,EAAKyB,gBAAiBF,EAAOG,WACvFrB,SAAAQ,MAAMC,KAAKN,GAASO,KAAI,CAACnB,EAASD,IAC/BS,EAACV,EAAe,CAAcC,OAAQA,EAAQC,QAASA,EAASI,IAAKA,EAAKC,KAAMA,EAAMF,KAAMA,GAAtEJ,MAFJ4B"}
|