UNPKG

final-form-calculate

Version:

Decorator for calculating field values based on other field values in 🏁 Final Form

20 lines (18 loc) 493 B
// @flow type FieldName = string export type FieldPattern = FieldName | RegExp | FieldName[] export type UpdatesByName = { [FieldName]: (value: any, allValues: ?Object, prevValues: ?Object,) => any } export type UpdatesForAll = ( value: any, field: string, allValues: ?Object, prevValues: ?Object ) => { [FieldName]: any } export type Updates = UpdatesByName | UpdatesForAll export type Calculation = { field: FieldPattern, isEqual?: (any, any) => boolean, updates: Updates }