import React from 'react'; import * as yup from 'yup'; type TextFieldProps = { onChange?: (key: string, value: any) => void; onBlur?: (key: string) => void; fieldDetail: any; isSchema?: boolean; }; declare const Text: (props: TextFieldProps) => React.JSX.Element; type CheckboxFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Checkbox: (props: CheckboxFieldProps) => React.JSX.Element; type EmailFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Email: (props: EmailFieldProps) => React.JSX.Element; type NumberFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Number: (props: NumberFieldProps) => React.JSX.Element; type RadioFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Radio: (props: RadioFieldProps) => React.JSX.Element; type TextareaFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Textarea: (props: TextareaFieldProps) => React.JSX.Element; type ToggleFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Toggle: { (props: ToggleFieldProps): React.JSX.Element; defaultProps: { optionLabels: string[]; }; }; declare enum FieldType { TextField = "TextField", TextareaField = "TextareaField", NumberField = "NumberField", EmailField = "EmailField", UrlField = "UrlField", RadioField = "RadioField", CheckboxField = "CheckboxField", ToggleField = "ToggleField", SelectField = "SelectField", FileField = "FileField", TableInput = "TableInput", DateField = "DateField", CompositeField = "CompositeField", MultiValuedField = "MultiValuedField", CountryStateCity = "CountryStateCity", Checklist = "Checklist", Typeahead = "Typeahead", FieldButton = "FieldButton" } declare enum DataType { String = "string", Numerical = "number", Date = "Date", Object = "Object", Array = "Array" } declare class Field { id: string; dataType: DataType; fieldType: FieldType; attributes: any; fieldValidation?: yup.AnySchema; value: any; key: string; valid: boolean; error: string; label: string; onFieldValueChange: (value: any) => {} | undefined; multiValued: boolean; section?: string; displayAccessor?: string; valueAccessor?: string; optionObjectAsValue?: boolean; constructor(field: any, key: string); getValue(): any; setValue(value: any): void; validate(): string | null; } type UrlFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: Field; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Url: (props: UrlFieldProps) => React.JSX.Element; type SelectFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Select$1: (props: SelectFieldProps) => React.JSX.Element; type FileFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; onRemove?: () => any; shouldDelete?: any; }; declare const File: (props: FileFieldProps) => React.JSX.Element; type FormMetaData = { title: string; autoSequencing?: boolean; }; declare class MultiValuedFieldDef { field: any; key: string; value: any; section?: string; showDeleteBtn?: boolean; showEditBtn?: boolean; onItemDelete?: (value: any) => boolean; onItemDeleteAsync?: (value: any) => Promise; constructor(field: any, key: string); setValue(value: any): void; validate(): string | null; } declare class FieldButtonFieldDef { key: string; value: any; section?: string; showBtn?: boolean; btnText: string; attributes: any; onClickHandler: (cb: Function) => void; constructor(field: any, key: string); setValue(value: any): void; validate(): string | null; } declare class FormSchema { fields: { [key: string]: any; }; sections: { [key: string]: any; }; validationSchema: yup.AnySchema | undefined; formMetaData: FormMetaData; values: { [key: string]: any; }; erros: { [key: string]: any; }; valid: boolean; constructor(sections: any, fields: any, formMetaData?: FormMetaData, validationSchema?: yup.AnySchema); mapFields(fields: any, section?: string): { validationArray: any; sectionFields: any; }; mapSections(sections: any): any; createField(value: any, key: string): Field | MultiValuedFieldDef | FieldButtonFieldDef; onFieldValueChange(field: string, value: any): void; private _validateBasedOnValidationSchema; getLevel1Fields(): any[]; getLevel1Sections(): any[]; validateAllField(): void; /** * validateField */ validateField(fieldName: string): void; /** * * @param field {Field} */ _addField(fields: any, totalNewField: number, sectionKey?: string, options?: { addAfter?: string; }): FormSchema; removeField(fieldKey: string, sectionKey?: string): void; _addSections(sections: any): FormSchema; } /** * @class JsonSchemaParser * @description Prase the json schema, validates it and create `FormSchema`, which can be access with method `getForm` * */ declare class JsonSchemaParser { private _schema; private _compiledFormSchema; private _validationSchema?; constructor(schema: Record, validationSchema?: yup.AnySchema); private _validateSchema; /** * * @param newFields {Field[]} */ addField(newFields: any[], sectionKey?: string, options?: { addAfter?: string; }): void; removeField(fieldKey: string, sectionKey?: string): void; addSections(newSections: any[]): void; private _validateFieldSchema; _validateSectionSchema(sections: any): boolean; private _checkProps; getCompiledSchema(): FormSchema; getForm(): FormSchema; private _generateValidationSchema; } declare const AddressService: { getCountryByCode: (isoCode: string) => any; getAllCountries: () => ({ name: string; isoCode: string; flag: string; phonecode: string; currency: string; latitude: string; longitude: string; timezones: { zoneName: string; gmtOffset: number; gmtOffsetName: string; abbreviation: string; tzName: string; }[]; numeric_code?: undefined; } | { name: string; isoCode: string; flag: string; numeric_code: string; phonecode: string; currency: string; timezones: { zoneName: string; gmtOffset: number; gmtOffsetName: string; abbreviation: string; tzName: string; }[]; latitude: string; longitude: string; })[]; getStateByCode: (countryCode: string, stateCode: string) => any; getStatesOfCountry: (countryCode: string | undefined) => { name: string; isoCode: string; countryCode: string; latitude: string; longitude: string; }[]; getCitiesOfState: (countryCode: string, stateCode: string) => any; }; type BaseFormProps = { schema?: JsonSchemaParser; onSubmit: (form: FormSchema) => void; onSave?: (form: FormSchema) => void; children: any; }; type BaseFormState = { changed: boolean; formSchema?: FormSchema; submitted: boolean; submitting: boolean; saving: boolean; lastSaved?: Date; }; declare class BaseForm extends React.Component { constructor(props: BaseFormProps); componentDidMount(): void; onSave(): Promise; onSubmit(e: any): Promise; onChanges(key: string, value: any, error?: string): void; onFieldBlur(key: string, error?: string): void; setField(key: string, field: Field): void; renderSaveButton(): React.JSX.Element | null; render(): React.ReactNode; } type DateFieldProps = { onChange?: (key: string, value: any) => void; onBlur?: (key: string) => void; fieldDetail: any; isSchema?: boolean; }; declare const _default: { new (props: any): { isRequiredValidator: (value: any) => void; render(): React.ReactNode; context: unknown; setState(state: { isValid: boolean; } | ((prevState: Readonly<{ isValid: boolean; }>, props: Readonly) => { isValid: boolean; } | Pick<{ isValid: boolean; }, K> | null) | Pick<{ isValid: boolean; }, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly; state: Readonly<{ isValid: boolean; }>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly, nextState: Readonly<{ isValid: boolean; }>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly, prevState: Readonly<{ isValid: boolean; }>): any; componentDidUpdate?(prevProps: Readonly, prevState: Readonly<{ isValid: boolean; }>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void; componentWillUpdate?(nextProps: Readonly, nextState: Readonly<{ isValid: boolean; }>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly, nextState: Readonly<{ isValid: boolean; }>, nextContext: any): void; }; contextType?: React.Context | undefined; }; type CountryStateCityFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const CountryStateCity: (props: CountryStateCityFieldProps) => React.JSX.Element; type ChecklistFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Checklist: (props: ChecklistFieldProps) => React.JSX.Element; type TypeaheadFieldProps = { onChange?: (key: string, value: any) => void; fieldDetail: any; onBlur?: (key: string) => void; isSchema?: boolean; }; declare const Select: (props: TypeaheadFieldProps) => React.JSX.Element; type ButtonFieldProps = { key: string; fieldDetail: FieldButtonFieldDef; onChange: (key: string, value: any) => void; }; declare const FieldButton: (props: ButtonFieldProps) => React.JSX.Element; export { AddressService, BaseForm, BaseFormProps, ButtonFieldProps, Checkbox, CheckboxFieldProps, Checklist, ChecklistFieldProps, CountryStateCity, CountryStateCityFieldProps, _default as Date, DateFieldProps, Email, EmailFieldProps, FieldButton, File, FileFieldProps, JsonSchemaParser, Number, NumberFieldProps, Radio, RadioFieldProps, Select$1 as Select, SelectFieldProps, Text, TextFieldProps, Textarea, TextareaFieldProps, Toggle, ToggleFieldProps, Select as Typeahead, TypeaheadFieldProps, Url, UrlFieldProps };