Browse Source
Merge pull request #4 from davidsi02/infinite-scroll
Infinite Scroll - Table Height Input
pull/23670/head
David Simões
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
8 additions and
1 deletions
-
npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.html
-
npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts
|
|
|
@ -9,7 +9,7 @@ |
|
|
|
[selected]="selected" |
|
|
|
(scroll)="onScroll($event)" |
|
|
|
[scrollbarV]="infiniteScroll" |
|
|
|
[style.height]="infiniteScroll ? '300px' : 'auto'" |
|
|
|
[style.height]="getTableHeight()" |
|
|
|
[loadingIndicator]="infiniteScroll && isLoading" |
|
|
|
[footerHeight]="infiniteScroll ? false : 50" |
|
|
|
> |
|
|
|
|
|
|
|
@ -121,6 +121,7 @@ export class ExtensibleTableComponent<R = any> implements OnChanges, AfterViewIn |
|
|
|
@Input() infiniteScroll = false; |
|
|
|
@Input() isLoading = false; |
|
|
|
@Output() loadMore = new EventEmitter<void>(); |
|
|
|
@Input() tableHeight: number; |
|
|
|
|
|
|
|
hasAtLeastOnePermittedAction: boolean; |
|
|
|
|
|
|
|
@ -262,6 +263,12 @@ export class ExtensibleTableComponent<R = any> implements OnChanges, AfterViewIn |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
getTableHeight() { |
|
|
|
if (!this.infiniteScroll) return 'auto'; |
|
|
|
|
|
|
|
return this.tableHeight ? `${this.tableHeight}px` : 'auto'; |
|
|
|
} |
|
|
|
|
|
|
|
ngAfterViewInit(): void { |
|
|
|
if (!this.infiniteScroll) { |
|
|
|
this.list?.requestStatus$?.pipe(filter(status => status === 'loading')).subscribe(() => { |
|
|
|
|