Module: alfresco/forms/controls/MultipleEntryCreator

alfresco/forms/controls/MultipleEntryCreator

Author:
  • Dave Draper
License:
Source:

Mixes In

Members

_dndSource :object

This is a refrence to the Drag-And-Drop source container. This will be set to be the "currentEntries" node during the constructor (unless overridden by and extending class)
Type:
  • object
Default Value:
  • null
Source:

addEntryAltText :string

This is the altText that is used for the add entry button.
Type:
  • string
Default Value:
  • "multiple-entry.add"
Source:

addEntryImage :string

This is the source of the image used for the add entry button
Type:
  • string
Default Value:
  • "add-icon-16.png"
Source:

addEntryImageSrc :string

This is the source of the image used for the add entry button
Type:
  • string
Default Value:
  • null
Source:

cssRequirements :Array

An array of the CSS files to use with this widget.
Type:
  • Array
Source:

elements

This is the list of elements to display/edit. It will be instantiated in the constructor.
Default Value:
  • null
Source:

elementWrappers

Keeps track of all the wrapper objects - should this be a map??
Default Value:
  • null
Source:

enableDND :boolean

Indicates whether or not re-ordering should be enabled through the use of drag and drop
Type:
  • boolean
Default Value:
  • false
Source:

i18nRequirements :Array

An array of the i18n files to use with this widget.
Type:
  • Array
Source:

templateString :String

The HTML template to use for the widget.
Type:
  • String
Source:

Methods

addEntry(e)

This function is called when the add entry button is clicked. We need to add a new element in edit mode.
Parameters:
Name Type Description
e object
Source:

constructor()

This constructor ensures that valid data has been set.
Source:

createDNDAvatarNode(widget)

This creates the default Avatar DOM node for a MultipleEntryElement. It is nothing more than a basic DIV element where the inner HTML is set to the value field of the widget value. This function should be overridden by extending classes to make sure that the Avatar shows the appropriate information.
Parameters:
Name Type Description
widget object
Source:

createElementWidget(config) → {object}

This function should be extended by concrete implementations to create the element to go in the element wrapper.
Parameters:
Name Type Description
config object The configuration to instantiate the element with
Source:
Returns:
A nwe MultipleEntryElement instance.
Type
object

createElementWrapper(elementConfig, previouslyExisted)

Creates the wrapper that wraps the widget. Calls "createElementWidget" to create the widget.
Parameters:
Name Type Description
elementConfig object
previouslyExisted boolean Indicates that the element previously existed.
Source:

createEntries()

This function is used to create all of the entries. It is provided for use at both widget instantiation and when a new value is passed. It will iterate over the supplied array and create wrappers and elements for each entry.
Source:

deleteEntry()

Deletes the wrapper provided.
Source:

dndCreator(item, hint) → {object}

This function is used to create drag and drop elements from the supplied item data. It is used to construct BOTH avatars (the item when being dragged) and item templates. The item template is constructed by the createElementWrapper function
Parameters:
Name Type Description
item object The item to create an avatar or element for
hint string Indicates what to create
Source:
Returns:
Type
object

getAcceptedDNDTypes() → {string[]}

This function is called to return the list of Drag-And-Drop types that are accepted by the MultipleEntryCreator. By default it returns the value returned by calling the "getDNDType" function as only element in an array. This function should be overridden if the extending class wishes to support other types being droppped into it.
Source:
Returns:
Type
string[]

getDNDAvatarWidget(item)

This function is called whenever a Drag-And-Drop avatar is required. This takes the approach that the item may not contain all the information available in the associated Drag-And-Drop Source object so it retrieves all the currently selected nodes (when a Drag-And-Drop operation starts the nodes being moved will be selected) and finds the widget mapped to the node of the item supplied. This widget contains all of the information required to pass on to the "createDNDAvatarNode" function.
Parameters:
Name Type Description
item object The item to create an object for
Source:

getDNDType() → {string}

This function returns the Drag-And-Drop type to assign to each element. By default this returns "MultipleEntryElementWrapper". This function should be overridden by extending classes to specify more specific data. This is especially important if the accepted types that can be dropped needs to be constrained.
Source:
Returns:
Type
string

getValue() → {object}

Source:
Returns:
Type
object

postCreate()

Creates each element to display/edit
Source:

postMixInProperties()

Set up the attributes to be used when rendering the template.
Source:

setValue(value)

Parameters:
Name Type Description
value object
Source:

validate() → {boolean}

Source:
Returns:
Type
boolean

validationRequired()

Source: