UNPKG

@data-cafe/datagrid

Version:

A very generic datagrid component for data-café applications

70 lines (69 loc) 2.26 kB
import { ElementRef, EventEmitter, OnInit, Renderer2 } from '@angular/core'; import { FormControl, ValidatorFn } from '@angular/forms'; import * as i0 from "@angular/core"; export interface Result<T> { previous: T | null; current: T | null; } export declare class CellEditableComponent<T> implements OnInit { readonly renderer: Renderer2; readonly element: ElementRef; readonly ICON: { VALID: string; CANCEL: string; }; /** * Main item to edit. * It could be null, meaning no value. * The `undefined` value is not allowed here; please use `null` instead. */ item: T | null; /** * Fallback label used when item is null or falsy, or the property is missing. * * This is optional. */ fallbackLabel?: string; /** * This list is a range of allowed values. * It displays a select element instead of a simple input. * * This is optional. */ altValues?: Array<T>; /** * Converter method. * * This is optional only if: * - the item is a string * - the item contains a property `label`, `name` or `title` */ itemToLabel?: (t: T) => string; /** * Allow edition */ enable: boolean; /** * Specify some extra validators */ validators: Array<ValidatorFn>; /** * call on save: * - button validate * - enter key */ save: EventEmitter<Result<T>>; /** * Dispatch a event indicating whenever this component is in edition mode. */ editing$: EventEmitter<boolean>; formControl: FormControl; constructor(renderer: Renderer2, element: ElementRef); ngOnInit(): void; getLabel(value: T | null): string | undefined; onEditableChange(mode: 'view' | 'edit'): void; trim(value: T | null): T | null; onEdit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<CellEditableComponent<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<CellEditableComponent<any>, "dt-cell-editable", never, { "item": "item"; "fallbackLabel": "fallbackLabel"; "altValues": "altValues"; "itemToLabel": "itemToLabel"; "enable": "enable"; "validators": "validators"; }, { "save": "save"; "editing$": "editing$"; }, never, never>; }