adjusted data table to accept "dense" param
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<div
|
||||
class="data-table-container"
|
||||
[class.dense]="dense()"
|
||||
[style.max-height]="maxHeight()"
|
||||
[style.overflow-y]="containerOverflow()">
|
||||
<table
|
||||
@@ -36,9 +37,15 @@
|
||||
@for (col of columns(); track col.id) {
|
||||
<ng-container [matColumnDef]="col.id">
|
||||
@if (col.headerTemplate) {
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
<ng-container *ngTemplateOutlet="col.headerTemplate"></ng-container>
|
||||
</th>
|
||||
@if (col.type === 'accessor') {
|
||||
<th mat-header-cell *matHeaderCellDef [mat-sort-header]="col.id">
|
||||
<ng-container *ngTemplateOutlet="col.headerTemplate"></ng-container>
|
||||
</th>
|
||||
} @else {
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
<ng-container *ngTemplateOutlet="col.headerTemplate"></ng-container>
|
||||
</th>
|
||||
}
|
||||
} @else if (col.type === 'accessor') {
|
||||
<th mat-header-cell *matHeaderCellDef [mat-sort-header]="col.id">
|
||||
{{ col.header }}
|
||||
|
||||
@@ -22,6 +22,42 @@
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
.data-table-container.dense {
|
||||
--mat-table-header-container-height: auto;
|
||||
--mat-table-row-item-container-height: auto;
|
||||
--mat-table-footer-container-height: auto;
|
||||
|
||||
.mat-mdc-header-row,
|
||||
.mat-mdc-row {
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.mat-mdc-header-cell,
|
||||
.mat-mdc-cell {
|
||||
min-height: 0;
|
||||
padding: 2px 8px;
|
||||
font-size: 11.5px;
|
||||
line-height: 1.2;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.mat-mdc-header-cell {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.mat-mdc-header-cell:first-of-type,
|
||||
.mat-mdc-cell:first-of-type {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.mat-mdc-header-cell:last-of-type,
|
||||
.mat-mdc-cell:last-of-type {
|
||||
padding-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.no-data {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
@@ -72,6 +72,7 @@ export class DataTableComponent<T> implements AfterViewInit {
|
||||
maxHeight = input<string | null>(null);
|
||||
containerOverflow = computed(() => (this.maxHeight() ? 'auto' : 'visible'));
|
||||
stickyHeader = input<boolean>(true);
|
||||
dense = input<boolean>(false);
|
||||
|
||||
queryParamSortKey = input<string | null>(null);
|
||||
queryParamSortDirectionKey = input<string | null>(null);
|
||||
|
||||
Reference in New Issue
Block a user