kitsng-table-factory 0.3.21 → 0.3.24

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.
@@ -116,7 +116,7 @@ class KitsngTableFactoryComponent {
116
116
  [rows]="tableConfig.pageSize"
117
117
  [first]="tableConfig.first"
118
118
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
119
- [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
119
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]"
120
120
  [paginator]="tableConfig.showClientPaginator ?? false"
121
121
  [totalRecords]="tableConfig.totalRecords ?? 0"
122
122
  [tableStyle]="tableConfig.tableStyle ?? {'min-width': '50rem'}"
@@ -259,7 +259,7 @@ class KitsngTableFactoryComponent {
259
259
  [first]="tableConfig.first ?? 0"
260
260
  [rows]="tableConfig.pageSize ?? 0"
261
261
  [totalRecords]="tableConfig.totalRecords ?? 0"
262
- [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
262
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]"
263
263
  [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
264
264
  [currentPageReportTemplate]="
265
265
  tableConfig.currentPageReportTemplate ??
@@ -296,7 +296,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
296
296
  [rows]="tableConfig.pageSize"
297
297
  [first]="tableConfig.first"
298
298
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
299
- [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
299
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]"
300
300
  [paginator]="tableConfig.showClientPaginator ?? false"
301
301
  [totalRecords]="tableConfig.totalRecords ?? 0"
302
302
  [tableStyle]="tableConfig.tableStyle ?? {'min-width': '50rem'}"
@@ -439,7 +439,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
439
439
  [first]="tableConfig.first ?? 0"
440
440
  [rows]="tableConfig.pageSize ?? 0"
441
441
  [totalRecords]="tableConfig.totalRecords ?? 0"
442
- [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
442
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]"
443
443
  [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
444
444
  [currentPageReportTemplate]="
445
445
  tableConfig.currentPageReportTemplate ??
@@ -577,7 +577,9 @@ class KitsngFetchTableFactoryComponent {
577
577
  }
578
578
  this.getData$ = this._getData.asObservable();
579
579
  this.subscribeToData();
580
- this._getData.next();
580
+ if (!this.tableConfig.fetchApiInfo?.preventInitialFetch) {
581
+ this._getData.next();
582
+ }
581
583
  }
582
584
  }
583
585
  getNestedValue(data, field) {
@@ -622,10 +624,18 @@ class KitsngFetchTableFactoryComponent {
622
624
  if (!res.pageInfo && res.page) {
623
625
  res.pageInfo = res.page;
624
626
  }
625
- this.tableConfig.totalRecords = res.pageInfo.totalItems;
627
+ if (!res.pageInfo && this.tableConfig.showPaginator !== true) {
628
+ this.tableConfig.showPaginator = false;
629
+ }
630
+ this.tableConfig.totalRecords = res.pageInfo?.totalItems ?? res.items?.length ?? 0;
626
631
  this.tableConfig.data = res.items ?? [];
627
632
  if (this.tableConfig.fetchApiInfo?.onDataLoaded) {
628
- this.tableConfig.fetchApiInfo.onDataLoaded(this.tableConfig.data, res.pageInfo);
633
+ this.tableConfig.fetchApiInfo.onDataLoaded(this.tableConfig.data, res.pageInfo ?? {
634
+ totalItems: this.tableConfig.totalRecords,
635
+ pageIndex: 1,
636
+ pageSize: this.tableConfig.totalRecords,
637
+ totalPages: 1
638
+ });
629
639
  }
630
640
  },
631
641
  error: (error) => {
@@ -701,7 +711,7 @@ class KitsngFetchTableFactoryComponent {
701
711
  tableConfig.currentPageReportTemplate ? true : false
702
712
  "
703
713
  [rowsPerPageOptions]="
704
- tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
714
+ tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]
705
715
  "
706
716
  [paginator]="false"
707
717
  [resizableColumns]="tableConfig.resizableColumns ?? true"
@@ -895,7 +905,7 @@ class KitsngFetchTableFactoryComponent {
895
905
  [rows]="tableConfig.pageSize ?? 0"
896
906
  [totalRecords]="tableConfig.totalRecords ?? 0"
897
907
  [rowsPerPageOptions]="
898
- tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
908
+ tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]
899
909
  "
900
910
  [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
901
911
  [currentPageReportTemplate]="
@@ -933,7 +943,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
933
943
  tableConfig.currentPageReportTemplate ? true : false
934
944
  "
935
945
  [rowsPerPageOptions]="
936
- tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
946
+ tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]
937
947
  "
938
948
  [paginator]="false"
939
949
  [resizableColumns]="tableConfig.resizableColumns ?? true"
@@ -1127,7 +1137,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1127
1137
  [rows]="tableConfig.pageSize ?? 0"
1128
1138
  [totalRecords]="tableConfig.totalRecords ?? 0"
1129
1139
  [rowsPerPageOptions]="
1130
- tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
1140
+ tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]
1131
1141
  "
1132
1142
  [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
1133
1143
  [currentPageReportTemplate]="
@@ -1328,7 +1338,7 @@ class KitsngTreeTableFactoryComponent {
1328
1338
  [first]="tableConfig.first"
1329
1339
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
1330
1340
  [lazy]="(tableConfig.fetchApiInfo? true : false) && (tableConfig.treeLazyLoad ?? true)"
1331
- [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
1341
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]"
1332
1342
  [totalRecords]="tableConfig.totalRecords ?? 0"
1333
1343
  [loading]="tableConfig.treeShowLoader && loading"
1334
1344
  (sortFunction)="customSort($event)"
@@ -1499,7 +1509,7 @@ class KitsngTreeTableFactoryComponent {
1499
1509
  [rows]="tableConfig.pageSize ?? 0"
1500
1510
  [totalRecords]="tableConfig.totalRecords ?? 0"
1501
1511
  [rowsPerPageOptions]="
1502
- tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
1512
+ tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]
1503
1513
  "
1504
1514
  [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
1505
1515
  [currentPageReportTemplate]="
@@ -1544,7 +1554,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1544
1554
  [first]="tableConfig.first"
1545
1555
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
1546
1556
  [lazy]="(tableConfig.fetchApiInfo? true : false) && (tableConfig.treeLazyLoad ?? true)"
1547
- [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
1557
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]"
1548
1558
  [totalRecords]="tableConfig.totalRecords ?? 0"
1549
1559
  [loading]="tableConfig.treeShowLoader && loading"
1550
1560
  (sortFunction)="customSort($event)"
@@ -1715,7 +1725,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1715
1725
  [rows]="tableConfig.pageSize ?? 0"
1716
1726
  [totalRecords]="tableConfig.totalRecords ?? 0"
1717
1727
  [rowsPerPageOptions]="
1718
- tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
1728
+ tableConfig.rowsPerPageOptions ?? [{showAll:'All'}, 500, 100, 50, 25, 10]
1719
1729
  "
1720
1730
  [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
1721
1731
  [currentPageReportTemplate]="