cat-qw-lib 0.24.6 → 0.24.8
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.
package/fesm2022/cat-qw-lib.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import * as i3$2 from 'primeng/checkbox';
|
|
|
23
23
|
import { CheckboxModule } from 'primeng/checkbox';
|
|
24
24
|
import { EntityStore, StoreConfig, QueryEntity } from '@datorama/akita';
|
|
25
25
|
import { __decorate } from 'tslib';
|
|
26
|
-
import { BehaviorSubject, firstValueFrom, of, tap as tap$1, map, catchError, Subscription } from 'rxjs';
|
|
26
|
+
import { BehaviorSubject, firstValueFrom, of, tap as tap$1, map, Subject, debounceTime, distinctUntilChanged, takeUntil, catchError, Subscription } from 'rxjs';
|
|
27
27
|
import { DragDropModule } from 'primeng/dragdrop';
|
|
28
28
|
import * as i4$2 from 'primeng/confirmdialog';
|
|
29
29
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
@@ -1608,7 +1608,8 @@ class TablePrimaryComponent {
|
|
|
1608
1608
|
globalFilter = SHARED.EMPTY;
|
|
1609
1609
|
page;
|
|
1610
1610
|
limit;
|
|
1611
|
-
|
|
1611
|
+
searchSubject$ = new Subject();
|
|
1612
|
+
destroy$ = new Subject();
|
|
1612
1613
|
constructor(_router, service, builder, baseStore) {
|
|
1613
1614
|
this._router = _router;
|
|
1614
1615
|
this.service = service;
|
|
@@ -1619,17 +1620,15 @@ class TablePrimaryComponent {
|
|
|
1619
1620
|
if (this.table.headers.length === 0) {
|
|
1620
1621
|
console.error('Table headers are missing.');
|
|
1621
1622
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
// ).subscribe(value => {
|
|
1627
|
-
// this.globalFilter = value;
|
|
1628
|
-
// this.fetchData(value);
|
|
1629
|
-
// });
|
|
1623
|
+
this.searchSubject$.pipe(debounceTime(300), distinctUntilChanged(), takeUntil(this.destroy$)).subscribe(value => {
|
|
1624
|
+
this.globalFilter = value;
|
|
1625
|
+
this.fetchData(value);
|
|
1626
|
+
});
|
|
1630
1627
|
}
|
|
1631
1628
|
onSearchChange(value) {
|
|
1632
|
-
|
|
1629
|
+
this.baseStore.searchSubject$.next(value);
|
|
1630
|
+
}
|
|
1631
|
+
fetchData(value) {
|
|
1633
1632
|
if (value === null)
|
|
1634
1633
|
return;
|
|
1635
1634
|
this.loading = true;
|
|
@@ -1637,6 +1636,9 @@ class TablePrimaryComponent {
|
|
|
1637
1636
|
if (this.dt2) {
|
|
1638
1637
|
this.dt2.first = 0;
|
|
1639
1638
|
}
|
|
1639
|
+
return this.fetchTableData();
|
|
1640
|
+
}
|
|
1641
|
+
fetchTableData() {
|
|
1640
1642
|
this.service.getPaginatedList(this.globalFilter, this.page, this.limit, this.pathName).subscribe({
|
|
1641
1643
|
next: (res) => {
|
|
1642
1644
|
this.table.records = res.data;
|
|
@@ -1649,15 +1651,6 @@ class TablePrimaryComponent {
|
|
|
1649
1651
|
}
|
|
1650
1652
|
});
|
|
1651
1653
|
}
|
|
1652
|
-
// fetchData(value: string) {
|
|
1653
|
-
// if(value === null) return;
|
|
1654
|
-
// this.loading = true;
|
|
1655
|
-
// this.page = 1;
|
|
1656
|
-
// if (this.dt2) {
|
|
1657
|
-
// this.dt2.first = 0;
|
|
1658
|
-
// }
|
|
1659
|
-
// return this.loadTableData();
|
|
1660
|
-
// }
|
|
1661
1654
|
clearSearch(table) {
|
|
1662
1655
|
this.globalFilter = SHARED.EMPTY;
|
|
1663
1656
|
table.clear();
|
|
@@ -1681,41 +1674,26 @@ class TablePrimaryComponent {
|
|
|
1681
1674
|
viewRow(rowData) {
|
|
1682
1675
|
console.log('Delete Row:', rowData);
|
|
1683
1676
|
}
|
|
1684
|
-
// private loadTableData() {
|
|
1685
|
-
// console.log(this.pathName);
|
|
1686
|
-
// this.service.getPaginatedList(this.globalFilter, this.page, this.limit, this.pathName).subscribe({
|
|
1687
|
-
// next: (res: any) => {
|
|
1688
|
-
// this.table.records = res.data;
|
|
1689
|
-
// this.metaData = res.metadata;
|
|
1690
|
-
// this.loading = false;
|
|
1691
|
-
// },
|
|
1692
|
-
// error: (err) => {
|
|
1693
|
-
// console.error(ERROR.ERROR_FETCHING_DATA, err);
|
|
1694
|
-
// this.loading = false;
|
|
1695
|
-
// }
|
|
1696
|
-
// });
|
|
1697
|
-
// }
|
|
1698
1677
|
handleLoadRecords(event) {
|
|
1699
1678
|
this.loading = true;
|
|
1700
1679
|
this.page = (event.first / event.rows) + 1;
|
|
1701
1680
|
this.limit = event.rows;
|
|
1702
|
-
this.
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
}
|
|
1713
|
-
//
|
|
1681
|
+
this.fetchTableData();
|
|
1682
|
+
// this.service.getPaginatedList(this.globalFilter, this.page, this.limit, this.pathName).subscribe({
|
|
1683
|
+
// next: (res: any) => {
|
|
1684
|
+
// this.table.records = res.data;
|
|
1685
|
+
// this.metaData = res.metadata;
|
|
1686
|
+
// this.loading = false;
|
|
1687
|
+
// },
|
|
1688
|
+
// error: (err) => {
|
|
1689
|
+
// console.error(ERROR.ERROR_FETCHING_DATA, err);
|
|
1690
|
+
// this.loading = false;
|
|
1691
|
+
// }
|
|
1692
|
+
// });
|
|
1714
1693
|
}
|
|
1715
1694
|
ngOnDestroy() {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
// }
|
|
1695
|
+
this.destroy$.next();
|
|
1696
|
+
this.destroy$.complete();
|
|
1719
1697
|
}
|
|
1720
1698
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TablePrimaryComponent, deps: [{ token: i3$3.Router }, { token: BaseService }, { token: TableBuilder }, { token: BaseStore }], target: i0.ɵɵFactoryTarget.Component });
|
|
1721
1699
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TablePrimaryComponent, isStandalone: true, selector: "lib-table-primary", inputs: { table: "table", metaData: "metaData", title: "title", showStatus: "showStatus", showActions: "showActions", showSearchBar: "showSearchBar", showNewRecordButton: "showNewRecordButton", showRefreshButton: "showRefreshButton", pathName: "pathName" }, viewQueries: [{ propertyName: "dt2", first: true, predicate: ["dt2"], descendants: true }], ngImport: i0, template: "<p-table #dt2 [lazy]=\"true\" \r\n [paginator]=\"metaData.totalItems > 10\"\r\n [rows]=\"metaData.itemsPerPage\"\r\n [totalRecords]=\"metaData.totalItems\"\r\n [rowsPerPageOptions]=\"[10, 20, 30, 40, 50]\"\r\n [loading]=\"loading\"\r\n (onPage)=\"handleLoadRecords($event)\"\r\n [columns]=\"table.headers\" class=\"table-primary-container\" [value]=\"table.records\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"table-header-wrapper flex align-items-center justify-content-between\">\r\n <h3 class=\"text-color table-title-wrapper text-color m-0\">{{title}}</h3>\r\n <div class=\"flex align-items-center justify-content-between w-full\">\r\n <div class=\"flex justify-content-end w-full\" *ngIf=\"showSearchBar\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"globalFilter\" (ngModelChange)=\"onSearchChange($event)\"\r\n [placeholder]=\"'Search ...'\" class=\"search-input-wrapper w-4\" />\r\n <p-button icon=\"pi pi-cog\" class=\"setting-icon-wrapper ml-3\"></p-button>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <!-- Header Template -->\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr *ngIf=\"table.headers.length > 0\">\r\n <th *ngFor=\"let col of table.headers\" class=\"p-4\" [pSortableColumn]=\"col.name\" [ngClass]=\"col.width ? col.width : 'w-full'\">\r\n <h4 class=\"flex align-items-center table-header-title capitalize text-color font-semibold m-0\">\r\n {{ col.name }}\r\n <p-sortIcon [field]=\"col.name\" />\r\n </h4>\r\n </th>\r\n <th *ngIf=\"showActions\" class=\"table-action-title p-4\" [ngClass]=\"table.headers[0]?.width ? 'w-2' : 'w-full'\">\r\n <h4 class=\"text-color font-semibold table-header-title capitalize m-0\">Actions</h4></th>\r\n </tr>\r\n </ng-template>\r\n\r\n <!-- Table Body -->\r\n <ng-template pTemplate=\"body\" let-rowData>\r\n <tr *ngIf=\"table.headers.length > 0\" class=\"table-row-wrapper relative table-group-wrapper\">\r\n <td class=\"text-left p-4\" *ngFor=\"let col of table.headers\">\r\n <div class=\"table-text-wrapper p-0\" \r\n [ngClass]=\"{\r\n 'enable-badge-wrapper': col.name.toLowerCase() === 'status' && rowData[col.name] === 'Enable',\r\n 'disable-badge-wrapper': col.name.toLowerCase() === 'status' && rowData[col.name] === 'Disable',\r\n 'w-8': col.name.toLowerCase() === 'status',\r\n 'text-primary font-semibold': col.name.toLowerCase() === 'action' || col.name.toLowerCase() === 'name'\r\n }\"\r\n >\r\n {{ rowData[col.name] }}\r\n <p *ngIf=\"col.name.toLowerCase() === 'action'\" class=\"text-color font-normal\">{{rowData['apiEndPoint']}}</p>\r\n </div>\r\n </td>\r\n\r\n <!-- Actions -->\r\n <td *ngIf=\"showActions\" class=\"action-data-wrapper text-left p-4\">\r\n <div class=\"flex align-items-center\">\r\n <p-button icon=\"pi pi-pencil\" (click)=\"handleEditClick(rowData._id)\" class=\"edit-icon-wrapper mr-3\"></p-button>\r\n <p-button icon=\"pi pi-trash\" (click)=\"deleteRow(rowData)\" class=\"delete-icon-wrapper mr-3\"></p-button>\r\n </div>\r\n </td>\r\n <!-- <p-button icon=\"pi pi-eye\" (click)=\"viewRow(rowData)\" class=\"view-icon-wrapper icon-position-wrapper table-group-wrapper-hover:visible\"></p-button> -->\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td [attr.colspan]=\"table.headers.length + (showActions ? 1 : 0)\" class=\"text-center text-color font-semibold p-4\">\r\n No records found\r\n </td>\r\n </tr>\r\n </ng-template>\r\n</p-table>", styles: [".table-header-container{padding:20px 20px 20px 8px}.table-header-title{font-size:14px}.table-text-wrapper{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;white-space:normal;max-width:100%;padding:.5rem;box-sizing:border-box}.table-title-wrapper{font-size:20px;font-weight:700}.table-action-title{border-radius:0 10px 0 0;border-right:1px solid rgba(68,72,109,.1)!important}.action-data-wrapper{border-right:1px solid rgba(68,72,109,.1)!important}.enable-badge-wrapper{border-radius:4px;background:var(--green-500);color:var(--surface-0);text-align:center;padding:5px!important}.disable-badge-wrapper{border-radius:4px;background:#44486d;color:var(--surface-0);text-align:center;padding:5px!important}.search-input-wrapper{height:50px;border-radius:10px;border:1px solid rgba(76,98,146,.1);background:#4c62920a}.table-row-wrapper{position:relative;transition:all .3s ease-in-out}.icon-position-wrapper{position:absolute;top:50%;left:16%;transform:translate(-50%,-50%);opacity:0;visibility:hidden;transition:opacity .3s ease-in-out,visibility .3s ease-in-out}.table-row-wrapper:hover .icon-position-wrapper{opacity:1;visibility:visible}.table-group-wrapper:hover .icon-position-wrapper{visibility:visible;opacity:1}::ng-deep .edit-icon-wrapper .p-button{border-radius:10px;border:1px solid rgba(76,98,146,.1);background:#eef0f5;padding:12px 20px}::ng-deep .edit-icon-wrapper .p-button .pi-pencil{color:var(--primary-color)}::ng-deep .delete-icon-wrapper .p-button{border-radius:10px;border:1px solid rgba(76,98,146,.1);background:#eef0f5;padding:12px 20px}::ng-deep .delete-icon-wrapper .p-button .pi-trash{color:var(--red-500)}::ng-deep .setting-icon-wrapper .p-button{border-radius:10px;border:1px solid rgba(76,98,146,.1);background:#eef0f5;padding:24px;height:50px}::ng-deep .setting-icon-wrapper .p-button .pi-cog{color:var(--primary-color)}::ng-deep .view-icon-wrapper .p-button{border-radius:10px;border:1px solid rgba(76,98,146,.3);background:var(--surface-0);padding:20px;height:40px;box-shadow:none}::ng-deep .view-icon-wrapper .p-button .pi-eye{color:#44486d}::ng-deep .table-primary-container .p-datatable-table{min-width:50rem;padding:20px;background-color:#fff;table-layout:fixed}::ng-deep .table-primary-container .p-datatable-header{padding:20px 20px 0;border-radius:10px 10px 0 0!important;border:none!important}::ng-deep .table-primary-container .p-datatable-thead th{border:1px solid rgba(68,72,109,.1);border-left:none;border-right:none;background:#f9f9fa}::ng-deep .table-primary-container .p-datatable-thead th:first-child{border-radius:10px 0 0;border-left:1px solid rgba(68,72,109,.1)}::ng-deep .table-primary-container tr td{border-bottom:1px solid rgba(68,72,109,.1)}::ng-deep .table-primary-container tr td:first-child{border-left:1px solid rgba(68,72,109,.1)}::ng-deep .table-primary-container tr:last-child td:first-child{border-radius:0 0 0 10px}::ng-deep .table-primary-container tr:last-child td:last-child{border-radius:0 0 10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6$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: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i6$1.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i6$1.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2$1.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: "ngmodule", type: ToggleButtonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputSwitchModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2$2.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "ngmodule", type: TooltipModule }] });
|