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({
|
function RecordsOutputComponent({
|
||||||
pagination,
|
pagination,
|
||||||
rows,
|
rows,
|
||||||
columnMode,
|
columnMode = "union",
|
||||||
columnDefsRow,
|
columnDefsRow,
|
||||||
}: {
|
}: {
|
||||||
pagination: boolean;
|
pagination: boolean;
|
||||||
rows: any;
|
rows: any;
|
||||||
columnMode: "intersection" | "union" | "all";
|
columnMode?: "intersection" | "union";
|
||||||
columnDefsRow?: Array<Object>;
|
columnDefsRow?: Array<Object>;
|
||||||
}) {
|
}) {
|
||||||
const columns = extractColumnsFromRows(columnDefsRow ?? rows, columnMode);
|
const columns = extractColumnsFromRows(columnDefsRow ?? rows, columnMode);
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@ export function isTimeStampString(str: string): boolean {
|
||||||
|
|
||||||
export function extractColumnsFromRows(
|
export function extractColumnsFromRows(
|
||||||
rows: object[],
|
rows: object[],
|
||||||
mode: "intersection" | "union" | "all",
|
mode: "intersection" | "union" = "union",
|
||||||
): (ColDef<any> | ColGroupDef<any>)[] {
|
): (ColDef<any> | ColGroupDef<any>)[] {
|
||||||
const columnsKeys: { [key: string]: ColDef<any> | ColGroupDef<any> } = {};
|
const columnsKeys: { [key: string]: ColDef<any> | ColGroupDef<any> } = {};
|
||||||
if (rows.length === 0) {
|
if (rows.length === 0) {
|
||||||
|
|
@ -391,10 +391,8 @@ export function extractColumnsFromRows(
|
||||||
|
|
||||||
if (mode === "intersection") {
|
if (mode === "intersection") {
|
||||||
intersection();
|
intersection();
|
||||||
} else if (mode === "union") {
|
|
||||||
union();
|
|
||||||
} else {
|
} else {
|
||||||
return rows;
|
union();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.values(columnsKeys);
|
return Object.values(columnsKeys);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue