Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ import { DataTableSummaryRowComponent } from './summary/summary-row.component';
<div [style.transform]="renderOffset()">
@for (group of rowsToRender(); track rowTrackingFn(i, group); let i = $index) {
@if (!group && ghostLoadingIndicator()) {
<ghost-loader cellMode [columns]="columns" [pageSize]="1" [rowHeight]="rowHeight()" />
<ghost-loader [columns]="columns" [pageSize]="1" [rowHeight]="rowHeight()" />
} @else if (group) {
@let disableRowCheck = this.disableRowCheck();
@let disabled = isRow(group) && disableRowCheck && disableRowCheck(group);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<div class="ghost-loader ghost-cell-container" [style.height.px]="ghostBodyHeight()">
<div class="ghost-loader ghost-cell-container" [style.height]="ghostBodyHeight()">
@for (item of [].constructor(pageSize()); track $index) {
<div
class="ghost-element"
[style.height.px]="rowHeight()"
[class.datatable-body-row]="cellMode()"
>
<div class="ghost-element datatable-body-row" [style.height]="rowHeightComputed()">
@for (col of columns(); track col) {
<div
class="ghost-cell"
[class.datatable-body-cell]="cellMode()"
[style.width.px]="col.width"
>
<div class="ghost-cell datatable-body-cell" [style.width.px]="col.width">
@if (!col.ghostCellTemplate) {
<div class="line ghost-cell-strip"></div>
} @else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { NgTemplateOutlet } from '@angular/common';
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
numberAttribute,
input
} from '@angular/core';
import { ChangeDetectionStrategy, Component, numberAttribute, input } from '@angular/core';

import { TableColumnInternal } from '../../../types/internal.types';

Expand All @@ -21,5 +15,13 @@ export class DataTableGhostLoaderComponent {
readonly pageSize = input.required<number, unknown>({ transform: numberAttribute });
readonly rowHeight = input.required<number | 'auto' | ((row?: any) => number)>();
readonly ghostBodyHeight = input<number, unknown>(undefined, { transform: numberAttribute });
readonly cellMode = input(false, { transform: booleanAttribute });

protected readonly rowHeightComputed = () => {
const rowHeight = this.rowHeight();
if (typeof rowHeight === 'function') {
// If rowHeight is a function, we cannot determine a fixed height here.
return 'auto';
}
return rowHeight === 'auto' ? 'auto' : rowHeight + 'px';
};
}
Loading