import { EventEmitter, OnChanges, OnInit, SimpleChanges, TemplateRef } from '@angular/core'; import { EditableColumn, Section } from '../../interfaces/table-column'; import { HttpService } from '../../services/http.service'; import { NotificationService } from '../../services/notification.service'; import { FormGroup } from '@angular/forms'; import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { Observable } from 'rxjs'; import { FilterTableComponent } from '../filter-table/filter-table.component'; export declare class TableComponent implements OnInit, OnChanges { protected ngbModal: NgbModal; protected notificationService: NotificationService; protected httpService: HttpService; /** * the filter table component */ table: FilterTableComponent; /** * the columns of the data */ columns: EditableColumn[]; /** * the primary key for the table (to be used in update and delete) */ primaryKey: keyof T & string; /** * whether the user can create/update/delete or not */ readonly: boolean; /** * class to be used in the input div */ groupClass: string; /** * the API URL to be called when the user click on delete * if not provided then the delete button will be hidden */ deleteUrl: string; /** * the API URL to be called when the user submit create form * if not provided then the create button will be hidden */ insertUrl: string; /** * the API URL to be called when the user submit edit form * if not provided then the edit button will be hidden */ updateUrl: string; /** * the API URL to be called when the user open this table or edit/create/delete a row */ getUrl: string; /** * the edit/create modal title */ modalTitle: string; /** * if the table has multiple level of headers * note: columns will be overwritten by columns inside this section */ sections: Section[]; /** * if provided a select button to be shown within every row * upon click will navigate to ${value of selectRouterLink}/${value of primaryKey} * eg. if value of selectRouterLink is foo and value of primaryKey is siteId * on an item with {siteId: '123', ...} it will navigate to /foo/123 */ selectRouterLink: string; /** * emit value whenever the user submit edit form */ updated: EventEmitter; /** * emit value whenever the user submit create form */ inserted: EventEmitter; /** * emit value whenever the user delete a row */ deleted: EventEmitter; /** * this attribute emits values with same condition of filter event * it send the filtered data */ filteredData: Observable; /** * the edit/create formGroup */ formGroup: FormGroup; /** * the id of the edited row * to be set when the user open edit modal * to be used when the user submit edit form */ editId: string; /** * the data retrieved by calling the getURL */ data$: Observable; /** * edit/submit modal */ protected modal: NgbModalRef; constructor(ngbModal: NgbModal, notificationService: NotificationService, httpService: HttpService); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; /** * open form modal * triggered when the user click edit/create */ open(modal: TemplateRef, row?: T): void; /** * submit the form * triggered when the user click submit on edit/create form */ action(): Promise; /** * set the data observable to be used by yhe filter table */ getData(): void; /** * delete a row * triggered when the user click the delete button */ delete(row: T): Promise; }