mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 19:36:00 +00:00
perspectives WIP
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import { PerspectiveTableNode, PerspectiveTreeNode } from './PerspectiveTreeNode';
|
||||
|
||||
export class PerspectiveDisplayColumn {
|
||||
constructor(public label: string, public field: string) {}
|
||||
subColumns: PerspectiveDisplayColumn[] = [];
|
||||
title: string;
|
||||
dataField: string;
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
export class PerspectiveDisplay {
|
||||
@@ -9,10 +13,25 @@ export class PerspectiveDisplay {
|
||||
|
||||
constructor(public root: PerspectiveTreeNode, public rows: any[]) {
|
||||
const children = root.childNodes;
|
||||
this.fillChildren(root.childNodes, this.columns);
|
||||
}
|
||||
|
||||
fillChildren(children: PerspectiveTreeNode[], columns: PerspectiveDisplayColumn[]) {
|
||||
for (const child of children) {
|
||||
if (child.isChecked) {
|
||||
this.columns.push(new PerspectiveDisplayColumn(child.title, child.codeName));
|
||||
const childColumn = this.nodeToColumn(child);
|
||||
columns.push(childColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nodeToColumn(node: PerspectiveTreeNode) {
|
||||
const res = new PerspectiveDisplayColumn();
|
||||
res.title = node.columnTitle;
|
||||
res.dataField = node.dataField;
|
||||
if (node.isExpandable) {
|
||||
this.fillChildren(node.childNodes, res.subColumns);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user