UNPKG

@talend/react-forms

Version:

React forms library based on json schema form.

96 lines (95 loc) 4.03 kB
/** * Adapt merged schema from jsfc with additional rules * @param mergedSchema The jsfc merged schema * @returns The adapted merged schema */ export function adaptAdditionalRules(mergedSchema: any): any; /** * Validate a value. * @param schema The merged schema * @param value The value * @param properties The values * @param customValidationFn A custom validation function * that is applied on schema.customValidation = true * @returns {object} The validation result. */ export function validateValue(schema: any, value: any, properties: any, customValidationFn: any, event: any): object; /** * Validate an array. * @param mergedSchema The array schema * @param value The value * @param properties All the values * @param customValidationFn A custom validation function * that is applied on schema.customValidation = true * @param deepValidation Validate the array values if set to true * @returns {object} The validation result. */ export function validateArray(mergedSchema: any, value: any, properties: any, customValidationFn: any, deepValidation: any): object; /** * Validate a simple value. * @param mergedSchema The schema to validate * @param value The value * @param properties All the values * @param customValidationFn A custom validation function * that is applied on schema.customValidation = true * @param deepValidation Validate subItems if true * @returns {object} The validation result. */ export function validateSimple(mergedSchema: any, value: any, properties: any, customValidationFn: any, deepValidation: any, event: any): object; /** * Execute the right validation depending on the schema type. * @param mergedSchema The merged schema * @param value The value * @param properties All the values * @param customValidationFn A custom validation function * that is applied on schema.customValidation = true * @param deepValidation Validate subItems if true * @returns {Object} The validation result by field. */ export function validateSingle(mergedSchema: any, value: any, properties: any, customValidationFn: any, deepValidation: any, event: any): Object; /** * Validate all values in the schema. * @param mergedSchema The merged schema array * @param properties The values * @param customValidationFn A custom validation function * that is applied on schema.customValidation = true * @returns {object} The validation result by field. */ export function validateAll(mergedSchema: any, properties: any, customValidationFn: any): object; /** * Check if a schema value is valid. * It is invalid if : * - the schema is an invalid field (errors[key] is falsy) * - the schema has items (ex: fieldset, tabs, ...), and at least one of them is invalid * @param schema The schema * @param errors The errors * @returns {boolean} true if it is invalid, false otherwise. */ export function isValid(schema: any, errors: any): boolean; /** * Filter the errors on array which items indexes are between a range * This returns only the errors keys. * @param errors The errors map * @param arrayKey The array key * @param minIndex The min item index (INCLUDED) * @param maxIndex The max item index (EXCLUDED) */ export function filterArrayErrorsKeys(errors: any, arrayKey: any, minIndex: any, maxIndex: any): string[]; /** * Given an error map: * Remove errors on array items if shouldRemoveIndex(index) is true * Shift the index of array items, where new index is getNextIndex(index) * @param oldErrors The errorMap * @param arrayKey The array key * @param minIndex The first index to manipulate * @param maxIndex The last (EXCLUDED) index to manipulate * @param shouldRemoveIndex Predicate to determine if this item errors should be removed * @param getNextIndex New index provider */ export function shiftArrayErrorsKeys(oldErrors: any, { arrayKey, minIndex, maxIndex, shouldRemoveIndex, getNextIndex }: { arrayKey: any; minIndex: any; maxIndex: any; shouldRemoveIndex: any; getNextIndex: any; }): import("lodash").Omit<any, string>;