UNPKG

@manojadams/metaforms-core

Version:

React Library for rendering dynamic forms from json schema

54 lines (53 loc) 3.15 kB
import { IForm, IFormData, IFormField, IFormSection, IRequestBody } from "../constants/common-interface"; import { TiconPositionType, TValue } from "../constants/types"; import { Page } from "../core/Page"; import { IDependency, IDisplayProps, IField, IFormatterType, IIconConfig, IMeta, IOption, ISchema, TParam } from "./../constants/model-interfaces"; /** * @ignore */ export default class FormUtils { static getCssClassName(prop: IDisplayProps | undefined): string; static isFormControl(prop: IMeta): boolean; static getVerticalSpacing(theme: string): "" | "my-2 my-md-3"; static getAlignment(align: string): string; static getPadding(theme: string): "" | "py-md-3"; static getUUID(prefix?: string): string; static hasSections(fields: Array<IField>): boolean; static getFormDefaultButtons(): Array<IField>; static getFormGroupDefaultButtons(): Array<IField>; static getThemeProp(theme: any, prop: string): any; static getNormalizedFormData(formData: IFormData): {}; static getBase64(file?: File): Promise<unknown>; static getFormFieldValue(formField: IFormField): Promise<string | number | boolean | { [x: string]: unknown; name: string | number | boolean | null | undefined; } | null | undefined>; static updateFormData(formData: IForm, newFormData: IFormData, formatter: IFormatterType): Promise<IFormData>; static updateSectionFormData(formData: IFormSection | null, newFormData: IFormData, formatter: IFormatterType): Promise<IFormData>; static updateNestedFormData(formData: IFormData): Promise<void>; static updateNestedProp(formData: IFormData, props: Array<string>, value: TValue): Promise<void>; static getSearchValue(options: Array<IOption>, value: TValue): string | number | boolean | Date | IOption | null | undefined; static getDataFromValueKey(data: string, props: string): string; /** * Update parameters with special values ($input, $initial etc) * @param queryParams * @param eventType * @param currentValue * @returns */ static updateParams(queryParams: Array<TParam> | undefined, eventType: string | undefined, currentValue: TValue): TParam[] | undefined; /** * Updates request payload body * @param requestBody * @param requestBodyParams * @returns */ static updateBodyParams(requestBody: IRequestBody, requestBodyParams: Array<TValue>): any; static updateFieldProp(field: IFormField, prop: string, value: TValue): void; static getDateString(date: Date): string; static getLocalDateStringFormat(inputDateString: string, inputFormat: string): string; static cleanupSchema(schema: ISchema): ISchema; static createFileInput(fileWidthClass: string, fieldName: string, accept: string | undefined, displayLabel: string | undefined, onChangeCallback: EventListener): HTMLInputElement; static resolveButtonDependencies(deps: IDependency | undefined, page: Page): boolean; static getIconNameByPosition(positionType: TiconPositionType, allIcons: IIconConfig): string | undefined; }