Extends the standard (read-only) property renderer to provide the ability to edit and save changes to the property. The edit view is rendered by a DojoValidationTextBox widget and this module accepts the same validationConfig as it does.
When an edit is completed and saved a publication will be made and that should be defined using the standard "publishTopic", "publishPayload" and related publication attributes. However, for convenience it is assumed that the typical use case will be for editing the properties of nodes and so if the "publishTopic" attribute is configured as null then the publication will automatically be set up to result in saving node properties (however, it will be necessary to make sure that the CrudService is included on the page to service those requests).
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Mixes In
Members
-
cancelLabel :string
-
This is the message or message key that will be used for the cancel link text.
Type:
- string
- Default Value:
- "inline-edit.cancel.label"
- Source:
-
cssRequirements :object[]
-
An array of the CSS files to use with this widget.
Type:
- object[]
- Default Value:
- [{cssFile:"./css/InlineEditProperty.css"}]
- Source:
-
editAltText :string
-
This is the message or message key that will be used for the alt text attribute on the edit icon
Type:
- string
- Default Value:
- "inline-edit.edit.altText"
- Source:
-
editLabel :string
-
This is the message or message key that will be used for the label attribute on the edit label
Type:
- string
- Default Value:
- "inline-edit.edit.label"
- Source:
-
editSubscriptionsTopics :string[]
-
An optional array of topics to be subscribed to that can trigger editing. The typical use case is when another widget (a PublishAcing for example) is provided that when clicked will toggle editing of the property. The current caveat is that the payload published must be the currentItem of this widget. This would be achieved by setting a publishPayloadType of "CURRENT_ITEM" and for both widgets (the publisher and the subscriber) rendering the same item.
Type:
- string[]
- Since:
- 1.0.72
- Default Value:
- null
- Source:
-
formWidget :object
-
References the widget used for editing. Created by calling the getFormWidget for the first time.
Type:
- object
- Default Value:
- null
- Source:
-
hiddenDataRules :array
-
In certain circimstances it may be necessary to submit additional data along with that provided by the main edit control. This configuration property should take the form:
hiddenDataRules: [ { name: "customProperties", rulePassValue: "hiddenData", ruleFailValue: "", is: ["includeHiddenData"] } ]
Type:
- array
- Default Value:
- null
- Source:
-
i18nRequirements :object
-
The array of file(s) containing internationalised strings.
Type:
- object
- Default Value:
- [{i18nFile: "./i18n/InlineEditProperty.properties"}]
- Source:
-
permissionProperty :string
-
The value configured will be used to look up a property for the item being rendered to determine whether or not to render the edit controls. If this is configured to be null then the edit controls will always be rendered.
Type:
- string
- Since:
- 1.0.31
- Default Value:
- null
- Source:
-
postParam :string
-
The is the name of the parameter that will be used to persist changes to the property
Type:
- string
- Default Value:
- null
- Source:
-
refreshCurrentItem :boolean
-
Indicates whether or not the currentItem should be updated following a successful save event.
Type:
- boolean
- Default Value:
- false
- Source:
-
saveLabel :string
-
This is the message or message key that will be used for save link text.
Type:
- string
- Default Value:
- "inline-edit.save.label"
- Source:
-
showOkCancelActions :boolean
-
If configured to be false then "Save" and "Cancel" actions will not be displayed when editing the property. It will still be possible to save changes by using the ENTER key.
Type:
- boolean
- Since:
- 1.0.47
- Default Value:
- true
- Source:
-
updateInProgressAltText :string
-
The alt text label to use for the update in progress indicator.
Type:
- string
- Since:
- 1.0.83
- Default Value:
- "inline-edit.update-in-progress.altText"
- Source:
-
updateInProgressImgSrc :string
-
The source file for the image to use to display when an item is being updated. This will typically only be displayed when an XHR request is made to retrieve the latest data for the item being edited.
Type:
- string
- Since:
- 1.0.83
- Default Value:
- null
- Source:
-
updateInProgressItemLabelProperty :string
-
The property to to retrieve from the currentItem to insert into the updateInProgressAltText that identifies the overall item being updated (rather than just the individual property that is being changed).
Type:
- string
- Since:
- 1.0.83
- Default Value:
- "displayName"
- Source:
-
updateInProgressNoLabelAltText :string
-
The alt text label to use for the update in progress indicator when the updateInProgressItemLabelProperty does not match a value in the currentItem.
Type:
- string
- Since:
- 1.0.83
- Default Value:
- "inline-edit.update-in-progress.no-label.altText"
- Source:
-
<inner> editOnClickRenderedValue :boolean
-
Whether the widget should be put into edit mode when rendered value is clicked.
Type:
- boolean
- Source:
Methods
-
createWidgetDom()
-
Overrides the inherited function to construct the DOM for the widget using native browser capabilities.
- Since:
- 1.0.100
- Source:
-
getFormWidget() → {object}
-
Gets the edit widget (creating it the first time it is requested).
- Source:
Returns:
The widget for editing.- Type
- object
-
getPrimaryFormWidget()
-
Gets the form widget that will be rendered as the edit field. By default this will return a textbox but can be overridden to return alternative form controls.
- Source:
-
onCancel()
-
Called when a user cancels out of edit mode. Returns the read-only display to its original state before editing began.
- Source:
-
onClickRenderedValue(evt)
-
This function is called whenever the user clicks on the rendered value. It checks an overridable instance variable (editOnClickRenderedValue), to see whether it should then launch into edit mode.
Parameters:
Name Type Description evt
object Dojo-normalised event - Source:
-
onEditClick()
-
This function is called whenever the user clicks on the edit icon. It hides the display DOM node and shows the edit DOM nodes.
- Source:
-
onFormValidityChange(payload)
-
Since 1.0.62 this function is never called and performs no action. The action labels were removed and the buttons from the Form are now displayed instead and the Form automatically takes care of button enablement.
Parameters:
Name Type Description payload
object The details of the updated form validity - Deprecated:
- Since 1.0.62 - This function no longer performs any action.
- Source:
-
onSave()
-
- Source:
-
onSaveFailure(payload)
-
Called following a failed save attempt. Cancels the edit mode. TODO: Issues an error message
Parameters:
Name Type Description payload
object The success payload - Source:
-
onSaveSuccess(payload)
-
Called following successful save attempts. This will update the read-only display using the requested save data.
Parameters:
Name Type Description payload
object The success payload - Source:
-
postCreate()
-
Extends the inherited function to check the permissionProperty to determine whether or not the current user actually has permission to edit the current item. If the user does not have permission then then edit controls will be hidden (and keyboard shortcuts suppressed).
- Source:
-
postMixInProperties()
-
This extends the inherited function to set the postParam.
- Source:
-
processHiddenDataRule(additionalFormWidgets, rule)
-
Called for each entry in the hiddenDataRules configuration to add a new hidden form control definition into the supplied array.
Parameters:
Name Type Description additionalFormWidgets
array The array to add additional form widgets into rule
object The current hidden data rule to process. - Source:
-
processHiddenDataRules()
-
In certain circimstances it may be necessary to submit additional data along with that provided by the main edit control. This function processes configurable hidden data rules that generates an array of hidden form controls that are configured with autoSetConfig that is derived from the hiddenDataRules.
- Source:
-
reRenderProperty(payload)
-
This function is called from onSaveSuccess to re-render the property after an edit has successfully been saved.
Parameters:
Name Type Description payload
object The success payload - Since:
- 1.0.83
- Source:
-
setDefaultPublicationData()
-
The topic to publish when a property edit should be persisted. For convenience it is assumed that document or folder properties are being edited so this function is called whenever a 'publishTopic' attribute has not been set. The defaults are to publish on the "ALF_CRUD_CREATE" topic which will publish a payload to be processed by the CrudService that should result in a POST a request being made to the Repository form processor.
- Source:
-
updateCurrentItem(payload) → {object}
-
This function is called from onSaveSuccess when refreshCurrentItem is true and allows the currentItem to be updated with the latest data following the update.
Parameters:
Name Type Description payload
object The success payload - Since:
- 1.0.83
- Source:
Returns:
A promise of the udpate that by default is immediately resolved.- Type
- object
-
updateSaveData(payload)
-
Updates the supplied payload with the current form value.
Parameters:
Name Type Description payload
object The save payload to update. - Source: