|
|
|
@@ -32,6 +32,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { |
|
|
|
@Input() public dataFormComponentData?: any; |
|
|
|
@Input() public searchable: boolean; |
|
|
|
@Input() public showDetailButton: boolean; |
|
|
|
@Input() public showEditButton: boolean; |
|
|
|
@Input() public showPosition: boolean; |
|
|
|
@Input() public showFilterBar: boolean; |
|
|
|
@Input() public listColDefinitions!: ListColDefinition[]; |
|
|
|
@@ -83,8 +84,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { |
|
|
|
private router: Router, |
|
|
|
) { |
|
|
|
this.searchable = true; |
|
|
|
this.showDetailButton = true; |
|
|
|
this.showPosition = true; |
|
|
|
this.showDetailButton = true; |
|
|
|
this.showEditButton = true; |
|
|
|
this.showFilterBar = true; |
|
|
|
this.filterExists = false; |
|
|
|
this.filterObj = {}; |
|
|
|
@@ -93,6 +95,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { |
|
|
|
this.dataSource = new MatTableDataSource<any>(); |
|
|
|
this.filterConfig = null; |
|
|
|
this.detailLinkNewTab = false; |
|
|
|
this.dataFormComponentData = {}; |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
@@ -100,6 +103,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { |
|
|
|
if (this.showPosition) { |
|
|
|
this.listColDefinitions.unshift(ListComponent.getDefaultColPosition()); |
|
|
|
} |
|
|
|
if (this.showEditButton) { |
|
|
|
this.listColDefinitions.unshift(ListComponent.getDefaultColEditBtn()); |
|
|
|
} |
|
|
|
if (this.showDetailButton) { |
|
|
|
const url = this.getCustomDetailLinkFunction !== undefined ? '' : this.router.routerState.snapshot.url; |
|
|
|
this.listColDefinitions.unshift(ListComponent.getDefaultColDetailBtnLink(url)); |
|
|
|
@@ -299,7 +305,6 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { |
|
|
|
return "/assets/images/icons/dummy-person.png" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getColCssClass(column: ListColDefinition): string { |
|
|
|
switch (column.type) { |
|
|
|
case ListComponent.COLUMN_TYPE_DETAIL: |
|
|
|
@@ -338,6 +343,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { |
|
|
|
} as ListColDefinition; |
|
|
|
} |
|
|
|
|
|
|
|
public static getDefaultColEditBtn(): ListColDefinition { |
|
|
|
return { |
|
|
|
name: 'edit', |
|
|
|
text: '', |
|
|
|
type: ListComponent.COLUMN_TYPE_BTN_EDIT |
|
|
|
} as ListColDefinition; |
|
|
|
} |
|
|
|
|
|
|
|
public static getDefaultColPosition(): ListColDefinition { |
|
|
|
return { |
|
|
|
name: 'pos', |
|
|
|
@@ -398,6 +411,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public onEditData(element: any) { |
|
|
|
this.dataFormComponentData.data = element; |
|
|
|
this.appHelperService.openModal( |
|
|
|
this.dataFormComponent, |
|
|
|
this.dataFormComponentData, |
|
|
|
this.getData |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public getFilterJsonString(): any { |
|
|
|
return JSON.stringify(this.filterObj); |
|
|
|
} |
|
|
|
|