form0-core 0.1.17 → 0.1.19
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.
package/package.json
CHANGED
|
@@ -32,6 +32,9 @@ const toFiniteNumberOrNull = (value) => {
|
|
|
32
32
|
return Number.isFinite(parsed) ? parsed : null;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
const toBooleanOrDefault = (value, fallback = false) =>
|
|
36
|
+
typeof value === 'boolean' ? value : fallback;
|
|
37
|
+
|
|
35
38
|
const toSchemaFormNode = (schema) => {
|
|
36
39
|
if (!isRecord(schema)) {
|
|
37
40
|
return null;
|
|
@@ -349,7 +352,7 @@ const toSingleChoiceLabel = (field, rawValue) => {
|
|
|
349
352
|
context: 'projectDatasetRowValues',
|
|
350
353
|
});
|
|
351
354
|
if (labels.length === 0) {
|
|
352
|
-
return
|
|
355
|
+
return undefined;
|
|
353
356
|
}
|
|
354
357
|
|
|
355
358
|
return labels.length === 1 ? labels[0] : labels;
|
|
@@ -360,7 +363,7 @@ const toMultiChoiceLabels = (field, rawValue) => {
|
|
|
360
363
|
context: 'projectDatasetRowValues',
|
|
361
364
|
});
|
|
362
365
|
if (labels.length === 0) {
|
|
363
|
-
return
|
|
366
|
+
return undefined;
|
|
364
367
|
}
|
|
365
368
|
|
|
366
369
|
return labels;
|
|
@@ -471,6 +474,8 @@ const collectRepeatableDatasets = (elements, context, datasets) => {
|
|
|
471
474
|
repeatable_field_id: repeatableFieldId,
|
|
472
475
|
repeatable_output_key: repeatableOutputKey,
|
|
473
476
|
root_dataset_id: ROOT_DATASET_ID,
|
|
477
|
+
location_enabled: toBooleanOrDefault(element.location_enabled),
|
|
478
|
+
location_required: toBooleanOrDefault(element.location_required),
|
|
474
479
|
fields: [],
|
|
475
480
|
};
|
|
476
481
|
|
|
@@ -507,6 +512,8 @@ export function buildDatasetDescriptors(schema) {
|
|
|
507
512
|
repeatable_field_id: null,
|
|
508
513
|
repeatable_output_key: null,
|
|
509
514
|
root_dataset_id: ROOT_DATASET_ID,
|
|
515
|
+
location_enabled: toBooleanOrDefault(formNode.location_enabled),
|
|
516
|
+
location_required: toBooleanOrDefault(formNode.location_required),
|
|
510
517
|
fields: [],
|
|
511
518
|
};
|
|
512
519
|
|
|
@@ -600,7 +607,10 @@ export function projectDatasetRowValues(descriptor, rowValues) {
|
|
|
600
607
|
return;
|
|
601
608
|
}
|
|
602
609
|
|
|
603
|
-
|
|
610
|
+
const displayValue = toDisplayValue(field, rawValue);
|
|
611
|
+
if (typeof displayValue !== 'undefined') {
|
|
612
|
+
displayValues[field.field_id] = displayValue;
|
|
613
|
+
}
|
|
604
614
|
|
|
605
615
|
if (field.query_kind === 'scalar') {
|
|
606
616
|
const scalarValue = normalizeScalarValue(field, rawValue);
|