Skip to content

use/useFormModelProps ​

Overview ​

Builds the props that a view binds on its FormModel, in the documented configuration precedence.

Three layers combine, and each later layer wins for the same key:

  1. The model config's formProps for the view.
  2. The formProps object that the view received.
  3. The view's own form props, such as fields or fieldProps. A prop the view did not receive is undefined, and it leaves the earlier layers in place.

A later layer replaces an earlier layer's value whole. A fieldProps map passed to the view replaces the model config's fieldProps map, and does not merge with it key by key.

app, model, and view select the configuration that FormModel reads, so the view always sets them. The composable ignores those keys in either formProps layer and logs a console warning once per key.

Properties ​

FORM_MODEL_SELECTOR_PROPS ​

Props that select which configuration FormModel reads. A formProps layer cannot set them.

Type: typeOperator

Source: client/lib/use/useFormModelProps.js:21

VIEW_FORM_MODEL_PROPS ​

View props that a view forwards to FormModel under the same name. A view forwards its formModelVariant prop as variant.

Type: typeOperator

Source: client/lib/use/useFormModelProps.js:27

Methods ​

  • formModelExpand - Returns the relations that a view's FormModel renders as inline fieldsets.
  • pickViewFormModelProps - Picks the form props that a view's options carry, keyed by FormModel prop name.
  • useFormModelProps - Returns the props for a view's FormModel, merged in the documented precedence.

Types ​

FormModelPropsOptions ​

Source ​

client/lib/use/useFormModelProps.js:1