create.config.ts
7.38 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import {
PerimeterTypeEnum,
RangeUtilEnum,
RangeUtilNameEnum,
TimeIntervalUnitEnum,
TimeIntervalUnitNameEnum,
} from '../../../enum/form';
import { useRuleChainI18n } from '../../../hook/useRuleChainI18n';
import { FormSchema } from '/@/components/Form';
// Gps geofencing events
export enum GpsGeofencingEventsFieldsEnum {
LATITUDE_KEY_NAME = 'latitudeKeyName',
LONGITUDE_KEY_NAME = 'longitudeKeyName',
PERIMETER_TYPE = 'perimeterType',
FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA = 'fetchPerimeterInfoFromMessageMetadata',
PERIMETER_KEY_NAME = 'perimeterKeyName',
CENTER_LATITUDE = 'centerLatitude',
CENTER_LONGITUDE = 'centerLongitude',
RANGE = 'range',
RANGE_UNIT = 'rangeUnit',
POLYGONS_DEFINITION = 'polygonsDefinition',
MIN_INSIDE_DURATION = 'minInsideDuration',
MIN_INSIDE_DURATION_TIME_UNIT = 'minInsideDurationTimeUnit',
MIN_OUTSIDE_DURATION = 'minOutsideDuration',
MIN_OUTSIDE_DURATION_TIME_UNIT = 'minOutsideDurationTimeUnit',
}
const { tLabel, tPlaceholder } = useRuleChainI18n('action', 'gpsGeofencingEvents');
export const formSchemas: FormSchema[] = [
{
field: GpsGeofencingEventsFieldsEnum.LATITUDE_KEY_NAME,
component: 'Input',
label: tLabel(GpsGeofencingEventsFieldsEnum.LATITUDE_KEY_NAME),
required: true,
componentProps: {
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.LATITUDE_KEY_NAME),
},
},
{
field: GpsGeofencingEventsFieldsEnum.LONGITUDE_KEY_NAME,
component: 'Input',
label: tLabel(GpsGeofencingEventsFieldsEnum.LONGITUDE_KEY_NAME),
required: true,
componentProps: {
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.LONGITUDE_KEY_NAME),
},
},
{
field: GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE,
component: 'Select',
label: tLabel(GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE),
required: true,
componentProps: {
options: Object.keys(PerimeterTypeEnum).map((value) => ({ label: value, value })),
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE, 'choose'),
},
},
{
field: GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA,
component: 'Checkbox',
label: '',
renderComponentContent: () => ({
default: () =>
tLabel(GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA),
}),
},
{
field: GpsGeofencingEventsFieldsEnum.PERIMETER_KEY_NAME,
component: 'Input',
label: tLabel(GpsGeofencingEventsFieldsEnum.PERIMETER_KEY_NAME),
ifShow: ({ model }) =>
model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.POLYGON &&
model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
required: true,
componentProps: {
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.PERIMETER_KEY_NAME),
},
},
{
field: GpsGeofencingEventsFieldsEnum.POLYGONS_DEFINITION,
component: 'Input',
label: tLabel(GpsGeofencingEventsFieldsEnum.POLYGONS_DEFINITION),
helpMessage:
'Please, use the following format for manual definition of polygon: [[lat1,lon1],[lat2,lon2], ... ,[latN,lonN]].',
ifShow: ({ model }) =>
model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.POLYGON &&
!model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
required: true,
componentProps: {
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.POLYGONS_DEFINITION),
},
},
{
field: GpsGeofencingEventsFieldsEnum.CENTER_LATITUDE,
component: 'InputNumber',
label: tLabel(GpsGeofencingEventsFieldsEnum.CENTER_LATITUDE),
colProps: { span: 12 },
ifShow: ({ model }) =>
model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
!model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
required: true,
componentProps: {
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.CENTER_LATITUDE),
},
},
{
field: GpsGeofencingEventsFieldsEnum.CENTER_LONGITUDE,
component: 'InputNumber',
label: tLabel(GpsGeofencingEventsFieldsEnum.CENTER_LONGITUDE),
colProps: { span: 12 },
ifShow: ({ model }) =>
model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
!model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
componentProps: {
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.CENTER_LONGITUDE),
},
},
{
field: GpsGeofencingEventsFieldsEnum.RANGE,
component: 'InputNumber',
label: tLabel(GpsGeofencingEventsFieldsEnum.RANGE),
colProps: { span: 12 },
ifShow: ({ model }) =>
model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
!model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
required: true,
componentProps: {
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.RANGE),
},
},
{
field: GpsGeofencingEventsFieldsEnum.RANGE_UNIT,
component: 'Select',
label: tLabel(GpsGeofencingEventsFieldsEnum.RANGE_UNIT),
colProps: { span: 12 },
ifShow: ({ model }) =>
model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
!model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
required: true,
componentProps: {
options: Object.keys(RangeUtilEnum).map((value) => ({
label: RangeUtilNameEnum[value],
value,
})),
getPopupContainer: () => document.body,
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.RANGE_UNIT, 'choose'),
},
},
{
field: GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION,
component: 'InputNumber',
label: tLabel(GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION),
colProps: { span: 12 },
required: true,
componentProps: {
min: 1,
max: 2147483647,
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION),
},
},
{
field: GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION_TIME_UNIT,
component: 'Select',
label: tLabel(GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION_TIME_UNIT),
colProps: { span: 12 },
required: true,
componentProps: {
options: Object.keys(TimeIntervalUnitEnum).map((value) => ({
label: TimeIntervalUnitNameEnum[value],
value,
})),
getPopupContainer: () => document.body,
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION_TIME_UNIT),
},
},
{
field: GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION,
component: 'InputNumber',
label: tLabel(GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION),
colProps: { span: 12 },
required: true,
componentProps: {
min: 1,
max: 2147483647,
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION),
},
},
{
field: GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION_TIME_UNIT,
component: 'Select',
label: tLabel(GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION_TIME_UNIT),
colProps: { span: 12 },
required: true,
componentProps: {
options: Object.keys(TimeIntervalUnitEnum).map((value) => ({
label: TimeIntervalUnitNameEnum[value],
value,
})),
getPopupContainer: () => document.body,
placeholder: tPlaceholder(GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION_TIME_UNIT),
},
},
];