@timmons-group/config-form
Version:
React Components and helpers to build a form via configuration with react-hook-form and MUI
21 lines (20 loc) • 1.81 kB
TypeScript
import { VALIDATIONS, CONDITIONAL_RENDER } from '../constants';
import { FieldIntTypes, LegacyLayoutField } from '../models';
import { Conditional } from '../models/formFields.model';
type ValidationKeys = keyof typeof VALIDATIONS;
type ValidationValues = typeof VALIDATIONS[ValidationKeys];
type RenderKeys = keyof typeof CONDITIONAL_RENDER;
type RenderValues = typeof CONDITIONAL_RENDER[RenderKeys];
type FormFieldPropertyValues = ValidationValues | RenderValues;
type FormFieldLayoutPropertyMap = {
[key in FormFieldPropertyValues]?: any;
};
export type AdditionalLayoutFieldOptions = Partial<LegacyLayoutField | FormFieldLayoutPropertyMap>;
export declare const createTextModel: (name: string, label: string, required?: boolean, otherThings?: AdditionalLayoutFieldOptions, dataThings?: {}) => LegacyLayoutField;
export declare const createLongTextModel: (name: string, label: string, required?: boolean, otherThings?: AdditionalLayoutFieldOptions, dataThings?: {}) => LegacyLayoutField;
export declare const createCurrencyModel: (name: string, label: string, required?: boolean, otherThings?: AdditionalLayoutFieldOptions) => LegacyLayoutField;
export declare const createPositiveCountModel: (name: string, label: string, required?: boolean, otherThings?: AdditionalLayoutFieldOptions) => LegacyLayoutField;
export declare const createAcresModel: (name: string, label: string, required?: boolean, otherThings?: AdditionalLayoutFieldOptions) => LegacyLayoutField;
export declare const createAnyModel: (fieldType: FieldIntTypes, name: string, label: string, required?: boolean, otherThings?: AdditionalLayoutFieldOptions) => LegacyLayoutField;
export declare const passesConditionals: (conditions: Array<Conditional> | Conditional, data?: Record<string, any>, nested?: string) => boolean;
export {};