mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
Clean csv values; Update qfc - for audit count fix
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
"@auth0/auth0-react": "1.10.2",
|
"@auth0/auth0-react": "1.10.2",
|
||||||
"@emotion/react": "11.7.1",
|
"@emotion/react": "11.7.1",
|
||||||
"@emotion/styled": "11.6.0",
|
"@emotion/styled": "11.6.0",
|
||||||
"@kingsrook/qqq-frontend-core": "1.0.65",
|
"@kingsrook/qqq-frontend-core": "1.0.66",
|
||||||
"@mui/icons-material": "5.4.1",
|
"@mui/icons-material": "5.4.1",
|
||||||
"@mui/material": "5.11.1",
|
"@mui/material": "5.11.1",
|
||||||
"@mui/styles": "5.11.1",
|
"@mui/styles": "5.11.1",
|
||||||
|
@ -107,7 +107,7 @@ function TableWidget(props: Props): JSX.Element
|
|||||||
{selector: ".button", format: "skip"}
|
{selector: ".button", format: "skip"}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
csv += `"${text}"`;
|
csv += `"${ValueUtils.cleanForCsv(text)}"`;
|
||||||
}
|
}
|
||||||
csv += "\n";
|
csv += "\n";
|
||||||
}
|
}
|
||||||
|
@ -193,16 +193,12 @@ function ColumnStats({tableMetaData, fieldMetaData, fieldTableName, filter}: Pro
|
|||||||
|
|
||||||
const doExport = () =>
|
const doExport = () =>
|
||||||
{
|
{
|
||||||
let csv = `"${fieldMetaData.label}","Count"\n`;
|
let csv = `"${ValueUtils.cleanForCsv(fieldMetaData.label)}","Count"\n`;
|
||||||
for (let i = 0; i < valueCounts.length; i++)
|
for (let i = 0; i < valueCounts.length; i++)
|
||||||
{
|
{
|
||||||
let fieldValue = valueCounts[i].displayValues.get(fieldMetaData.name);
|
const fieldValue = valueCounts[i].displayValues.get(fieldMetaData.name);
|
||||||
if(fieldValue === undefined)
|
const count = valueCounts[i].values.get("count");
|
||||||
{
|
csv += `"${ValueUtils.cleanForCsv(fieldValue)}",${count}\n`;
|
||||||
fieldValue = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
csv += `"${fieldValue}",${valueCounts[i].values.get("count")}\n`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileName = tableMetaData.label + " - " + fieldMetaData.label + " Column Stats " + ValueUtils.formatDateTimeForFileName(new Date()) + ".csv";
|
const fileName = tableMetaData.label + " - " + fieldMetaData.label + " Column Stats " + ValueUtils.formatDateTimeForFileName(new Date()) + ".csv";
|
||||||
|
@ -418,6 +418,19 @@ class ValueUtils
|
|||||||
return toPush;
|
return toPush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** for building CSV in frontends, cleanse null & undefined, and escape "'s
|
||||||
|
*******************************************************************************/
|
||||||
|
public static cleanForCsv(param: any): string
|
||||||
|
{
|
||||||
|
if(param === undefined || param === null)
|
||||||
|
{
|
||||||
|
return ("");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (String(param).replaceAll(/"/g, "\"\""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Reference in New Issue
Block a user