import { FormlyFieldConfig, FormlyFieldProps } from '@ngx-formly/core'; import { Observable } from 'rxjs'; import { FormlyTemplate } from './formly-template'; import { FloydFormlyConfigurationBuilder } from './floyd-formly-configuration'; import { ActionConfiguration } from '@ngx-floyd/core-ui'; import { AbstractControl } from '@angular/forms'; export type FloydFormlyFieldProps = FormlyFieldProps & { [additionalProperties: string]: any; }; export type FloydFormlyFieldConfig = FormlyFieldConfig; export type FloydFormlyExpressions = { [p: string]: string | Observable | ((field: FloydFormlyFieldConfig) => any); }; export declare function isFloydFormlyFieldConfig(obj: any): obj is FloydFormlyFieldConfig; export interface Validator { isValid: (control: AbstractControl) => boolean; message: (error: any, field: FormlyFieldConfig) => string; } export interface PropertyConfiguration { required(required?: boolean): this; readOnly(required?: boolean): this; templateOption(option: (o: FloydFormlyFieldProps) => void): this; expressionProperty(property: string, expression: ((model: T, formState: any, field?: FormlyFieldConfig) => any) | Observable): this; hideExpression(expression: boolean | string | ((model: T, formState: any, field?: FormlyFieldConfig) => boolean)): this; disable(disable: boolean | (() => boolean) | undefined): this; disableOnEmpty(fieldName: keyof T): this; hideOnEmpty(fieldName: keyof T): this; /** * Adds a function which should be executed when this property changes. * * @param {(initial: boolean) => void} onChangeFn Function which should be executed when change is triggered. * */ onChange(onChangeFn: (field: FormlyFieldConfig) => void): this; /** * Adds a function which should be executed when this property named in `fieldName` parameter changes. * * @param {keyof T} fieldName Name of the property whose changes is monitored. * @param {(initial: boolean) => void} changesOnFn Function which should be executed when change is triggered. * */ changesOn(fieldName: keyof T, changesOnFn: () => void): this; onInit(onChangeFn: (field: FormlyFieldConfig) => void): this; wrappers(wrappers: string[]): this; className(className: string): this; addAction(label: string, icon: string, action: ($event: any, data?: any) => void, config?: (c: ActionConfiguration) => ActionConfiguration): this; defaultValue(defaultValue: any): this; id(id: string): this; atIndex(index: number): this; label(label: string): this; if(ifFn: () => boolean, config: (c: this) => this): this; apply(configuration: (c: this) => this): this; addValidation(name: string, validator: Validator): this; } export declare class PropertyConfigurationBuilder implements PropertyConfiguration { readonly fieldName?: keyof T; fieldId?: string; index?: number; formlyTemplate?: FormlyTemplate; protected readonly config: FloydFormlyFieldConfig; protected parent: FloydFormlyConfigurationBuilder; protected changeFuncs: ((field: FloydFormlyFieldConfig) => void)[]; protected onInitFuncs: ((field: FloydFormlyFieldConfig) => any)[]; protected fieldGroupConfigurationBuilder?: FloydFormlyConfigurationBuilder; protected detailForm: boolean; constructor(fieldName?: keyof T, formlyTemplate?: FormlyTemplate, fieldId?: string); apply(configuration: (c: this) => this): this; protected get safeFieldName(): keyof T; get props(): FloydFormlyFieldProps; get expressions(): FloydFormlyExpressions; if(ifFn: () => boolean, config: (c: this) => this): this; id(id: string): this; atIndex(index: number): this; initialize(parent: FloydFormlyConfigurationBuilder): void; hasClassName(): boolean; initializeAsFormGroup(parent: FloydFormlyConfigurationBuilder, builder: FloydFormlyConfigurationBuilder): void; initializeAsDetailForm(builder: FloydFormlyConfigurationBuilder): void; expressionProperty(property: string, expression: ((model: T) => any) | Observable): this; required(required?: boolean): this; readOnly(readOnly?: boolean): this; template(template: string): this; getConfiguration(): FloydFormlyFieldConfig; label(label: string): this; hideExpression(expression: boolean | string | ((model: T, formState: any, field?: FormlyFieldConfig) => boolean)): this; disable(disable: boolean | (() => boolean) | undefined): this; templateOption(option: (o: FloydFormlyFieldProps) => void): this; disableOnEmpty(fieldName: keyof T): this; hideOnEmpty(fieldName: keyof T): this; onChange(onChangeFn: (field: FloydFormlyFieldConfig) => void): this; changesOn(fieldName: keyof T, changesOnFn: () => void): this; onInit(onInitFn: (field: FloydFormlyFieldConfig) => void): this; wrappers(wrappers?: string[]): this; className(className: string): this; fieldGroupClassName(className: string): this; addAction(label: string, icon: string, action: ($event: any, data?: any) => void, config?: (c: ActionConfiguration) => ActionConfiguration): this; defaultValue(defaultValue: any): this; protected isValueEmpty(value: any): boolean; addValidation(name: string, validator: Validator): this; }