summaryrefslogtreecommitdiffstats
path: root/src/lib/Form.ts
blob: 14ea8294838f762fa60412fb29d5a830cac0025f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Form from 'mobx-react-form';
import vjf from 'mobx-react-form/lib/validators/VJF';

export default class DefaultForm extends Form {
  bindings() {
    return {
      default: {
        id: 'id',
        name: 'name',
        type: 'type',
        value: 'value',
        label: 'label',
        placeholder: 'placeholder',
        disabled: 'disabled',
        onChange: 'onChange',
        onFocus: 'onFocus',
        onBlur: 'onBlur',
        error: 'error',
      },
    };
  }

  options() {
    return {
      validateOnInit: false, // default: true
      // validateOnBlur: true, // default: true
      // validateOnChange: true // default: false
      // // validationDebounceWait: {
      // //   trailing: true,
      // // },
    };
  }

  plugins() {
    return {
      vjf: vjf(),
    };
  }
}