import { dia } from 'jointjs'; import { ValidatorFn, AsyncValidatorFn } from '@angular/forms'; import { Flo } from './flo-common'; import { Subject, Observable } from 'rxjs'; export declare namespace Properties { enum InputType { TEXT = 0, NUMBER = 1, SELECT = 2, CHECKBOX = 3, PASSWORD = 4, EMAIL = 5, URL = 6, CODE = 7 } interface Property { readonly id: string; readonly name: string; readonly type?: string; readonly description?: string; readonly defaultValue?: any; value?: any; readonly valueOptions?: any[]; readonly [propName: string]: any; } interface PropertyFilter { accept: (property: Property) => boolean; } interface SelectOption { name: string; value: any; } interface ErrorData { id: string; message: string; } interface Validation { validator?: ValidatorFn | ValidatorFn[] | null; asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null; errorData?: Array; } interface ControlModel { readonly type: InputType; readonly id: string; value: T; readonly defaultValue: T; readonly name?: string; readonly description?: string; readonly property: Property; readonly validation?: Validation; } interface CodeControlModel extends ControlModel { readonly language: string; } class GenericControlModel implements ControlModel { private _property; type: InputType; validation?: Validation; constructor(_property: Property, type: InputType, validation?: Validation); get id(): string; get name(): string; get description(): string; get defaultValue(): any; get value(): T; set value(value: T); get property(): Property; protected setValue(value: T): void; protected getValue(): T; } class CheckBoxControlModel extends GenericControlModel { constructor(_property: Property, validation?: Validation); protected getValue(): any; } abstract class AbstractCodeControlModel extends GenericControlModel implements CodeControlModel { private encode?; private decode?; abstract language: string; constructor(_property: Property, encode?: (s: string) => string, decode?: (s: string) => string, validation?: Validation); set value(value: string); get value(): string; } class GenericCodeControlModel extends AbstractCodeControlModel { language: string; constructor(_property: Property, language: string, encode?: (s: string) => string, decode?: (s: string) => string, validation?: Validation); } class CodeControlModelWithDynamicLanguageProperty extends AbstractCodeControlModel { private _languagePropertyName; private _groupModel; private _langControlModel; constructor(_property: Properties.Property, _languagePropertyName: string, _groupModel: Properties.PropertiesGroupModel, encode?: (s: string) => string, decode?: (s: string) => string, validation?: Validation); get language(): string; get languageControlModel(): Properties.ControlModel; } class GenericListControlModel extends GenericControlModel { constructor(property: Property, validation?: Validation); get value(): string; set value(value: string); } class SelectControlModel extends GenericControlModel { options: Array; constructor(_property: Property, type: InputType, options: Array, validation?: Validation); } interface PropertiesSource { getProperties(): Promise; applyChanges(properties: Property[]): void; } class DefaultCellPropertiesSource implements PropertiesSource { protected cell: dia.Cell; constructor(cell: dia.Cell); getProperties(): Promise>; protected createProperty(metadata: Flo.PropertyMetadata): Property; applyChanges(properties: Property[]): void; } class PropertiesGroupModel { protected propertiesSource: PropertiesSource; protected controlModels: Array>; protected loading: boolean; protected _loadedSubject: Subject; constructor(propertiesSource: PropertiesSource); load(): void; get isLoading(): boolean; get loadedSubject(): Subject; getControlsModels(): ControlModel[]; protected createControlModel(property: Property): ControlModel; applyChanges(): void; } namespace Validators { function uniqueResource(service: (value: any) => Observable, debounceDuration: number): AsyncValidatorFn; function noneOf(excluded: Array): ValidatorFn; } }