This widget allows Aikau models to be displayed. It passes the model to Surf to obtain a list of the JavaScript and CSS
dependencies required to render the model and these are then dynamically added to the DOM.
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Example
<caption>This is an example configuration:</caption>
Extends
Mixes In
- external:dojo/_TemplatedMixin
- module:alfresco/core/CoreXhr
Members
-
_lastRequestTimestamp :number
-
This is used to store the timestamp of the last request made to generate the dependencies of a model. A timetamp is taken before making an XHR request and included in the request configuration. When handling the response the request timestamp is compared against the last stored timestamp so that only the data for the last request is used to build the preview.
Type:
- number
- Since:
- 1.0.54
- Default Value:
- null
- Source:
-
cssRequirements :Array
-
An array of the CSS files to use with this widget.
Type:
- Array
- Source:
-
i18nRequirements :Array
-
An array of the i18n files to use with this widget.
Type:
- Array
- Source:
-
pageDefinition :object[]
-
Type:
- object[]
- Default Value:
- null
- Source:
-
processTemplates :boolean
-
Indicates whether or not templates stored on the Alfresco Repository should be retrieved so that they can be processed within the generated preview.
Type:
- boolean
- Since:
- 1.0.49
- Default Value:
- false
- Source:
-
rootPreviewWidget :object
-
This will hold a reference to the root object on which the preview is built. This object should be destroyed before each new preview is built.
Type:
- object
- Default Value:
- null
- Source:
-
templateString :String
-
The HTML template to use for the widget.
Type:
- String
- Source:
Methods
-
buildPreview(config, rootNode)
-
This function builds a new preview of the supplied model.
Parameters:
Name Type Description config
Object[] The configuration to use to build the preview rootNode
element The DOM node which should be used to add instantiated widgets to - Source:
Fires:
-
cleanUpTemplateConfig(parameters)
-
Removes unnecessary attributes from a template before it is passed for previewing.
Parameters:
Name Type Description parameters
object - Since:
- 1.0.49
- Source:
-
generatePreview(payload)
-
Parameters:
Name Type Description payload
object An object containing the details of the page definition to preview. - Source:
-
getPageDefinitionFromPayload(payload)
-
Extracts the page definition from the supplied payload. If the payload contains a "pageDefinition" attribute then it is expected that the value is "stringified" JSON, but if it is supplied as individual "publishOnReady", "services" and "widgets" attributes then they will need to be combined and stringified.
Parameters:
Name Type Description payload
object The payload from which to retrieve the page definition. - Source:
-
loadAllTemplates() → {object}
-
PLEASE NOTE: This only works with the Horizon3-Repo-AMP REST APIs
- Since:
- 1.0.49
- Source:
Returns:
Returns a promise of the XHR result to get the pages.- Type
- object
-
loadAllTemplatesSuccess()
-
Success handler for loadAllTemplates. Resolves the promise originally returned.
- Since:
- 1.0.49
- Source:
-
onDependencyFailure()
-
- Source:
-
postCreate()
-
If a pageDefinition has been provided then the generatePreview function will be called. A subscription will be made for dynamic updating of the model.
- Source:
Listens to Events:
-
processTemplate()
-
Process a model to swap out any nested templates references that are contained within that model with the actual model of the referenced template. This will call the setTemplateConfiguration function to update the processed template with any configuration that has been provided for it.
- Since:
- 1.0.49
- Source:
-
requestPreviewDependencies(data)
-
Makes an XHR request to retrieve the dependencies for the supplied page model. When the request returns updatePage will be called to render the preview.
Parameters:
Name Type Description data
object The data for the preview. - Since:
- 1.0.49
- Source:
-
setTemplateConfiguration()
-
Configures a template that has been referenced in a model with the configuration defined for the template in that model.
- Since:
- 1.0.49
- Source:
-
updatePage()
-
- Source: