import { WidgetContext } from './widget.context'; import { FormatDefinition } from 'ajv'; import { ValidatorFn } from '@angular/forms/src/directives/validators'; export declare abstract class WidgetRegistry { private widgets; private _formats; /** * Default widget to render when none are found */ protected defaultWidget: any; /** * Sets up the registry. */ constructor(); /** * Returns custom formats. */ readonly formats: { [type: string]: { format: FormatDefinition; }; }; /** * Returns true if widget for given type exists. * * @param type Widget type */ hasWidget(type: string): boolean; /** * Registers a new widget type. * * @param type Type * @param widget Widget component * @param context Widget context */ register>(type: string, widget: any, context: T): void; /** * Registers a new format for the schema validator. * * @param type Format type (date, myFormat) * @param format Format options and validation */ registerFormat>(type: string, format: FormatDefinition): void; /** * Gets a widget entry for give type. * * @param type Widget type */ getWidgetType(type: string): { widget: any; context: WidgetContext; }; /** * Returns list of supported widget types. */ getSupportedTyped(): Array; /** * Register widgets. */ protected abstract registerWidgets(): any; /** * Register formatters. */ protected abstract registerFormatters(): any; /** * Build validator array for given schema and arguments. * * @param schema Schema * @param parentSchema Parent schema * @param required True if field is required */ abstract getFormValidator(schema: any, parentSchema: any, required: boolean): ValidatorFn | ValidatorFn[]; /** * Parse a form error and return a human readable error. * * @param key Error key * @param controlName FormControl name * @param schema Schema affected * @param detail Error details */ abstract getValidatorError(key: string, controlName: string, schema: any, detail: any): string; }