Visibility
What a definition's conditions hide, as the builder's getVisibility() gives it.
Definition
Visibilityconditionalboolean: true when what is hidden depends on the inputof(input: unknown) => VisibilityState: the state for an input. The same object while what is hidden stays the sameclear<T>(input: T) => T: the input with the fields its conditions clear made blank
Explanation
Set each field of toClear with Formisch's setInput, in an effect. The schema blanks their output either way. See conditions.
VisibilityState
VisibilityStateisHidden(node: FieldNode, indexes: readonly number[]) => boolean: whether a field is hidden, by its own conditions or by something it is inisStepHidden(step: LayoutStep) => boolean: whether a step is hidden, by its conditions or because its fields all areshownNodes(nodes: readonly LayoutNode[], indexes: readonly number[], isShown?) => LayoutNode[]: the layout nodes to render, likeshownNodestoClearreadonly FieldToClear[]: the cleared fields that still hold something
FieldToClear
FieldToClearpathFieldPath: its Formisch pathinputunknown:undefined, or[]for a list
Example
ts
const visibility = builder.getVisibility(definition)
// The form's input now, e.g. Formisch's getInput(form).
const input = { accountType: 'personal', vatId: 'DE123456789' }
const state = visibility.of(input) // the same object until what is hidden changes
const [vatId] = builder
.getFieldTree(definition)
.filter((node) => node.field.name === 'vatId')
state.isHidden(vatId!, []) // true
const { toClear } = state // [{ path: ['vatId'], input: undefined }]: set it with Formisch's setInput