@beseif-solutions/prow-core 0.2.2 → 0.2.3
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.
|
@@ -422,6 +422,9 @@ const recursive_schema = async (field, data, options) => {
|
|
|
422
422
|
if (options.alter) {
|
|
423
423
|
delete newField.altered_by;
|
|
424
424
|
}
|
|
425
|
+
if (typeof newField.show === `boolean` && !newField.show) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
425
428
|
}
|
|
426
429
|
const alteredField = lodash_1.default.cloneDeep(newField);
|
|
427
430
|
if (newField.type === `file`) {
|
|
@@ -467,11 +470,7 @@ const recursive_schema = async (field, data, options) => {
|
|
|
467
470
|
if (!calculatedSchema) {
|
|
468
471
|
throw new Error(`Could not resolve schema for field ${newField.key}`);
|
|
469
472
|
}
|
|
470
|
-
if (
|
|
471
|
-
lodash_1.default.unset(data, relativeKey);
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
else if (newField.disabled) {
|
|
473
|
+
if (newField.disabled) {
|
|
475
474
|
lodash_1.default.unset(data, relativeKey);
|
|
476
475
|
}
|
|
477
476
|
return { schema: calculatedSchema, field: field.type === `file` ? alteredField : newField };
|
package/package.json
CHANGED
|
@@ -625,6 +625,8 @@ const recursive_schema = async (field: Field, data: Record<string, any>, options
|
|
|
625
625
|
|
|
626
626
|
// remove altered_by only if it's not an array -> array alterations must be kept for front-end rendering
|
|
627
627
|
if (options.alter) { delete newField.altered_by; }
|
|
628
|
+
|
|
629
|
+
if (typeof newField.show === `boolean` && !newField.show) { return; }
|
|
628
630
|
}
|
|
629
631
|
|
|
630
632
|
const alteredField: Field = _.cloneDeep(newField);
|
|
@@ -676,14 +678,8 @@ const recursive_schema = async (field: Field, data: Record<string, any>, options
|
|
|
676
678
|
|
|
677
679
|
if (!calculatedSchema) { throw new Error(`Could not resolve schema for field ${newField.key}`); }
|
|
678
680
|
|
|
679
|
-
if
|
|
680
|
-
|
|
681
|
-
_.unset(data, relativeKey);
|
|
682
|
-
return;
|
|
683
|
-
} else if (newField.disabled) {
|
|
684
|
-
// TODO: check this
|
|
685
|
-
_.unset(data, relativeKey);
|
|
686
|
-
}
|
|
681
|
+
// if disabled schema validation is done but the value is not set
|
|
682
|
+
if (newField.disabled) { _.unset(data, relativeKey); }
|
|
687
683
|
|
|
688
684
|
return { schema: calculatedSchema, field: field.type === `file` ? alteredField : newField };
|
|
689
685
|
} catch (e) { throw e; }
|