Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 47f30d8

Browse files
author
Sebastian Superczynski
committed
added option to hide pagination range
1 parent 87cd833 commit 47f30d8

File tree

7 files changed

+18
-9
lines changed

7 files changed

+18
-9
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-easy-table",
3-
"version": "2.1.4",
3+
"version": "2.2.0",
44
"description": "Angular easy table",
55
"typings": "index.ts",
66
"repository": "https://github.com/ssuperczynski/ngx-easy-table.git",

src/app/app.service.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class ConfigService {
1919
serverPagination: false,
2020
isLoading: false,
2121
detailsTemplate: false,
22-
groupRows: false
22+
groupRows: false,
23+
paginationRangeEnabled: false,
2324
};
2425
}

src/app/ngx-easy-table/components/pagination/pagination.component.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {
2-
ChangeDetectionStrategy, Component, EventEmitter, Input, Output
2+
ChangeDetectionStrategy, Component, EventEmitter, Input, Output, OnInit
33
} from '@angular/core';
44
import { ConfigService } from '../../services/config-service';
5+
import { Config } from '../../model/config';
56

67
@Component({
78
selector: 'pagination',
@@ -10,13 +11,14 @@ import { ConfigService } from '../../services/config-service';
1011
changeDetection: ChangeDetectionStrategy.OnPush
1112
})
1213

13-
export class PaginationComponent {
14+
export class PaginationComponent implements OnInit {
1415
@Input() pagination;
1516
@Input() id;
1617
@Output() updateRange = new EventEmitter();
17-
ranges = [5, 10, 25, 50, 100];
18-
limit = ConfigService.config.rows;
19-
showRange = false;
18+
public config: Config;
19+
public ranges = [5, 10, 25, 50, 100];
20+
public limit = ConfigService.config.rows;
21+
public showRange = false;
2022

2123
onPageChange($event) {
2224
this.updateRange.emit({
@@ -33,4 +35,8 @@ export class PaginationComponent {
3335
limit: limit
3436
});
3537
}
38+
39+
ngOnInit() {
40+
this.config = ConfigService.config;
41+
}
3642
}

src/app/ngx-easy-table/components/pagination/pagination.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
(pageChange)="onPageChange($event)">
99
</pagination-controls>
1010
</div>
11-
<div class="pagination-mobile">
11+
<div class="pagination-mobile" *ngIf="config.paginationRangeEnabled">
1212
<div class="ngx-dropdown ngx-range-dropdown ngx-float-right"
1313
[class.ngx-active]="showRange"
1414
id="rowAmount">

src/app/ngx-easy-table/model/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export interface Config {
1515
isLoading: boolean;
1616
detailsTemplate: boolean;
1717
groupRows: boolean;
18+
paginationRangeEnabled: boolean;
1819
}

src/app/ngx-easy-table/services/config-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ export class ConfigService {
2020
isLoading: true,
2121
detailsTemplate: false,
2222
groupRows: false,
23+
paginationRangeEnabled: true,
2324
};
2425
}

0 commit comments

Comments
 (0)