-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathVariableDataTypeProperties.js
More file actions
47 lines (41 loc) · 1.59 KB
/
VariableDataTypeProperties.js
File metadata and controls
47 lines (41 loc) · 1.59 KB
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
42
43
44
45
46
47
import SelectDataTypeMask from './components/inspector/select-data-type-mask';
const string = { value: 'string', content: 'Text' };
const int = { value: 'int', content: 'Integer' };
const currency = { value: 'currency', content: 'Currency' };
const password = { value: 'password', content: 'Password' };
const percentage = { value: 'percentage', content: 'Percentage' };
const float = { value: 'float', content: 'Decimal' };
const datetime = { value: 'datetime', content: 'Datetime' };
const date = { value: 'date', content: 'Date' };
const boolean = { value: 'boolean', content: 'Boolean' };
const allOptions = [string, int, currency, percentage, float, datetime, date, password];
const allOptionsWithoutDate = [string, int, float];
function dataTypeFactory(options) {
return {
type: 'FormMultiselect',
field: 'dataFormat',
config: {
label: 'Data Type',
name: 'Data Type',
helper: 'The data type specifies what kind of data is stored in the variable.',
validation: 'required',
options,
},
};
}
function dataFormatFactory() {
return {
type: 'SelectDataTypeMask',
field: 'dataMask',
config: {
label: 'Data Format',
name: 'Data Format',
helper: 'The data format for the selected type.',
},
};
}
export const DataTypeProperty = dataTypeFactory(allOptions);
export const DataTypeWithoutDateProperty = dataTypeFactory(allOptionsWithoutDate);
export const DataTypeBooleanProperty = dataTypeFactory([boolean]);
export const DataTypeDateTimeProperty = dataTypeFactory([date, datetime]);
export const DataFormatProperty = dataFormatFactory();