perspectives: render simple table

This commit is contained in:
Jan Prochazka
2022-06-23 16:04:05 +02:00
parent 4672540f82
commit aca92f3889
5 changed files with 75 additions and 7 deletions

View File

@@ -0,0 +1,18 @@
import { PerspectiveTableNode, PerspectiveTreeNode } from './PerspectiveTreeNode';
export class PerspectiveDisplayColumn {
constructor(public label: string, public field: string) {}
}
export class PerspectiveDisplay {
columns: PerspectiveDisplayColumn[] = [];
constructor(public root: PerspectiveTreeNode, public rows: any[]) {
const children = root.childNodes;
for (const child of children) {
if (child.isChecked) {
this.columns.push(new PerspectiveDisplayColumn(child.title, child.codeName));
}
}
}
}

View File

@@ -7,6 +7,7 @@ import _cloneDeep from 'lodash/cloneDeep';
export interface PerspectiveDataLoadProps {
schemaName: string;
pureName: string;
dataColumns: string[];
bindingColumns?: string[];
bindingValues?: any[][];
}
@@ -128,6 +129,7 @@ export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
pureName: this.foreignKey.refTableName,
bindingColumns: [this.foreignKey.columns[0].refColumnName],
bindingValues: parentRows.map(row => row[this.foreignKey.columns[0].columnName]),
dataColumns: null,
};
}
@@ -178,6 +180,7 @@ export class PerspectiveTableNode extends PerspectiveTreeNode {
return {
schemaName: this.table.schemaName,
pureName: this.table.pureName,
dataColumns: null,
};
}
@@ -227,6 +230,7 @@ export class PerspectiveTableReferenceNode extends PerspectiveTableNode {
pureName: this.table.pureName,
bindingColumns: [this.foreignKey.columns[0].columnName],
bindingValues: parentRows.map(row => row[this.foreignKey.columns[0].refColumnName]),
dataColumns: null,
};
}
}

View File

@@ -14,3 +14,4 @@ export * from './FormViewDisplay';
export * from './TableFormViewDisplay';
export * from './CollectionGridDisplay';
export * from './deleteCascade';
export * from './PerspectiveDisplay';