kitsng-table-factory 0.3.19 → 0.3.21

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.
@@ -109,6 +109,10 @@ class KitsngTableFactoryComponent {
109
109
  [rowHover]="tableConfig.rowHover ?? true"
110
110
  [resizableColumns]="tableConfig.resizableColumns ?? true"
111
111
  [scrollable]="tableConfig.scrollable ?? true"
112
+ [virtualRowHeight]="tableConfig.virtualRowHeight ?? 49"
113
+ [virtualScroll]="tableConfig.virtualScroll ?? false"
114
+ [virtualScrollItemSize]="tableConfig.virtualScrollItemSize || null"
115
+ [scrollHeight]="tableConfig.scrollHeight || '400px'"
112
116
  [rows]="tableConfig.pageSize"
113
117
  [first]="tableConfig.first"
114
118
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
@@ -188,10 +192,10 @@ class KitsngTableFactoryComponent {
188
192
  </ng-container>
189
193
  <ng-template #defaultButtonTemplate>
190
194
  <ng-container *ngIf="(resolveActionProperty(action.isVisible, item) !== false) && !resolveActionProperty(action.hidden, item)">
191
- <p-button
192
- [icon]="resolveActionProperty(action.icon, item)"
195
+ <p-button
196
+ [icon]="resolveActionProperty(action.icon, item)"
193
197
  [iconPos]="resolveActionProperty(action.iconPos, item) ?? 'left'"
194
- [label]="(resolveActionProperty(action.label, item)||'')|translate"
198
+ [label]="(resolveActionProperty(action.label, item)||'')|translate"
195
199
  [pTooltip]="resolveActionProperty(action.tooltip, item)"
196
200
  [tooltipPosition]="resolveActionProperty(action.tooltipPosition, item) ?? 'top'"
197
201
  [disabled]="resolveActionProperty(action.disabled, item)"
@@ -249,7 +253,18 @@ class KitsngTableFactoryComponent {
249
253
  </ng-template>
250
254
  </p-table>
251
255
  </ng-template>
252
- <p-paginator *ngIf="tableConfig.showPaginator ?? true" [styleClass]="tableConfig.paginatorClass ?? 'mt-3'" (onPageChange)="tableConfig.onPageChanged? tableConfig.onPageChanged($event) : false" [first]="tableConfig.first ?? 0" [rows]="tableConfig.pageSize ?? 0" [totalRecords]="tableConfig.totalRecords ?? 0" [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"></p-paginator>
256
+ <p-paginator *ngIf="tableConfig.showPaginator ?? true"
257
+ [styleClass]="tableConfig.paginatorClass ?? 'mt-3'"
258
+ (onPageChange)="tableConfig.onPageChanged? tableConfig.onPageChanged($event) : false"
259
+ [first]="tableConfig.first ?? 0"
260
+ [rows]="tableConfig.pageSize ?? 0"
261
+ [totalRecords]="tableConfig.totalRecords ?? 0"
262
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
263
+ [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
264
+ [currentPageReportTemplate]="
265
+ tableConfig.currentPageReportTemplate ??
266
+ 'Showing {first} to {last} of {totalRecords} entity'
267
+ "></p-paginator>
253
268
  </div>
254
269
  </div>
255
270
  `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i4.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i2$1.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i2$1.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "component", type: i2$1.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i2$1.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i2$1.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i5.Paginator, selector: "p-paginator", inputs: ["pageLinkSize", "style", "styleClass", "alwaysShow", "dropdownAppendTo", "templateLeft", "templateRight", "appendTo", "dropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showFirstLastIcon", "totalRecords", "rows", "rowsPerPageOptions", "showJumpToPageDropdown", "showJumpToPageInput", "jumpToPageItemTemplate", "showPageLinks", "locale", "dropdownItemTemplate", "first"], outputs: ["onPageChange"] }, { kind: "component", type: i6.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i7.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "pipe", type: i8.TranslatePipe, name: "translate" }, { kind: "pipe", type: DynamicPipe, name: "dynamicPipe" }] }); }
@@ -274,6 +289,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
274
289
  [rowHover]="tableConfig.rowHover ?? true"
275
290
  [resizableColumns]="tableConfig.resizableColumns ?? true"
276
291
  [scrollable]="tableConfig.scrollable ?? true"
292
+ [virtualRowHeight]="tableConfig.virtualRowHeight ?? 49"
293
+ [virtualScroll]="tableConfig.virtualScroll ?? false"
294
+ [virtualScrollItemSize]="tableConfig.virtualScrollItemSize || null"
295
+ [scrollHeight]="tableConfig.scrollHeight || '400px'"
277
296
  [rows]="tableConfig.pageSize"
278
297
  [first]="tableConfig.first"
279
298
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
@@ -353,10 +372,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
353
372
  </ng-container>
354
373
  <ng-template #defaultButtonTemplate>
355
374
  <ng-container *ngIf="(resolveActionProperty(action.isVisible, item) !== false) && !resolveActionProperty(action.hidden, item)">
356
- <p-button
357
- [icon]="resolveActionProperty(action.icon, item)"
375
+ <p-button
376
+ [icon]="resolveActionProperty(action.icon, item)"
358
377
  [iconPos]="resolveActionProperty(action.iconPos, item) ?? 'left'"
359
- [label]="(resolveActionProperty(action.label, item)||'')|translate"
378
+ [label]="(resolveActionProperty(action.label, item)||'')|translate"
360
379
  [pTooltip]="resolveActionProperty(action.tooltip, item)"
361
380
  [tooltipPosition]="resolveActionProperty(action.tooltipPosition, item) ?? 'top'"
362
381
  [disabled]="resolveActionProperty(action.disabled, item)"
@@ -414,7 +433,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
414
433
  </ng-template>
415
434
  </p-table>
416
435
  </ng-template>
417
- <p-paginator *ngIf="tableConfig.showPaginator ?? true" [styleClass]="tableConfig.paginatorClass ?? 'mt-3'" (onPageChange)="tableConfig.onPageChanged? tableConfig.onPageChanged($event) : false" [first]="tableConfig.first ?? 0" [rows]="tableConfig.pageSize ?? 0" [totalRecords]="tableConfig.totalRecords ?? 0" [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"></p-paginator>
436
+ <p-paginator *ngIf="tableConfig.showPaginator ?? true"
437
+ [styleClass]="tableConfig.paginatorClass ?? 'mt-3'"
438
+ (onPageChange)="tableConfig.onPageChanged? tableConfig.onPageChanged($event) : false"
439
+ [first]="tableConfig.first ?? 0"
440
+ [rows]="tableConfig.pageSize ?? 0"
441
+ [totalRecords]="tableConfig.totalRecords ?? 0"
442
+ [rowsPerPageOptions]="tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]"
443
+ [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
444
+ [currentPageReportTemplate]="
445
+ tableConfig.currentPageReportTemplate ??
446
+ 'Showing {first} to {last} of {totalRecords} entity'
447
+ "></p-paginator>
418
448
  </div>
419
449
  </div>
420
450
  ` }]
@@ -498,12 +528,16 @@ class ApiService {
498
528
  _initBaseUrl() {
499
529
  this.baseUrl = `${this.baseUri}/api/default/${this.module}/${this.entity}/${this.version}`;
500
530
  }
501
- getPaged(query) {
531
+ getPaged(query, dataMapper) {
502
532
  return this._httpClient
503
533
  .post(`${this.baseUrl}/${this.path}`, query)
504
534
  .pipe(map((response) => {
505
535
  console.log(response);
506
- return this.checkResponseStatus(response);
536
+ let result = this.checkResponseStatus(response);
537
+ if (dataMapper && result) {
538
+ result = dataMapper(response, result);
539
+ }
540
+ return result;
507
541
  }))
508
542
  .pipe(catchError((response) => {
509
543
  return throwError(response.error);
@@ -582,7 +616,7 @@ class KitsngFetchTableFactoryComponent {
582
616
  query = this.tableConfig.fetchApiInfo.queryMapper(query) || query;
583
617
  }
584
618
  this.apiService._initService(this.tableConfig.fetchApiInfo?.module || "", this.tableConfig.fetchApiInfo?.entity || "", this.tableConfig.fetchApiInfo?.version || "v1", this.tableConfig.fetchApiInfo?.baseUri || "", this.tableConfig.fetchApiInfo?.path || "page");
585
- this.apiService.getPaged(query)
619
+ this.apiService.getPaged(query, this.tableConfig?.fetchApiInfo?.dataMapper)
586
620
  .pipe(takeUntil(this.destroy$)).subscribe({
587
621
  next: (res) => {
588
622
  if (!res.pageInfo && res.page) {
@@ -672,6 +706,10 @@ class KitsngFetchTableFactoryComponent {
672
706
  [paginator]="false"
673
707
  [resizableColumns]="tableConfig.resizableColumns ?? true"
674
708
  [scrollable]="tableConfig.scrollable ?? true"
709
+ [virtualRowHeight]="tableConfig.virtualRowHeight ?? 49"
710
+ [virtualScroll]="tableConfig.virtualScroll ?? false"
711
+ [virtualScrollItemSize]="tableConfig.virtualScrollItemSize || null"
712
+ [scrollHeight]="tableConfig.scrollHeight || '400px'"
675
713
  [totalRecords]="tableConfig.totalRecords ?? 0"
676
714
  [tableStyle]="tableConfig.tableStyle ?? { 'min-width': '50rem' }"
677
715
  [currentPageReportTemplate]="
@@ -778,10 +816,10 @@ class KitsngFetchTableFactoryComponent {
778
816
  </ng-container>
779
817
  <ng-template #defaultButtonTemplate>
780
818
  <ng-container *ngIf="(resolveActionProperty(action.isVisible, item) !== false) && !resolveActionProperty(action.hidden, item)">
781
- <p-button
782
- [icon]="resolveActionProperty(action.icon, item)"
819
+ <p-button
820
+ [icon]="resolveActionProperty(action.icon, item)"
783
821
  [iconPos]="resolveActionProperty(action.iconPos, item) ?? 'left'"
784
- [label]="(resolveActionProperty(action.label, item)||'')|translate"
822
+ [label]="(resolveActionProperty(action.label, item)||'')|translate"
785
823
  [pTooltip]="resolveActionProperty(action.tooltip, item)"
786
824
  [tooltipPosition]="resolveActionProperty(action.tooltipPosition, item) ?? 'top'"
787
825
  [disabled]="resolveActionProperty(action.disabled, item)"
@@ -859,6 +897,11 @@ class KitsngFetchTableFactoryComponent {
859
897
  [rowsPerPageOptions]="
860
898
  tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
861
899
  "
900
+ [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
901
+ [currentPageReportTemplate]="
902
+ tableConfig.currentPageReportTemplate ??
903
+ 'Showing {first} to {last} of {totalRecords} entity'
904
+ "
862
905
  ></p-paginator>
863
906
  </div>
864
907
  </div>
@@ -895,6 +938,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
895
938
  [paginator]="false"
896
939
  [resizableColumns]="tableConfig.resizableColumns ?? true"
897
940
  [scrollable]="tableConfig.scrollable ?? true"
941
+ [virtualRowHeight]="tableConfig.virtualRowHeight ?? 49"
942
+ [virtualScroll]="tableConfig.virtualScroll ?? false"
943
+ [virtualScrollItemSize]="tableConfig.virtualScrollItemSize || null"
944
+ [scrollHeight]="tableConfig.scrollHeight || '400px'"
898
945
  [totalRecords]="tableConfig.totalRecords ?? 0"
899
946
  [tableStyle]="tableConfig.tableStyle ?? { 'min-width': '50rem' }"
900
947
  [currentPageReportTemplate]="
@@ -1001,10 +1048,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1001
1048
  </ng-container>
1002
1049
  <ng-template #defaultButtonTemplate>
1003
1050
  <ng-container *ngIf="(resolveActionProperty(action.isVisible, item) !== false) && !resolveActionProperty(action.hidden, item)">
1004
- <p-button
1005
- [icon]="resolveActionProperty(action.icon, item)"
1051
+ <p-button
1052
+ [icon]="resolveActionProperty(action.icon, item)"
1006
1053
  [iconPos]="resolveActionProperty(action.iconPos, item) ?? 'left'"
1007
- [label]="(resolveActionProperty(action.label, item)||'')|translate"
1054
+ [label]="(resolveActionProperty(action.label, item)||'')|translate"
1008
1055
  [pTooltip]="resolveActionProperty(action.tooltip, item)"
1009
1056
  [tooltipPosition]="resolveActionProperty(action.tooltipPosition, item) ?? 'top'"
1010
1057
  [disabled]="resolveActionProperty(action.disabled, item)"
@@ -1082,6 +1129,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1082
1129
  [rowsPerPageOptions]="
1083
1130
  tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
1084
1131
  "
1132
+ [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
1133
+ [currentPageReportTemplate]="
1134
+ tableConfig.currentPageReportTemplate ??
1135
+ 'Showing {first} to {last} of {totalRecords} entity'
1136
+ "
1085
1137
  ></p-paginator>
1086
1138
  </div>
1087
1139
  </div>
@@ -1268,6 +1320,10 @@ class KitsngTreeTableFactoryComponent {
1268
1320
  [paginator]="tableConfig.showClientPaginator ?? false"
1269
1321
  [customSort]="tableConfig.fetchApiInfo? true: false"
1270
1322
  [resizableColumns]="tableConfig.resizableColumns ?? false"
1323
+ [virtualRowHeight]="tableConfig.virtualRowHeight ?? 49"
1324
+ [virtualScroll]="tableConfig.virtualScroll ?? false"
1325
+ [virtualScrollItemSize]="tableConfig.virtualScrollItemSize || null"
1326
+ [scrollHeight]="tableConfig.scrollHeight || '400px'"
1271
1327
  [scrollable]="tableConfig.scrollable ?? false"
1272
1328
  [first]="tableConfig.first"
1273
1329
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
@@ -1365,10 +1421,10 @@ class KitsngTreeTableFactoryComponent {
1365
1421
  </ng-container>
1366
1422
  <ng-template #defaultButtonTemplate>
1367
1423
  <ng-container *ngIf="(resolveActionProperty(action.isVisible, rowData) !== false) && !resolveActionProperty(action.hidden, rowData)">
1368
- <p-button
1369
- [icon]="resolveActionProperty(action.icon, rowData)"
1424
+ <p-button
1425
+ [icon]="resolveActionProperty(action.icon, rowData)"
1370
1426
  [iconPos]="resolveActionProperty(action.iconPos, rowData) ?? 'left'"
1371
- [label]="(resolveActionProperty(action.label, rowData)||'')|translate"
1427
+ [label]="(resolveActionProperty(action.label, rowData)||'')|translate"
1372
1428
  [pTooltip]="resolveActionProperty(action.tooltip, rowData)"
1373
1429
  [tooltipPosition]="resolveActionProperty(action.tooltipPosition, rowData) ?? 'top'"
1374
1430
  [disabled]="resolveActionProperty(action.disabled, rowData)"
@@ -1445,6 +1501,11 @@ class KitsngTreeTableFactoryComponent {
1445
1501
  [rowsPerPageOptions]="
1446
1502
  tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
1447
1503
  "
1504
+ [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
1505
+ [currentPageReportTemplate]="
1506
+ tableConfig.currentPageReportTemplate ??
1507
+ 'Showing {first} to {last} of {totalRecords} entity'
1508
+ "
1448
1509
  ></p-paginator>
1449
1510
  </div>
1450
1511
  </div>
@@ -1475,6 +1536,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1475
1536
  [paginator]="tableConfig.showClientPaginator ?? false"
1476
1537
  [customSort]="tableConfig.fetchApiInfo? true: false"
1477
1538
  [resizableColumns]="tableConfig.resizableColumns ?? false"
1539
+ [virtualRowHeight]="tableConfig.virtualRowHeight ?? 49"
1540
+ [virtualScroll]="tableConfig.virtualScroll ?? false"
1541
+ [virtualScrollItemSize]="tableConfig.virtualScrollItemSize || null"
1542
+ [scrollHeight]="tableConfig.scrollHeight || '400px'"
1478
1543
  [scrollable]="tableConfig.scrollable ?? false"
1479
1544
  [first]="tableConfig.first"
1480
1545
  [showCurrentPageReport]="tableConfig.currentPageReportTemplate? true: false"
@@ -1572,10 +1637,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1572
1637
  </ng-container>
1573
1638
  <ng-template #defaultButtonTemplate>
1574
1639
  <ng-container *ngIf="(resolveActionProperty(action.isVisible, rowData) !== false) && !resolveActionProperty(action.hidden, rowData)">
1575
- <p-button
1576
- [icon]="resolveActionProperty(action.icon, rowData)"
1640
+ <p-button
1641
+ [icon]="resolveActionProperty(action.icon, rowData)"
1577
1642
  [iconPos]="resolveActionProperty(action.iconPos, rowData) ?? 'left'"
1578
- [label]="(resolveActionProperty(action.label, rowData)||'')|translate"
1643
+ [label]="(resolveActionProperty(action.label, rowData)||'')|translate"
1579
1644
  [pTooltip]="resolveActionProperty(action.tooltip, rowData)"
1580
1645
  [tooltipPosition]="resolveActionProperty(action.tooltipPosition, rowData) ?? 'top'"
1581
1646
  [disabled]="resolveActionProperty(action.disabled, rowData)"
@@ -1652,6 +1717,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1652
1717
  [rowsPerPageOptions]="
1653
1718
  tableConfig.rowsPerPageOptions ?? [5, 10, 25, 50, 100]
1654
1719
  "
1720
+ [showCurrentPageReport]="tableConfig.showCurrentPageReport || true"
1721
+ [currentPageReportTemplate]="
1722
+ tableConfig.currentPageReportTemplate ??
1723
+ 'Showing {first} to {last} of {totalRecords} entity'
1724
+ "
1655
1725
  ></p-paginator>
1656
1726
  </div>
1657
1727
  </div>