@opencrvs/toolkit 1.8.0-rc.ff2e7b6 → 1.8.0-rc.ff73871
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -258,6 +258,36 @@ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number):
|
|
258
258
|
number?: undefined;
|
259
259
|
zipCode?: undefined;
|
260
260
|
} | null;
|
261
|
+
/**
|
262
|
+
* Maps complex or nested field types, such as Address fields, to their corresponding empty values.
|
263
|
+
*/
|
264
|
+
export declare function mapFieldTypeToEmptyValue(field: FieldConfig): never[] | {
|
265
|
+
country: null;
|
266
|
+
province: null;
|
267
|
+
district: null;
|
268
|
+
urbanOrRural: string;
|
269
|
+
town: null;
|
270
|
+
residentialArea: null;
|
271
|
+
street: null;
|
272
|
+
number: null;
|
273
|
+
zipCode: null;
|
274
|
+
filename?: undefined;
|
275
|
+
originalFilename?: undefined;
|
276
|
+
type?: undefined;
|
277
|
+
} | {
|
278
|
+
filename: string;
|
279
|
+
originalFilename: string;
|
280
|
+
type: string;
|
281
|
+
country?: undefined;
|
282
|
+
province?: undefined;
|
283
|
+
district?: undefined;
|
284
|
+
urbanOrRural?: undefined;
|
285
|
+
town?: undefined;
|
286
|
+
residentialArea?: undefined;
|
287
|
+
street?: undefined;
|
288
|
+
number?: undefined;
|
289
|
+
zipCode?: undefined;
|
290
|
+
} | null;
|
261
291
|
export declare const isParagraphFieldType: (field: {
|
262
292
|
config: FieldConfig;
|
263
293
|
value: FieldValue;
|
package/dist/events/index.js
CHANGED
@@ -164,6 +164,7 @@ __export(events_exports, {
|
|
164
164
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
165
165
|
isTextFieldType: () => isTextFieldType,
|
166
166
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
167
|
+
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
167
168
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
168
169
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
169
170
|
not: () => not,
|
@@ -1176,6 +1177,50 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1176
1177
|
return null;
|
1177
1178
|
}
|
1178
1179
|
}
|
1180
|
+
function mapFieldTypeToEmptyValue(field2) {
|
1181
|
+
switch (field2.type) {
|
1182
|
+
case FieldType.DIVIDER:
|
1183
|
+
case FieldType.TEXT:
|
1184
|
+
case FieldType.TEXTAREA:
|
1185
|
+
case FieldType.BULLET_LIST:
|
1186
|
+
case FieldType.PAGE_HEADER:
|
1187
|
+
case FieldType.LOCATION:
|
1188
|
+
case FieldType.SELECT:
|
1189
|
+
case FieldType.COUNTRY:
|
1190
|
+
case FieldType.RADIO_GROUP:
|
1191
|
+
case FieldType.SIGNATURE:
|
1192
|
+
case FieldType.PARAGRAPH:
|
1193
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
1194
|
+
case FieldType.FACILITY:
|
1195
|
+
case FieldType.OFFICE:
|
1196
|
+
case FieldType.NUMBER:
|
1197
|
+
case FieldType.EMAIL:
|
1198
|
+
case FieldType.DATE:
|
1199
|
+
case FieldType.CHECKBOX:
|
1200
|
+
return null;
|
1201
|
+
case FieldType.ADDRESS:
|
1202
|
+
return {
|
1203
|
+
country: null,
|
1204
|
+
province: null,
|
1205
|
+
district: null,
|
1206
|
+
urbanOrRural: "URBAN",
|
1207
|
+
// Default to urban needed for validation
|
1208
|
+
town: null,
|
1209
|
+
residentialArea: null,
|
1210
|
+
street: null,
|
1211
|
+
number: null,
|
1212
|
+
zipCode: null
|
1213
|
+
};
|
1214
|
+
case FieldType.FILE:
|
1215
|
+
return {
|
1216
|
+
filename: "",
|
1217
|
+
originalFilename: "",
|
1218
|
+
type: ""
|
1219
|
+
};
|
1220
|
+
case FieldType.FILE_WITH_OPTIONS:
|
1221
|
+
return [];
|
1222
|
+
}
|
1223
|
+
}
|
1179
1224
|
var isParagraphFieldType = (field2) => {
|
1180
1225
|
return field2.config.type === FieldType.PARAGRAPH;
|
1181
1226
|
};
|