fix(recordsOutputComponent): set default value for columnMode prop to "union" to
prevent potential issues with missing prop fix(utils.ts): set default value for mode parameter in extractColumnsFromRows function to "union" to ensure consistent behavior and prevent errors
This commit is contained in:
parent
885712ac06
commit
729f12d02e
2 changed files with 4 additions and 6 deletions
|
|
@ -7,12 +7,12 @@ import TableComponent from "../tableComponent";
|
|||
function RecordsOutputComponent({
|
||||
pagination,
|
||||
rows,
|
||||
columnMode,
|
||||
columnMode = "union",
|
||||
columnDefsRow,
|
||||
}: {
|
||||
pagination: boolean;
|
||||
rows: any;
|
||||
columnMode: "intersection" | "union" | "all";
|
||||
columnMode?: "intersection" | "union";
|
||||
columnDefsRow?: Array<Object>;
|
||||
}) {
|
||||
const columns = extractColumnsFromRows(columnDefsRow ?? rows, columnMode);
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ export function isTimeStampString(str: string): boolean {
|
|||
|
||||
export function extractColumnsFromRows(
|
||||
rows: object[],
|
||||
mode: "intersection" | "union" | "all",
|
||||
mode: "intersection" | "union" = "union",
|
||||
): (ColDef<any> | ColGroupDef<any>)[] {
|
||||
const columnsKeys: { [key: string]: ColDef<any> | ColGroupDef<any> } = {};
|
||||
if (rows.length === 0) {
|
||||
|
|
@ -391,10 +391,8 @@ export function extractColumnsFromRows(
|
|||
|
||||
if (mode === "intersection") {
|
||||
intersection();
|
||||
} else if (mode === "union") {
|
||||
union();
|
||||
} else {
|
||||
return rows;
|
||||
union();
|
||||
}
|
||||
|
||||
return Object.values(columnsKeys);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue