Module: alfresco/forms/controls/utilities/ChoiceMixin

alfresco/forms/controls/utilities/ChoiceMixin

Since:
  • 1.0.54
Author:
  • Dave Draper
  • Martin Doyle
License:
Source:

Members

_choiceListeners :object

Listener handles by choice (for removing)
Type:
  • object
Source:

_choices :module:alfresco/forms/controls/MultiSelect#Choice[]

Collection of choice objects
Type:
  • module:alfresco/forms/controls/MultiSelect#Choice[]
Source:

_rootChoiceClass :string

The root class for choice CSS selectors.
Type:
  • string
Default Value:
  • "alfresco-forms-controls-utilities-ChoiceMixin"
Source:

_selectedChoice :module:alfresco/forms/controls/MultiSelect#Choice

The currently selected choice object
Type:
  • module:alfresco/forms/controls/MultiSelect#Choice
Source:

_storeItems :object

A map of retrieved items, by value
Type:
  • object
Source:

choiceCanWrap :boolean

Whether choices' text can wrap
Type:
  • boolean
Default Value:
  • true
Source:

choiceMaxWidth :string

The maximum width of choices within the control as a CSS string
Type:
  • string
Default Value:
  • "100%"
Source:

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/ChoiceMixin.css"}]
Source:

Methods

_addChoice(item)

Add the specified result item to the choices
Parameters:
Name Type Description
item object The item to choose
Source:

_deleteSelectedChoice()

Delete the currently selected choice
Source:

_deselectAllChoices()

Deselect all choices
Source:

_getLabel(item) → {object}

Returns an object based on the supplied item that has attributes for rendering the title and display value of the item. By default both are returned as the supplied item (expected to be a string) however this function can be overridden to return alternative displays for complex items.
Parameters:
Name Type Description
item object The item to return a label object for
Source:
Returns:
An object with 'full' and 'choice' attributes.
Type
object

_onChoiceClick(choiceObject, evt)

Handle clicks on a choice
Parameters:
Name Type Description
choiceObject object The choice (node) being clicked on
evt object The click event object
Support:
  • This function is safe to be overridden by extending or mixing modules (at least until the next major release). The inherited code must be called in the overriding function and if the inherited function returns a value then that value must be returned by the overriding function.
Source:

_onChoiceCloseMouseDown(choiceToRemove, evt)

Handle clicks on the close button of a choice by removing the choice.
Parameters:
Name Type Description
choiceToRemove object The choice object to remove
evt object The click event object
Support:
  • This function is safe to be overridden by extending or mixing modules (at least until the next major release). The inherited code must be called in the overriding function and if the inherited function returns a value then that value must be returned by the overriding function.
Source:

_removeChoice(choiceToRemove, evt)

Remove a specific choice value
Parameters:
Name Type Description
choiceToRemove object The choice object to remove
evt object Dojo-normalised event object
Source:

_selectChoice(choiceNodeOrOffset)

Select the specified choice
Parameters:
Name Type Description
choiceNodeOrOffset object | number The choice node to select or the adjustment offset from the currently selected one, which must be either 1 or -1. If none is selected, then the start position is to the right of the current choices.
Source:

getItemValue(item)

Returns the full value for the supplied item. By default it simply returns the item provided however this function can be overridden by mixing modules to retrieve additional data.
Parameters:
Name Type Description
item object The item to return the value for
Source:

getNewChoiceRelativePosition() → {object}

Called from _addChoice to return the position that new choices should be added relative to the a target DOM element
Source:
Returns:
The DOM element to add choices relative to
Type
object

getNewChoiceTargetNode() → {object}

Called from _addChoice to return the DOM element that new choices should be added relative to.
Source:
Returns:
The DOM element to add choices relative to
Type
object

getRootClassTargetNode() → {object}

Called from postCreate to return the DOM element that the root class should be applied to.
Source:
Returns:
The target DOM element
Type
object

getStoreItem() → {object}

Called from _addChoice to return the a more detailed value for the supplied value from an associated store. By default this simply returns the supplied object, but can be overridden to return more complex data.
Source:
Returns:
The DOM element to add choices relative to
Type
object

postCreate()

Source: