Skip to content

Commit

Permalink
handle non existing fields in visibleIf - oneOf and allOf as null val…
Browse files Browse the repository at this point in the history
…ue. fix #370
  • Loading branch information
daniele-pecora committed Dec 3, 2020
1 parent 6799077 commit 018a59e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions projects/schema-form/src/lib/model/formproperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ export abstract class FormProperty {

/**
* Making use of the expression compiler for the <code>visibleIf</code> condition
* @param sourceProperty The source property where the `visibleIf` condition is set.
* @param targetProperty The target property what provided the `value` on which the `visibleIf` condition will be checked against. May be `null` or `undefined`
* @param dependencyPath The dependency path of the `targetProperty`
* @param value The value of the `targetProperty` to check the `visiblityIf` condintion against. May be `null` or `undefined`
* @param expression The value or expression to check against the `value` for the `targetProperty`. May be `null` or `undefined`
*/
private __evaluateVisibilityIf(
sourceProperty: FormProperty,
Expand Down Expand Up @@ -260,8 +265,8 @@ export abstract class FormProperty {
return valid
} catch (error) {
this.logger.error('Error processing "VisibileIf" expression for path: ', dependencyPath,
`source - ${sourceProperty._canonicalPath}: `, sourceProperty,
`target - ${targetProperty._canonicalPath}: `, targetProperty,
`source - ${(sourceProperty ? sourceProperty._canonicalPath : '<no-sourceProperty>')}: `, sourceProperty,
`target - ${(targetProperty ? targetProperty._canonicalPath : '<no-targetProperty>')}: `, targetProperty,
'value:', value,
'expression: ', expression,
'error: ', error)
Expand Down

0 comments on commit 018a59e

Please sign in to comment.