Skip to content

Commit d2422d2

Browse files
authored
Merge pull request #132 from Gid733/master
Added missing shared module
2 parents 8ba7681 + 2df3b5c commit d2422d2

File tree

15 files changed

+294
-1
lines changed

15 files changed

+294
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,12 @@ eFormAPI/EformBase\.Pn/Plugins/EformBase/
367367

368368
eFormAPI/Plugins/Vehicles\.Pn/Vehicles/
369369

370-
eform-client/src/app/plugins/modules/
371370

372371
eFormAPI/Plugins/
373372
eFormAPI/eFormAPI/Areas/HelpPage/HelpPage.css
374373

375374
eFormAPI/eFormAPI/output/
376375
eFormAPI/eFormAPI/dataFolder/
376+
377+
eform-client/src/app/plugins/modules/customers-pn/
378+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './pagination-pn/pagination-pn.component';
2+
export * from './spinner-pn/spinner-pn.component';
3+
export * from './subheader-pn/subheader-pn.component';
4+
export * from './text-editor-pn/pell-pn.component';
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<div class="d-flex justify-content-center">
2+
<nav aria-label="pagination">
3+
<ul class="pagination pg-blue">
4+
5+
<li class="page-item" *ngIf="currentPage > 1">
6+
<a class="page-link" aria-label="Previous" (click)="selectPage(currentPage - 1)">
7+
<span aria-hidden="true">&laquo;</span>
8+
</a>
9+
</li>
10+
11+
<li class="page-item active" *ngFor="let page of pages | async"
12+
(click)="selectPage(page)"
13+
[ngClass]="{'active': currentPage === page}">
14+
<a class="page-link">{{page}} </a>
15+
</li>
16+
17+
<li class="page-item" *ngIf="currentPage != totalPages">
18+
<a class="page-link" (click)="selectPage(currentPage + 1)" aria-label="Next">
19+
<span aria-hidden="true">&raquo;</span>
20+
</a>
21+
</li>
22+
</ul>
23+
</nav>
24+
</div>

eform-client/src/app/plugins/modules/shared/components/pagination-pn/pagination-pn.component.scss

Whitespace-only changes.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import {Component, EventEmitter, Input, OnChanges, OnInit, Output} from '@angular/core';
2+
import {Observable, range} from 'rxjs';
3+
import {filter, map, toArray} from 'rxjs/operators';
4+
5+
@Component({
6+
selector: 'pagination-pn',
7+
templateUrl: './pagination-pn.component.html',
8+
styleUrls: ['./pagination-pn.component.scss']
9+
})
10+
export class PaginationPnComponent implements OnInit, OnChanges {
11+
@Output() onPageChanged: EventEmitter<number> = new EventEmitter<number>();
12+
@Input() offset = 0;
13+
@Input() limit = 1;
14+
@Input() size = 1;
15+
@Input() range = 3;
16+
currentPage: number;
17+
totalPages: number;
18+
pages: Observable<number[]>;
19+
20+
selectPage(page: number) {
21+
if (page === 0 || page > this.totalPages) {
22+
return;
23+
}
24+
if (this.isValidPageNumber(page, this.totalPages)) {
25+
this.onPageChanged.emit((page - 1) * this.limit);
26+
}
27+
}
28+
29+
getPages(offset: number, limit: number, size: number) {
30+
this.currentPage = this.getCurrentPage(offset, limit);
31+
this.totalPages = this.getTotalPages(limit, size);
32+
this.pages = range(-this.range, this.range * 2 + 1).pipe(
33+
map((offset) => this.currentPage + offset),
34+
filter(page => this.isValidPageNumber(page, this.totalPages)),
35+
toArray()
36+
);
37+
}
38+
39+
getCurrentPage(offset: number, limit: number): number {
40+
return Math.floor(offset / limit) + 1;
41+
}
42+
43+
isValidPageNumber(page: number, totalPages: number): boolean {
44+
return page > 0 && page <= totalPages;
45+
}
46+
47+
getTotalPages(limit: number, size: number): number {
48+
return Math.ceil(Math.max(size, 1) / Math.max(limit, 1));
49+
}
50+
51+
ngOnChanges() {
52+
this.getPages(this.offset, this.limit, this.size);
53+
}
54+
55+
ngOnInit() {
56+
this.getPages(this.offset, this.limit, this.size);
57+
}
58+
59+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="animated fadeIn spinner-container load1"
2+
id="spinner-animation"
3+
*ngIf="spinnerVisibility"
4+
>
5+
<div class="loader">{{'Loading' | translate}}...</div>
6+
</div>

eform-client/src/app/plugins/modules/shared/components/spinner-pn/spinner-pn.component.scss

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {Component, Input, OnInit} from '@angular/core';
2+
3+
@Component({
4+
selector: 'spinner-pn',
5+
templateUrl: './spinner-pn.component.html',
6+
styleUrls: ['./spinner-pn.component.scss']
7+
})
8+
export class SpinnerPnComponent implements OnInit {
9+
@Input() spinnerVisibility = false;
10+
constructor() { }
11+
12+
ngOnInit() {
13+
}
14+
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class="d-flex heading-bg">
2+
<div class="mr-auto p-3">
3+
<h1 #heading>
4+
{{title}}
5+
<small *ngIf="subtitle" style="font-size: 1rem">({{subtitle}})</small>
6+
</h1>
7+
</div>
8+
<ng-content></ng-content>
9+
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.heading-bg {
2+
background-color: #F1F1F1;
3+
}

0 commit comments

Comments
 (0)