Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: empty message separator line alligned #140

Merged
Merged
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
@@ -1,5 +1,5 @@
<ng-template #actionColumn let-rowObject="localRowObject">
<ng-container *ngIf="viewTableRowObserved || editTableRowObserved || deleteTableRowObserved">
<ng-container *ngIf="anyRowActionObserved">
<td
class="actions"
pFrozenColumn
Expand Down Expand Up @@ -64,7 +64,7 @@
</ng-template>

<ng-template #actionColumnHeader>
<ng-container *ngIf="viewTableRowObserved || editTableRowObserved || deleteTableRowObserved">
<ng-container *ngIf="anyRowActionObserved">
<th
pFrozenColumn
[frozen]="frozenActionColumn"
Expand Down Expand Up @@ -183,7 +183,7 @@
</ng-template>
<ng-template pTemplate="emptymessage">
<tr>
<td colspan="8">{{ emptyResultsMessage || ("OCX_DATA_TABLE.EMPTY_RESULT" | translate) }}</td>
<td [colSpan]="columns.length + ((anyRowActionObserved) ? 1 : 0)">{{ emptyResultsMessage || ("OCX_DATA_TABLE.EMPTY_RESULT" | translate) }}</td>
</tr>
</ng-template>
</p-table>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { Component, ContentChild, EventEmitter, Inject, Injector, Input, LOCALE_ID, OnInit, Output, TemplateRef } from '@angular/core'
import {
Component,
ContentChild,
EventEmitter,
Inject,
Injector,
Input,
LOCALE_ID,
OnInit,
Output,
TemplateRef,
} from '@angular/core'
import { Router } from '@angular/router'
import { TranslateService } from '@ngx-translate/core'
import { SelectItem } from 'primeng/api'
Expand Down Expand Up @@ -91,7 +102,7 @@ export class DataTableComponent extends DataSortBase implements OnInit {
rows: '{rows}',
first: '{first}',
last: '{last}',
totalRecords: '{totalRecords}'
totalRecords: '{totalRecords}',
}

@Input() stringCellTemplate: TemplateRef<any> | undefined
Expand Down Expand Up @@ -133,7 +144,6 @@ export class DataTableComponent extends DataSortBase implements OnInit {
@Input() frozenActionColumn = false
@Input() actionColumnPosition: 'left' | 'right' = 'right'


@Output() filtered = new EventEmitter<Filter[]>()
@Output() sorted = new EventEmitter<Sort>()
@Output() viewTableRow = new EventEmitter<Row>()
Expand All @@ -160,13 +170,21 @@ export class DataTableComponent extends DataSortBase implements OnInit {
const dv = this.injector.get('DataViewComponent', null)
return dv?.deleteItemObserved || dv?.deleteItem.observed || this.deleteTableRow.observed
}
get anyRowActionObserved(): boolean {
return this.viewTableRowObserved || this.editTableRowObserved || this.deleteTableRowObserved
}

get selectionChangedObserved(): boolean {
const dv = this.injector.get('DataViewComponent', null)
return dv?.selectionChangedObserved || dv?.selectionChanged.observed || this.selectionChanged.observed
}

constructor(@Inject(LOCALE_ID) locale: string, translateService: TranslateService, private router: Router, private injector: Injector) {
constructor(
@Inject(LOCALE_ID) locale: string,
translateService: TranslateService,
private router: Router,
private injector: Injector
) {
super(locale, translateService)
this.name = this.name || this.router.url.replace(/[^A-Za-z0-9]/, '_')
}
Expand All @@ -176,7 +194,7 @@ export class DataTableComponent extends DataSortBase implements OnInit {
mergeMap((params) => this.translateItems(params, this.columns, this.clientSideFiltering, this.clientSideSorting)),
map((params) => this.filterItems(params, this.clientSideFiltering)),
map((params) => this.sortItems(params, this.columns, this.clientSideSorting)),
map(([rows]) => this.flattenItems(rows,))
map(([rows]) => this.flattenItems(rows))
)
this.currentSelectedFilters$ = combineLatest([this._filters$, this.currentFilterColumn$]).pipe(
map(([filters, currentFilterColumn]) => {
Expand Down Expand Up @@ -204,10 +222,10 @@ export class DataTableComponent extends DataSortBase implements OnInit {
.filter((value, index, self) => self.indexOf(value) === index && value != null)
.map(
(filterOption) =>
({
label: filterOption,
value: filterOption,
} as SelectItem)
({
label: filterOption,
value: filterOption,
} as SelectItem)
)
})
)
Expand Down
Loading