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

feat(NovoDataTablePagination): Add option to show the total number of… #1648

Merged
merged 5 commits into from
Jan 31, 2025
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
Expand Up @@ -297,6 +297,7 @@ import { DataTableState } from './state/data-table-state.service';
[loading]="paginationOptions.loading"
[errorLoading]="paginationOptions.errorLoading"
[paginationRefreshSubject]="paginationRefreshSubject"
[showPaginationTotalRecordCount]="true"
>
</novo-data-table-pagination>
</footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,9 @@ $breakpoint: 1000px;
opacity: 1;
}
}
.novo-data-table-of-total-amount {
color: $slate;
font-size: 12px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ const MAX_PAGES_DISPLAYED = 5;
[attr.data-feature-id]="dataFeatureId"
>
</novo-select>
<div *ngIf="showPaginationTotalRecordCount && !loading && !errorLoading" class="novo-data-table-of-total-amount" data-automation-id="novo-data-table-of-total-amount">
{{ labels.ofXAmount(length) }}
</div>
<span class="spacer"></span>
<ul *ngIf="!loading && !errorLoading" class="pager" data-automation-id="pager">
<li class="page" (click)="selectPage(page - 1)" [ngClass]="{ disabled: page === 0 }">
Expand Down Expand Up @@ -150,6 +153,8 @@ export class NovoDataTablePagination<T> implements OnInit, OnDestroy {
public errorLoading: boolean = false;
@Input()
public paginationRefreshSubject = new Subject<void>();
@Input()
public showPaginationTotalRecordCount: boolean = false;

@Input()
get length(): number {
Expand Down
4 changes: 4 additions & 0 deletions projects/novo-elements/src/services/novo-label-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ export class NovoLabelService {
return `Showing ${shown} of ${total} Results.`;
}

ofXAmount(amount: number) {
return `of ${amount}`;
}

totalRecords(total: number, select = false) {
return select ? `Select all ${total} records.` : `De-select remaining ${total} records.`;
}
Expand Down
3 changes: 3 additions & 0 deletions projects/novo-examples/src/examples.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,9 @@ export class ButtonDevelopPage {
<h2>Loading</h2>
<p>Buttons can display a loading state when given the &quot;loading&quot; parameter. When loading is true the button will be disabled and get a loading spinner.</p>
<p><code-example example="button-loading"></code-example></p>
<h2>Two Icons</h2>
<p>A second icon can be specified, and it will take the opposite side of the primary icon.</p>
<p><code-example example="button-two-icon"></code-example></p>
`,
host: { class: 'markdown-page' }
})
Expand Down