Add column resizing and reordering
All checks were successful
build / build (push) Successful in 1m26s
All checks were successful
build / build (push) Successful in 1m26s
This commit is contained in:
@@ -12,10 +12,8 @@ export interface RowsResponse {
|
|||||||
totalRows: bigint;
|
totalRows: bigint;
|
||||||
}
|
}
|
||||||
|
|
||||||
const whitespaceRegex = /\s*/g;
|
|
||||||
|
|
||||||
const sanitisedFileName = (file: File) =>
|
const sanitisedFileName = (file: File) =>
|
||||||
file.name.toLowerCase().replaceAll("'", '').replaceAll(whitespaceRegex, '');
|
file.name.toLowerCase().replaceAll("'", '').replaceAll(/\s*/g, '');
|
||||||
|
|
||||||
//https://www.npmjs.com/package/@duckdb/duckdb-wasm
|
//https://www.npmjs.com/package/@duckdb/duckdb-wasm
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|||||||
@@ -21,8 +21,12 @@ import { Column, DuckdbService } from '../duckdb.service';
|
|||||||
template: `
|
template: `
|
||||||
@if (file() && columns().length > 0) {
|
@if (file() && columns().length > 0) {
|
||||||
<p-table
|
<p-table
|
||||||
|
[reorderableColumns]="true"
|
||||||
|
[resizableColumns]="true"
|
||||||
|
columnResizeMode="expand"
|
||||||
[columns]="columns()"
|
[columns]="columns()"
|
||||||
[value]="currentValue()"
|
[value]="currentValue()"
|
||||||
|
showGridlines
|
||||||
[scrollable]="true"
|
[scrollable]="true"
|
||||||
scrollHeight="400px"
|
scrollHeight="400px"
|
||||||
[rows]="100"
|
[rows]="100"
|
||||||
@@ -34,7 +38,7 @@ import { Column, DuckdbService } from '../duckdb.service';
|
|||||||
<ng-template #header let-columns>
|
<ng-template #header let-columns>
|
||||||
<tr>
|
<tr>
|
||||||
@for (col of columns; track $index) {
|
@for (col of columns; track $index) {
|
||||||
<th style="width: 20%">
|
<th style="width: 20%" pReorderableColumn pResizableColumn>
|
||||||
{{ col.name }}
|
{{ col.name }}
|
||||||
</th>
|
</th>
|
||||||
}
|
}
|
||||||
@@ -43,7 +47,7 @@ import { Column, DuckdbService } from '../duckdb.service';
|
|||||||
<ng-template #body let-rowData let-columns="columns">
|
<ng-template #body let-rowData let-columns="columns">
|
||||||
<tr style="height: 46px">
|
<tr style="height: 46px">
|
||||||
@for (col of columns; track $index) {
|
@for (col of columns; track $index) {
|
||||||
<td>
|
<td pReorderableRowHandle>
|
||||||
{{ rowData[col.name] }}
|
{{ rowData[col.name] }}
|
||||||
</td>
|
</td>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user