mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 14:33:59 +00:00
perspective row spans
This commit is contained in:
@@ -58,6 +58,7 @@ interface CollectedPerspectiveDisplayRow {
|
|||||||
export class PerspectiveDisplayRow {
|
export class PerspectiveDisplayRow {
|
||||||
constructor(public display: PerspectiveDisplay) {
|
constructor(public display: PerspectiveDisplay) {
|
||||||
this.rowData = _fill(Array(display.columns.length), undefined);
|
this.rowData = _fill(Array(display.columns.length), undefined);
|
||||||
|
this.rowSpans = _fill(Array(display.columns.length), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRow(rowIndex): PerspectiveDisplayRow {
|
getRow(rowIndex): PerspectiveDisplayRow {
|
||||||
@@ -68,7 +69,7 @@ export class PerspectiveDisplayRow {
|
|||||||
return this.subrows[rowIndex - 1];
|
return this.subrows[rowIndex - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
subrows: PerspectiveDisplayRow[] = [];
|
subrows?: PerspectiveDisplayRow[] = [];
|
||||||
|
|
||||||
rowData: any[] = [];
|
rowData: any[] = [];
|
||||||
rowSpans: number[] = null;
|
rowSpans: number[] = null;
|
||||||
@@ -180,6 +181,22 @@ export class PerspectiveDisplay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fillRowSpans() {
|
||||||
|
const lastFilledColumns = _fill(Array(this.columns.length), 0);
|
||||||
|
let rowIndex = 0;
|
||||||
|
for (const row of this.rows) {
|
||||||
|
for (let i = 0; i < this.columns.length; i++) {
|
||||||
|
if (row.rowData[i] !== undefined) {
|
||||||
|
if (rowIndex - lastFilledColumns[i] > 1) {
|
||||||
|
this.rows[lastFilledColumns[i]].rowSpans[i] = rowIndex - lastFilledColumns[i];
|
||||||
|
}
|
||||||
|
lastFilledColumns[i] = rowIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mergeRows(collectedRows: CollectedPerspectiveDisplayRow[]) {
|
mergeRows(collectedRows: CollectedPerspectiveDisplayRow[]) {
|
||||||
const rows = [];
|
const rows = [];
|
||||||
for (const collectedRow of collectedRows) {
|
for (const collectedRow of collectedRows) {
|
||||||
@@ -190,6 +207,10 @@ export class PerspectiveDisplay {
|
|||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
this.flushFlatRows(row);
|
this.flushFlatRows(row);
|
||||||
}
|
}
|
||||||
|
for (const row of this.rows) {
|
||||||
|
delete row.subrows;
|
||||||
|
}
|
||||||
|
this.fillRowSpans();
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeRow(collectedRow: CollectedPerspectiveDisplayRow, resultRow: PerspectiveDisplayRow) {
|
mergeRow(collectedRow: CollectedPerspectiveDisplayRow, resultRow: PerspectiveDisplayRow) {
|
||||||
|
|||||||
@@ -96,7 +96,10 @@
|
|||||||
{#each display.rows as row}
|
{#each display.rows as row}
|
||||||
<tr>
|
<tr>
|
||||||
{#each display.columns as column}
|
{#each display.columns as column}
|
||||||
<td>{row.rowData[column.columnIndex]}</td>
|
<!-- <td>{row.rowSpans[column.columnIndex]} {row.rowData[column.columnIndex]}</td> -->
|
||||||
|
{#if row.rowData[column.columnIndex] !== undefined}
|
||||||
|
<td rowspan={row.rowSpans[column.columnIndex]}>{row.rowData[column.columnIndex]}</td>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
Reference in New Issue
Block a user