import { ElementRef, AfterViewInit, OnInit } from '@angular/core'; import { MatTableDataSource } from '@angular/material/table'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Options as SliderOptions } from '@angular-slider/ngx-slider'; import { NextObserver } from 'rxjs'; import { TranslateService } from '@ngx-translate/core'; import { SortOrder } from 'mel-common'; import { EntityService } from '../../services/core/entity.service'; import { DbPage } from './db-page'; import { ListComponent } from '../controls/mel-list/mel-list.component'; import { ListContext, PageTypes, RowUIChanged, SaveRequestEvent } from './types'; import { FieldMetadata } from '../../core/types'; import { AlertService } from '../../services/alert.service'; import { NgbModal as Modal } from '@ng-bootstrap/ng-bootstrap'; import { RowUI } from './rowUI'; import { Entity } from '../../models/entity'; import * as i0 from "@angular/core"; /** * The List-Component shows a list of an entity. * Derivied classes --> "ListPartComponent" of an unknown entity * --> "ListRoutedComponent" of a known entity * You can link this list to another entity, filter and sort it. * You can control the columns which are shown in the @column-decorator of the entity-definition * * Usage: With modify-permission you can click in a tablecell to edit this cell (if tablefield is editable) * with click outside the cell, you leave this cell and the cell change to viewmode * "Tab"-Key selects the next editable column in the row. At the end of the row, the first editable field * of the next row is selected or a new row ist inserted, if it was the last row. * "Shift-Tab"-Key selects the previous column in the row until the first editable column is selected * "Arrow-Down"-Key selects the same column in the row below, if exist (the row will be saved before) * "Arrow-Up"-Key selects the same column in the row above, if exist (the row will be saved before) * "Enter"-Key selects the first editable column in the next row and inserts a new row, if it was the last row * Menu "Save" saves the current row * Menu "New" saves the current row and adds a new row * Menu "Delete" removes the current row * * Initialisation: * The constructor is provided by an injector, the translateservice, a dialog and a snackbar which provides the Page-constructor * * Validation: After loading the datasource from database, the fields are not validated and we assume, that all fields are valid. * After a row was inserted and initalized, all fields are validated and the first invalid fieldindex is part of the status. * While editing a cell and leaving the edit mode of the cell, the value will be valiated and the list is to be notified about the result. * If the cell was valid * and the cell is the first invalid index in the status, the row becomes valid (for a short time) * after that, the next invalid column is searched and becomes the first invalid index of the status. if not found, the row stays valid * If the cell was invalid * a message is displayed in the field, * the row becomes invalid if it was valid. The smaller indexvalue is stored in the status * * * Saving: If the dataset is to be saved, the valid-status and the primary key is checked * * Errorhandling: If an (sql-)error occurs, the error is displayed and all other rows are blocked from editing until the user closes the errormessage */ export declare abstract class ListDbPage extends DbPage implements OnInit, AfterViewInit { constructor(entityService: EntityService, translate: TranslateService, modal: Modal, snackBar: MatSnackBar, alertService: AlertService); get pageType(): PageTypes; readonly rowHeight = 24; readonly showTickValuesThreshold: number; rowUIChangeObs: NextObserver>; dataSource: MatTableDataSource>; protected pageSize: number; sortOrder?: SortOrder; protected totalRecCount: number; currPageNo: number; get fieldMd(): FieldMetadata[]; set fieldMd(md: FieldMetadata[]); get title(): string; get listHeight(): string; get nothingSelected(): boolean; get hasInvalidRow(): boolean; listContext: ListContext; listComponent?: ListComponent; get assertListComponent(): ListComponent; protected get shouldSave(): boolean; /** * Get the fieldnames to display and their metadata * the fieldnames are listed in an array (displayColumns), which first element is the statusfield * the metadata are stored in a map (columnOptionsMap) and an array (columnOptions) correspondig with the displayColumns * The fieldcaptions an enumvalues are translated and stored the caption of the metadata */ ngOnInit(): void; ngAfterViewInit(): void; pageSliderRef?: ElementRef; get pageSliderElement(): HTMLDivElement | null; set pageCeil(ceil: number); sliderOptions: SliderOptions; onSliderChangeEnd(): void; /** * get the data from database */ protected retrieveData(): void; /** * Saves all dirty records * Implements the abstrct page-method to save the content of the list * @param event */ saveData(): void; /** * * Removes the selected rows * Implements the abstract page-method to remove content * @param event */ protected deleteData(): void; deleteSelected(rowIndicesToDelete: number[]): void; addDisplayedColumns(): void; refresh(): void; /** * Adds a new row below the first selected or at the end of the list * Called when menu.add was clicked or F3-pressed */ onNew(): void; protected addRowAt(rowIndex: number): void; private updateRecords; /** * tries to insert a record with the given rowIndex or row * we insert only, if the primary key is defined. the other validations are suppressed? * @param datasourceRow */ tryInsert(saveRequest: SaveRequestEvent): void; tryUpdate(saveRequest: SaveRequestEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, never, never, {}, {}, never>; }