Module: alfresco/renderers/Tags

alfresco/renderers/Tags

Extends the inline edit property renderer to provide the ability to edit and save tags.
Author:
  • Dave Draper
License:
Source:

Members

cssRequirements :object[]

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

warnIfNotAvailable :boolean

Override default configuration to display a message when no tags have been configured.
Type:
  • boolean
Default Value:
  • true
Source:

warnIfNotAvailableMessage :boolean

Override default configuration to to set a tag specific warning message.
Type:
  • boolean
Default Value:
  • "no.tags.message"
Source:

Methods

createEditTag(nameAttribute, valueAttribute, tagData, index)

Called from onEditClick to render an individual edit tag.
Parameters:
Name Type Description
nameAttribute string The attribute to use from the tagData object as the tag name
valueAttribute string The attribute to use from the tagData object as the tag value
tagData object The read-only tag widget to create a corresponding edit tag for.
index number The index of the tag in the overall array
Source:

createReadOnlyTag(nameAttribute, valueAttribute, tagData, index)

Called from getRenderedProperty to render an individual read only tag.
Parameters:
Name Type Description
nameAttribute string The attribute to use from the tagData object as the tag name
valueAttribute string The attribute to use from the tagData object as the tag value
tagData object The tag data to render
index number The index of the tag in the overall array
Source:

createTag(tagName, saveTagsAfterCreate) → {object}

Creates a tag at the remote store (the same location from which available tags are retrieved). This function is called regardless of whether or not an existing tag was created. It is expected that the REST API will be able to handle duplicated (e.g. not recreate a duplicate but just return the details of the existing tag).
Parameters:
Name Type Description
tagName string The name of the tag to create.
saveTagsAfterCreate boolean Indicates whether or not to save all tags on successful creation.
Source:
Returns:
The created tag details
Type
object

destroyTag(tagWidget)

By default this simply calls the destroy function of the tag widget (if it has one)
Parameters:
Name Type Description
tagWidget object The tag to be destroyed.
Source:

getPrimaryFormWidget() → {object}

Overrides the inherited function to return a select form control.
Source:
Returns:
The widget for editing.
Type
object

getRenderedProperty()

Overrides the inherited function to convert the tags value into visual tokens.
Source:

onCancel()

Extends the inherited function to clear the edit tags.
Source:

onEditClick()

Extends the inherited function to create the edit tag instances.
Source:

onRemoveEditTag()

Handles "ALF_REMOVE_TAG" events that are emitted from a DOM node descendant. The event target should map to a previously created edit tag that can then be destroyed.
Source:

onSave()

This extends the inherited function to check whether or not there is anything selected in the ComboBox. If so it uses the data to create the edit tag rather than saving. This ensures that all of the tags are captured and saved.
Source:

onSaveSuccess(payload)

Overrides the inherited function to render the newly saved tags.
Parameters:
Name Type Description
payload object The success payload
Source:
Fires:

onTagCreated(payload)

Parameters:
Name Type Description
payload object The payload of the successful tag creation request.
Source:

onValueEntryKeyPress(e)

This function is connected via the widget template. It occurs whenever a key is pressed whilst focus is on the input field for updating the property value. All keypress events other than the enter and escape key are ignored. Enter will save the data, escape will cancel editing
Parameters:
Name Type Description
e object The key press event
Source:

placeReadOnlyTag(tagWidget, index)

Parameters:
Name Type Description
tagWidget object The tag widget to place.
index number The index of the tag
Source:

postCreate()

Extends the inherited function to add a custom event handler for "ALF_REMOVE_TAG" events that are fired from descendant DOM nodes and to iterate over the read only tags created by calls to the createReadOnlyTag function and calls placeTag on each of them to add them to the widget.
Source:

updateSaveData(payload)

Overrides the inherited function to set the save payload with the tag data.
Parameters:
Name Type Description
payload object The save payload to update.
Source: