Module: alfresco/services/FormsRuntimeService

alfresco/services/FormsRuntimeService

IMPORTANT NOTE: This service is not fully complete yet and does not guarantee full support for the rendering all configured forms defined in XML for the forms runtime. It requires the "aikau-forms-runtime-support" JAR file to be available in the "share/WEB-INF/lib" folder and it will only work on Share. This has been made available early to for the purposes of collaborative development with the Alfresco Community.
Since:
  • 1.0.76
Author:
  • Dave Draper
License:
Source:

Members

_loadedMimeTypes :object[]

This will be populated with MIME type options the first time the "/org/alfresco/components/form/controls/mimetype.ftl" is mapped to a formcontrol and used. It prevents multiple XHR for data that is unlikely to change unnecessary.
Type:
  • object[]
Since:
  • 1.0.77
Default Value:
  • null
Source:

constraintMappings :object[]

Maps the XML constraint configuration specifying YUI2 based Share functions to Regular expression configuration for form validation.
Type:
  • object[]
Since:
  • 1.0.77
Default Value:
  • {"Alfresco.forms.validation.fileName": {pattern: "([\"*\\>
Source:

controlMappings :object

Type:
  • object
Source:

customControlMappings :string

Custom control mappings to check before the default control mappings.
Type:
  • string
Default Value:
  • null
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/FormsRuntimeService.properties"}]
Source:

propertyNameMapping :object

This has been added to support the slightly unsual scenarios where the configured parameter name in the form is not the parameter name that should be substitued. This was originally added to support the case of "Advanced Search" forms where the "prop_cm_modified" parameter name should be modified to be "prop_cm_modified-date-range"
Type:
  • object
Since:
  • 1.0.91
Source:

Methods

addConstraint(widget, constraint)

Parameters:
Name Type Description
widget object The widget model to add the constraint to
constraint object The constraint configuration
Source:

addField(widgets, formConfig, structureElement)

Called from onFormLoaded for each structural element in the form. Each structural element will typically represent a field to be rendered.
Parameters:
Name Type Description
widgets object[] The array of widgets to add the widget for the field to
formConfig object The full configuration for the form being rendered
structureElement object The current structural element defining a field to be rendered
Source:

addOptions(widget, targetField)

Adds options to the supplied widget. The options are derived from the "options" and "optionSeparator" attributes of the "params" configuration for the control of the supplied targetField.
Parameters:
Name Type Description
widget object The widget to add option to
targetField object The data for the field to check for options data
Since:
  • 1.0.77
Source:

getColumnsForControlRow() → {number|null}

Returns the number of columns that should be used for the ControlRow for the supplied structure. The "message" attribute in the structure contains the name of a template that can be mapped to a number of controls.
Since:
  • 1.0.86
Source:
Returns:
The number of columns or null if they can't be determined
Type
number | null

getEditFormControl(targetField, controlTemplate, formConfig) → {object}

Called from addField to create a "edit" mode widget for the field supplied.
Parameters:
Name Type Description
targetField object The configuration for the field to render.
controlTemplate string The name of the template to be mapped to a widget
formConfig object The full configuration for the form being rendered
Source:
Returns:
A model for the widget to be used to render the property.
Type
object

getMappedControl(formConfig, targetField, controlTemplate, mappings) → {object}

Called from addField and getViewProperty to find the Aikau control widget that has been mapped to the supplied controlTemplate.
Parameters:
Name Type Description
formConfig object The full configuration for the form being rendered
targetField object The configuration for the field to render.
controlTemplate string The name of the template to be mapped to a widget
mappings object The mappings configuration object to explore
Since:
  • 1.0.77
Source:
Returns:
The mapped control.
Type
object

getViewProperty(targetField, controlTemplate, formConfig) → {object}

Called from addField to create a "view" mode widget for the field supplied.
Parameters:
Name Type Description
targetField object The configuration for the field to render.
controlTemplate string The name of the template to be mapped to a widget
formConfig object The full configuration for the form being rendered
Source:
Returns:
A model for the widget to be used to render the property.
Type
object

onFormLoaded(response, originalReqeuestConfig)

The form data is returned as a JSON object that needs to be parsed and the data mapped to Aikau configuration.
Parameters:
Name Type Description
response object The response will be the form configuration to render
originalReqeuestConfig object The object used when making the XHR request that resulted in this callback
Source:

onFormLoadFailure()

Source:

onFormRequest()

Source:

onMimeTypesLoaded(response, originalRequestConfig)

Handles successful requests for available MIME types, converts the response into a structure that is appropriate for form controls, stores the data in [_loadedMimeTypes]module:alfresco/services/FormsRuntimeService#_loadedMimeTypes and calls publishMimeTypeOptions to publish the available options.
Parameters:
Name Type Description
response object
originalRequestConfig object
Since:
  • 1.0.77
Source:

onMimeTypesRequest(payload)

Handles requests to load the available MIME types to display as form control options. If the MIME types have already been loaded the previously loaded values will be returned by called publishMimeTypeOptions.
Parameters:
Name Type Description
payload object The details for the options request.
Since:
  • 1.0.77
Source:

publishMimeTypeOptions(payload)

Publishes the [available MIME type options]{@link module:alfresco/services/FormsRuntimeService#_loadedMimeTypes}.
Parameters:
Name Type Description
payload object The details for the options request.
Since:
  • 1.0.77
Source:

registerSubscriptions()

Source:
Listens to Events: