Module

useFormLayout

Methods

# static getFieldValue(field, formData) → {object}

This is a helper method to convert the data from the database into the format that the form expects. If the data is null or missing will set as need to avoid "uncontrolled" vs "controlled" MUI errors.
Parameters:
Name Type Description
field ParsedField the field object should be in the syntax of the form builder (parseField)
formData object the data from the database. This should be ALL the form values.

View Source hooks/useFormLayout.js, line 412

object

# static parseField(field, asyncFieldsMap) → {ParsedField}

Parse a field
Parameters:
Name Type Description
field object field object
asyncFieldsMap Map.<string, string> map of async fields

View Source hooks/useFormLayout.js, line 213

parsed field
ParsedField

# static parseSection(section, fieldMap, triggerFieldMap, asyncFieldsMap) → {ParsedSection}

Parse a section
Parameters:
Name Type Description
section object
fieldMap Map.<string, ParsedField> map of fieldId to field object
triggerFieldMap Map.<string, object> map of triggerFieldId to field object
asyncFieldsMap Map.<string, string>

View Source hooks/useFormLayout.js, line 173

- parsed section
ParsedSection

# static processFieldValue(field, value) → {Object|string|array|number}

This is a helper method to convert the data from the form into the format that the API expects.
Parameters:
Name Type Description
field object
value Object | string | array | number

View Source hooks/useFormLayout.js, line 508

Object | string | array | number

# static useFormLayout(type, key, url) → {array}

Layout fetching hook that extends the useLayout hook to parse the layout data into a more usable format The loading flag is tied to parsing being complete instead of the layout loading being complete
Parameters:
Name Type Description
type string object type for standard PAM get layout endpoint
key string layout key for standard PAM get layout endpoint
url string optional if you are not using the standard pam endpoint

View Source hooks/useFormLayout.js, line 31

- first element is the parsedLayout object second is loading boolean
array

# inner parseConditions(fieldId, triggerFields, conditions)

Parse conditions and add them to the triggerFieldMap
Parameters:
Name Type Description
fieldId string field id
triggerFields Map.<string, TriggerField> map of trigger fields
conditions Array.<TriggerCondition> conditions

View Source hooks/useFormLayout.js, line 374

# inner parseFormLayout(layout) → {ParsedFormLayout}

Will parse the layout data into React Hook Form friendly format
Parameters:
Name Type Description
layout object assumed to be in the standard PAM layout format

View Source hooks/useFormLayout.js, line 52

- parsed layout
ParsedFormLayout

# inner parseValidation(validationMap, data)

Parse validation
Parameters:
Name Type Description
validationMap Map.<string, YupSchema>
data object

View Source hooks/useFormLayout.js, line 352