support enabledIfAny enabledIfAll
This commit is contained in:
parent
87fdb355b2
commit
8a725a54f1
4 changed files with 129 additions and 97 deletions
|
|
@ -75,7 +75,11 @@ function validateCurrentConfig () {
|
|||
function decorateEnabledIf (schemaFields, schemaField) {
|
||||
const code = schemaField.fieldLocator.code
|
||||
const field = _.find(f => f.code === code, schemaFields)
|
||||
return _.set('fieldEnabledIf', field.enabledIf || [], schemaField)
|
||||
|
||||
return _.assign(schemaField, {
|
||||
fieldEnabledIfAny: field.enabledIfAny || [],
|
||||
fieldEnabledIfAll: field.enabledIfAll || []
|
||||
})
|
||||
}
|
||||
|
||||
function fetchConfigGroup (code) {
|
||||
|
|
@ -88,10 +92,15 @@ function fetchConfigGroup (code) {
|
|||
|
||||
const schemaFields = groupSchema.fields
|
||||
.map(R.curry(getField)(schema, groupSchema))
|
||||
.map(f => _.assign(f, {
|
||||
fieldEnabledIfAny: f.enabledIfAny || [],
|
||||
fieldEnabledIfAll: f.enabledIfAll || []
|
||||
}))
|
||||
|
||||
const candidateFields = [
|
||||
schemaFields.map(R.prop('requiredIf')),
|
||||
schemaFields.map(R.prop('enabledIf')),
|
||||
schemaFields.map(R.prop('enabledIfAny')),
|
||||
schemaFields.map(R.prop('enabledIfAll')),
|
||||
groupSchema.fields,
|
||||
'fiatCurrency'
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue