@colijnit/corecomponents_v12 12.0.53 → 12.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5923,7 +5923,6 @@ InputDatePickerComponent.decorators = [
5923
5923
  [format]="dateFormat"
5924
5924
  [placeholder]="placeholder"
5925
5925
  [ngModel]="model"
5926
- [readonly]="readonly"
5927
5926
  (ngModelChange)="modelChange.emit($event)"
5928
5927
  ></ejs-datepicker>
5929
5928
  <div class="required-indicator"></div>
@@ -6009,13 +6008,12 @@ InputDateRangePickerComponent.decorators = [
6009
6008
  [format]="dateFormat"
6010
6009
  [placeholder]="placeholder"
6011
6010
  [ngModel]="model"
6012
- [(startDate)]="startDate"
6013
- [(endDate)]="endDate"
6014
- [readonly]="readonly"
6015
6011
  (ngModelChange)="rangeChange()"
6016
6012
  (close)="close.next($event)"
6017
6013
  (select)="select.next($event)"
6018
6014
  (cleared)="cleared.next($event)"
6015
+ [(startDate)]="startDate"
6016
+ [(endDate)]="endDate"
6019
6017
  ></ejs-daterangepicker>
6020
6018
  <div class="required-indicator"></div>
6021
6019
  <ng-template #validationError></ng-template>
@@ -9182,9 +9180,14 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9182
9180
  }
9183
9181
  this._detectChanges();
9184
9182
  }
9185
- pageChange(page) {
9183
+ goToPreviousPage() {
9184
+ this.currentPage -= 1;
9185
+ }
9186
+ goToNextPage() {
9187
+ this.currentPage += 1;
9188
+ }
9189
+ setCurrentPage(page) {
9186
9190
  this.currentPage = page;
9187
- //this.gridBody.nativeElement.scrollTop = 0;
9188
9191
  }
9189
9192
  _detectChanges() {
9190
9193
  this._changeDetection.detectChanges();
@@ -9269,7 +9272,15 @@ SimpleGridComponent.decorators = [
9269
9272
  </tr>
9270
9273
  </tbody>
9271
9274
  </table>
9272
- <co-pagination *ngIf="data?.length > rowsPerPage" [autoHide]="true" (pageChange)="pageChange($event)"></co-pagination>
9275
+ <co-pagination-bar *ngIf="data?.length > rowsPerPage"
9276
+ [itemsPerPage]="rowsPerPage"
9277
+ [currentPage]="currentPage"
9278
+ [totalItems]="data.length"
9279
+ [autoHide]="true"
9280
+ (previousClick)="goToPreviousPage()"
9281
+ (nextClick)="goToNextPage()"
9282
+ (pageClick)="setCurrentPage($event)"
9283
+ ></co-pagination-bar>
9273
9284
  `,
9274
9285
  providers: [
9275
9286
  FormMasterService
@@ -9301,6 +9312,7 @@ class PaginationBarComponent {
9301
9312
  this.itemsPerPage = 20;
9302
9313
  this.totalItems = 1;
9303
9314
  this.paginationRange = 8;
9315
+ this.autoHide = false;
9304
9316
  this.previousClick = new EventEmitter();
9305
9317
  this.nextClick = new EventEmitter();
9306
9318
  this.pageClick = new EventEmitter();
@@ -9314,9 +9326,7 @@ class PaginationBarComponent {
9314
9326
  this.pages = this._createPageArray();
9315
9327
  }
9316
9328
  ngOnChanges(changes) {
9317
- if (changes['currentPage'].currentValue !== changes['currentPage'].previousValue) {
9318
- this.pages = this._createPageArray();
9319
- }
9329
+ this.pages = this._createPageArray();
9320
9330
  }
9321
9331
  isOnFirstPage() {
9322
9332
  return this.currentPage === 1;
@@ -9325,15 +9335,27 @@ class PaginationBarComponent {
9325
9335
  return this.pages.length === this.currentPage;
9326
9336
  }
9327
9337
  onPreviousClick() {
9328
- this.previousClick.emit();
9338
+ if (!this.isOnFirstPage()) {
9339
+ this.previousClick.emit();
9340
+ }
9329
9341
  }
9330
9342
  onNextClick() {
9331
- this.nextClick.emit();
9343
+ if (!this.isOnLastPage()) {
9344
+ this.nextClick.emit();
9345
+ }
9332
9346
  }
9333
9347
  onPageClick(value) {
9334
9348
  this.currentPage = value;
9335
9349
  this.pageClick.emit(value);
9336
9350
  }
9351
+ shouldBeHidden() {
9352
+ if (!this.autoHide) {
9353
+ return false;
9354
+ }
9355
+ else {
9356
+ return (this.totalItems <= this.itemsPerPage);
9357
+ }
9358
+ }
9337
9359
  // Returns an array of IPage objects to use in the pagination controls.
9338
9360
  _createPageArray() {
9339
9361
  // paginationRange could be a string if passed from attribute, so cast to number.
@@ -9393,14 +9415,14 @@ PaginationBarComponent.decorators = [
9393
9415
  { type: Component, args: [{
9394
9416
  selector: "co-pagination-bar",
9395
9417
  template: `
9396
- <ul class="pagination">
9397
- <li *ngIf="directionLinks" class="pagination-previous">
9418
+ <ul class="pagination" *ngIf="!shouldBeHidden()">
9419
+ <li *ngIf="directionLinks" class="pagination-previous" [class.disabled]="isOnFirstPage()">
9398
9420
  <a (click)="onPreviousClick()" [class.disabled]="isOnFirstPage()">{{ previousLabel }}</a>
9399
9421
  </li>
9400
9422
  <li *ngFor="let page of pages" [class.current]="currentPage === page.value" (click)="onPageClick(page.value)">
9401
9423
  <span>{{page.label}}</span>
9402
9424
  </li>
9403
- <li *ngIf="directionLinks" class="pagination-next">
9425
+ <li *ngIf="directionLinks" class="pagination-next" [class.disabled]="isOnLastPage()">
9404
9426
  <a (click)="onNextClick()" [class.disabled]="isOnLastPage()">{{ nextLabel }}</a>
9405
9427
  </li>
9406
9428
  </ul>
@@ -9416,6 +9438,7 @@ PaginationBarComponent.propDecorators = {
9416
9438
  itemsPerPage: [{ type: Input }],
9417
9439
  totalItems: [{ type: Input }],
9418
9440
  paginationRange: [{ type: Input }],
9441
+ autoHide: [{ type: Input }],
9419
9442
  previousClick: [{ type: Output }],
9420
9443
  nextClick: [{ type: Output }],
9421
9444
  pageClick: [{ type: Output }],
@@ -9659,29 +9682,17 @@ class PaginationComponent {
9659
9682
  this.changeSub.unsubscribe();
9660
9683
  }
9661
9684
  goToFirstPage() {
9662
- if (!this.isOnFirstPage()) {
9663
- this.setCurrentPage(1);
9664
- }
9685
+ this.setCurrentPage(1);
9665
9686
  }
9666
9687
  goToPreviousPage() {
9667
- if (!this.isOnFirstPage()) {
9668
- this.setCurrentPage(this.getCurrentPage() - 1);
9669
- }
9688
+ this.setCurrentPage(this.getCurrentPage() - 1);
9670
9689
  }
9671
9690
  goToNextPage() {
9672
- if (!this.isOnLastPage()) {
9673
- this.setCurrentPage(this.getCurrentPage() + 1);
9674
- }
9691
+ this.setCurrentPage(this.getCurrentPage() + 1);
9675
9692
  }
9676
9693
  setCurrentPage(page) {
9677
9694
  this.pageChange.emit(page);
9678
9695
  }
9679
- isOnFirstPage() {
9680
- return this.getCurrentPage() === 1;
9681
- }
9682
- isOnLastPage() {
9683
- return this.getLastPage() === this.getCurrentPage();
9684
- }
9685
9696
  shouldBeHidden() {
9686
9697
  if (!this.autoHide) {
9687
9698
  return false;
@@ -9708,10 +9719,6 @@ class PaginationComponent {
9708
9719
  getCurrentPage() {
9709
9720
  return this._paginationService.getCurrentPage(this.id);
9710
9721
  }
9711
- getLastPage() {
9712
- let instance = this._paginationService.getInstance(this.id);
9713
- return Math.ceil(instance.totalItems / instance.itemsPerPage);
9714
- }
9715
9722
  /**
9716
9723
  * Checks that the instance.currentPage property is within bounds for the current page range.
9717
9724
  * If not, return a correct value for currentPage, or the current value if OK.
@@ -10048,7 +10055,8 @@ SimpleGridModule.decorators = [
10048
10055
  InputTextModule,
10049
10056
  FormModule,
10050
10057
  ObserveVisibilityModule,
10051
- PaginationModule
10058
+ PaginationModule,
10059
+ PaginationBarModule
10052
10060
  ],
10053
10061
  declarations: [
10054
10062
  SimpleGridComponent,