-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfields.js
41 lines (35 loc) · 1.05 KB
/
fields.js
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
40
41
import Field from './Field.html';
import { TextInput, NumberInput, MaskedInput, CurrencyInput, SelectInput } from './inputs';
function mergeState(data, fieldtype) {
return Object.assign({}, data, { settings: data }, { fieldtype });
}
export const TextField = class extends Field {
constructor(options) {
options.data = mergeState(options.data, TextInput);
super(options);
}
}
export const NumberField = class extends Field {
constructor(options) {
options.data = mergeState(options.data, NumberInput);
super(options);
}
}
export const MaskedField = class extends Field {
constructor(options) {
options.data = mergeState(options.data, MaskedInput);
super(options);
}
}
export const CurrencyField = class extends Field {
constructor(options) {
options.data = mergeState(options.data, CurrencyInput);
super(options);
}
}
export const SelectField = class extends Field {
constructor(options) {
options.data = mergeState(options.data, SelectInput);
super(options);
}
}