adb-shared 5.0.36 → 5.0.38

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.
@@ -429,27 +429,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
429
429
 
430
430
  class PagerBaseDirective {
431
431
  constructor() {
432
- this.limit = PagerBaseDirective.DEFAULT_LIMIT; //TODO: change to set method to update model
432
+ this.limit = PagerBaseDirective.DEFAULT_LIMIT;
433
433
  this.currentPage = 1;
434
434
  }
435
+ set setTotalCount(value) {
436
+ this.totalCount = value;
437
+ this.calculatePages();
438
+ }
439
+ set setLimit(value) {
440
+ this.limit = value ?? PagerBaseDirective.DEFAULT_LIMIT;
441
+ this.calculatePages();
442
+ }
435
443
  calculatePages() {
436
- this.amountOfPages = Math.ceil(this.totalCount / this.limit);
437
- if ((this.currentPage + 1) > PagerBaseDirective.VISIBLE_PAGES) {
438
- this.pages = [
439
- this.currentPage - 2,
440
- this.currentPage - 1, this.currentPage
441
- ];
442
- const above = this.amountOfPages - this.currentPage;
443
- if (above >= 1) {
444
- this.pages.push(this.currentPage + 1);
444
+ if (this.totalCount >= 0 && this.limit > 0) {
445
+ this.amountOfPages = Math.ceil(this.totalCount / this.limit);
446
+ if ((this.currentPage + 1) > PagerBaseDirective.VISIBLE_PAGES) {
447
+ this.pages = [
448
+ this.currentPage - 2,
449
+ this.currentPage - 1, this.currentPage
450
+ ];
451
+ const above = this.amountOfPages - this.currentPage;
452
+ if (above >= 1) {
453
+ this.pages.push(this.currentPage + 1);
454
+ }
455
+ if (above >= 2) {
456
+ this.pages.push(this.currentPage + 2);
457
+ }
445
458
  }
446
- if (above >= 2) {
447
- this.pages.push(this.currentPage + 2);
459
+ else if (this.totalCount) {
460
+ const max = this.amountOfPages > PagerBaseDirective.VISIBLE_PAGES ? 5 : this.amountOfPages;
461
+ this.pages = Array(Math.ceil(max)).fill(1).map((x, i) => i + 1);
448
462
  }
449
463
  }
450
- else if (this.totalCount) {
451
- const max = this.amountOfPages > PagerBaseDirective.VISIBLE_PAGES ? 5 : this.amountOfPages;
452
- this.pages = Array(Math.ceil(max)).fill(1).map((x, i) => i + 1);
464
+ else {
465
+ this.amountOfPages = 0;
453
466
  }
454
467
  }
455
468
  }
@@ -457,13 +470,15 @@ PagerBaseDirective.DEFAULT_LIMIT = 10;
457
470
  PagerBaseDirective.VISIBLE_PAGES = 5;
458
471
  PagerBaseDirective.SKIP_RESOURCE = 'offset';
459
472
  /** @nocollapse */ PagerBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagerBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
460
- /** @nocollapse */ PagerBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: PagerBaseDirective, inputs: { totalCount: "totalCount", limit: "limit" }, ngImport: i0 });
473
+ /** @nocollapse */ PagerBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: PagerBaseDirective, inputs: { setTotalCount: ["totalCount", "setTotalCount"], setLimit: ["limit", "setLimit"] }, ngImport: i0 });
461
474
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagerBaseDirective, decorators: [{
462
475
  type: Directive
463
- }], propDecorators: { totalCount: [{
464
- type: Input
465
- }], limit: [{
466
- type: Input
476
+ }], propDecorators: { setTotalCount: [{
477
+ type: Input,
478
+ args: ['totalCount']
479
+ }], setLimit: [{
480
+ type: Input,
481
+ args: ['limit']
467
482
  }] } });
468
483
 
469
484
  class PagerComponent extends PagerBaseDirective {