1 | import { Decorator } from 'final-form'
|
2 |
|
3 | export type FieldName = string
|
4 |
|
5 | export type FieldPattern = FieldName | RegExp | FieldName[]
|
6 |
|
7 | export type UpdatesByName = {
|
8 | [FieldName: string]: (value: any, allValues?: Object, prevValues?: Object) => any
|
9 | }
|
10 |
|
11 | export type UpdatesForAll = (
|
12 | value: any,
|
13 | field: string,
|
14 | allValues?: Object,
|
15 | prevValues?: Object,
|
16 | ) => { [FieldName: string]: any }
|
17 |
|
18 | export type Updates = UpdatesByName | UpdatesForAll
|
19 |
|
20 | export type Calculation = {
|
21 | field: FieldPattern,
|
22 | updates: Updates,
|
23 | isEqual?: (a: any, b: any) => boolean,
|
24 | }
|
25 |
|
26 | export default function createDecorator(
|
27 | ...calculations: Calculation[]
|
28 | ): Decorator
|
29 |
|
\ | No newline at end of file |