Module: alfresco/services/DragAndDropModelCreationService

alfresco/services/DragAndDropModelCreationService

This is a service that is dedicated to creating JavaScript and NLS properties library files that provide localized models for creating drag-and-drop based modelling pages. It was written with this single use case in mind however it could potentially be used in other contexts.
Author:
  • Dave Draper
License:
Source:

Methods

createFunctionContent(name, model, suffix) → {string}

Creates a new function declaration using the supplied arguments.
Parameters:
Name Type Description
name string The name to to use for the function prefix
model object The model to process
suffix string The function suffix
Source:
Returns:
A function declaration as a string
Type
string

createModelFunction(name, property, targetValues, configWidgetsSuffix, nestedWidgetsSuffix, displayWidgetsSuffix) → {string}

Creates the JavaScript function string that can be called to generate a single model. This is what would be called by the WebScript JavaScript controller that imports the library file.
Parameters:
Name Type Description
name string The model name
property string The property of a dropped item that should be compared against the target values
targetValues string A JSON stringified array of target values to match against the property
configWidgetsSuffix string The suffix used for the function that gets the widgetsForConfig
nestedWidgetsSuffix string The suffix used for the function that gets the widgetsForNestedConfig
displayWidgetsSuffix string The suffix used for the function that gets the widgetsForDisplay
Source:
Returns:
The function definition
Type
string

generateDownload(fileName, content)

This is only currently supported by Chrome.
Parameters:
Name Type Description
fileName string The name of the file to create
content string The file contents to create
Source:

onFormExport(payload)

Parameters:
Name Type Description
payload object Details of the form configuration to export
Source:

onFormPreview(payload)

Handles requests to generate previews of the form models.
Parameters:
Name Type Description
payload object The model to preview.
Source:

processNlsData(nlsProps, prefix, o)

Processes the supplied model to generate an NLS lib file. The generated NLS keys are then swapped into the model in place of the actual values.
Parameters:
Name Type Description
nlsProps array An array to update with the generated NLS properties
prefix string The prefix for each NLS key.
o object The current object in the model being processed
Source:

registerSubscriptions()

Sets up the subscriptions for the service
Since:
  • 1.0.32
Source: