Document List

Overview

The Document List Component is a contractual component used to display and download the attachments (such as e-Statements) associated with a reference ID. The attachments are retrieved using the context data variable or the service response. Each row of the list in the Document List component contains many UI options. These options can be modified by assigning a row template dynamically. The Dynamic List component contains the following UI options by default.

  • Document Name
  • Document Extension
  • Format Icon
  • Download Icon
  • Download Text
  • Close Icon

All the UI features are customizable. A developer can configure these UI features to visible or invisible as per the requirement. Some of the ways in which the Document List Component can display the list are:

  • The document name with the extension along with the format icon download icon. The user can click the download icon to download the file.
  • The document name with extension with format icon, download icon, download text, and close icon. The user can download the file by clicking the download icon or text. When the user clicks the close icon, the row containing the attachment is removed from the list.
  • The document name with extension with format icon and close icon. In this scenario, the user can download the file by clicking the document name's row. When the user clicks the close the icon, the row containing the document is removed from the list.
  • The document name and the download icon. The user must click the download icon to download the file.
  • The document name with the extension and format icon. In this scenario, the user can download the file by clicking on the row.

NOTE: The Document List Component is used inside the Mobile Banking application.

Document List Contracts

The Document List Component contains contracts for customizing the data and properties for the widgets. The Document List Component contains the following contracts for customization.

Service Parameters

The Service Parameters contract of the Document List Component helps to set the service details required to retrieve the attachments using the criteria provided by the service API (such as transaction ID). In the Document List Component, the Service Parameter contract uses the getAttachments Object to retrieve the data to be displayed in a tabular format.

Here is a sample of the JSON object provided in the Service Parameter of the Document List Component.

{
  "getAttachments": {
    "ServiceType": "",
    "Service": "",
    "Object": "",
    "Verb": "",
    "Criteria": {}
  }
}

The Service Parameter contract provides the following key-value pairs for customization.

Property Description
ServiceType

Type: String

Defines the type of service to be performed.

For example: customVerb, getByCriteria

Service

Type: String

Name of the object service mentioned in the Quantum Fabric layer to fetch the data and meta data required for the component.

Object

Type: String

Name of the object linked to the object service mentioned above in the Quantum Fabric layer to fetch the data required for the component.

Verb

Type: String

Name of the operation or custom verb linked to the specified objects in the Quantum Fabric layer to fetch the data required for the component.

Criteria

Type: JSON object

The request payload as defined and configured in the Quantum Fabric Object service and operation.

Data Mapping

The Data Mapping contract of the Document List Component maps the widget IDs with the data to be displayed. The data is retrieved from Context variable, Service response, or i18n key. The Data Mapping property of Document List component supports the following Tokens.

  • ${Collection.CustomerAdvice.fileNames}: Maps the value stored in collection object.
  • ${CNTX.fileNames}: Maps the value from the Context variable.
  • ${i18n{i18n.common.download}}: Maps the i18n text.

Here is a sample of the JSON object provided in the Data Mapping of the Document List Component.

{
   "segments": {
      "segDocumentList": {
         "segmentMasterData":"${CNTX.fileNames}",
         "segmentUI": {
            "imgIcon1": "${segmentMasterData.fileType}",
            "lblField1": "${segmentMasterData.fileName}",
            "lblField2": "${segmentMasterData.fileDate}",
            "lblCommaSeparator": ",",
            "lblField3": "${segmentMasterData.fileTime}",
            "imgIcon2": "clear.png",
            "lblIcon": "\ue93d",
            "lblField4": "${i18n{i18n.common.download}}"
         },
         "segmentActions": {
            "Download": ["lblIcon","lblField4"],
            "Clear": ["imgIcon2"]
         },
         "showFileExtension": {
            "lblField1": true
         },
         "backEndMappings": {
            "fileID": "${segmentMasterData.fileID}"
         },
         "maxAttachments": "5"
      }
   }
}

The Data Mapping contract is assigned a JSON object with the following key-value pairs.

Key Description
segDocumentList

This section maps the data with the widgets in a key value format. This parameter accepts a JSON object with the following key value pairs.

  • segmentMasterData: This key is used to set if the data must be retrieved from a service response or from the context variable.
  • segmentUI: A JSON object that is used to map the data with the segment widgets. The JSON object contains the template widget IDs as keys and the value to be assigned to the widget as values.
  • segmentActions: This key is used to bind the widgets that are to be clicked or tapped to perform the Download or Clear action. The template widgets IDs for each action are assigned an array format. To not bind any widget to an action, The JSON object assigned to this parameter contains the following keys.
    • Download
    • Clear
  • showFileExtension: This key is used to set the visibility of the document extension. A JSON object with the widget ID as keys and Boolean value as values is assigned to this parameter.
  • backEndMappings: This key is used to map additional parameter apart from the UI data.
  • maxAttachments: This key is used to configure the maximum number of attachments that is displayed in the UI. This key accepts a numerical value in either String or Number format. When an empty String is assigned to this key, all the attachments retrieved from the Context variable or service response is displayed.

Data Formatting

The Data Formatting property is used to provide a custom format for a specific requirement. The Document List Component does not contain any customization.

{}

Conditional Mapping Key

The Conditional Mapping Key is used to define mapping based on a criterion.

For example, if a label defined in the UI must display different data according to the type of account, a developer must set the Conditional Mapping Key property to the following value. The Document List Component does not contain any value for this key.

{}

Conditional Mapping

The Conditional Mapping property key is used to map a widget with a data from Collection Object or service response as per the Conditional Mapping key. The Document List Component does not contain any customization for this key.

{}

Document List

The Document List contract of the Document List Component is used to configure the properties of the widgets, rows of the segment, and any arithmetic operations if required.

The Document List contract of the Document List Component contains the following fields.

Row Template Config

Assigns the dynamic template configurations to display the Attachments in a tabular format. If this field is empty, then the entire segment is not displayed. A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID is provided in a String format. For example: flxTempDocumentList2, where flxTempDocumentList2 is the row template ID.
  • JSON Format: This format is used to support the inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

The row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.

Default Value

{
"templateID": "flxTempDocumentList2", 
"microAppName": "ResourcesMA"
}

Type

JSON/ String

Split Operation

The Split Operation field is used to determine the file name and extension from the service response received by the Document List component. The Service response that is received by the Document List Component contains the fileID and fileName.

Here is an example of a sample response containing the file details.

"fileNames": [
  {
  "fileID": "abFtlB2zDwVRoCqUATVuFTtiEz9lljnS",
  "fileName": "Attachment1.pdf"
  }
]

The fileName attribute in this response contains both the file name and the extension. The Split Operation field divides the fileName into two separate fields, Document Name and Document Extension. The Split Operation field also assigns the widget type to be displayed for a particular extension.

Parameter Value

Syntax

JSON format with the following keys.

  • inputField: Sets the document name.
  • identifier: Sets the symbol that separates the file name and the extension.
  • resultWidgetType: Sets the type of the widget to be displayed for an extension. The following values can be assigned to this key.
    • Image
    • FontIcon
      This field uses the Dynamic Asset field to retrieve the image source or the font icon displayed for an extension.
  • resultField: Sets the type of the file or the extension of the file.

Default Value

{
   "operation1": {
      "inputField": "${CNTX.fileNames.fileName}",
      "identifier": ".",
      "resultWidgetType": "Image",
      "resultField": "${CNTX.fileNames.fileType}"
   }
}

Type

JSON

Download File On RowClick

This field is used to enable or disable the download of the file when the user clicks or taps anywhere on the row of the Segment.

Parameter Value

Syntax

Boolean value

Default Value

false

Type

Boolean

Dynamic Skin

The Dynamic Skin property overrides the existing skin of the Document List component.

Parameter Value

Syntax

JSON format with the following key.

  • segDocumentList - Sets the widget skins at the template level. Refer the Format for Dynamic Skinning to know how to apply skins in this parameter.
  • fields - Maps widget IDs with the corresponding Component level widget skins.

    Here is the format for mapping the widget with the corresponding skins.

    {
     <widgetID1>  : <skinName1>,
     <widgetID2>  : <skinName2>
    }
    

Default Value

{
   "segDocumentList": {
      "lblField1": "lblGrey500FS30",
      "lblAttachmentType": {
         "PDF": "lblIconGrey300FS50"
      }
   },
   "fields": {
      "flxDocumentList": "flxGrey100"
   }
}

Type

JSON

Dynamic Asset

This field is used to map the file type or widget type with a UNICODE value or an image source value based on the value of the resultWidgetType key in the Split Operation field.

Parameter Value

Syntax

JSON format with the following keys for all the file types.

  • FontIcon: Maps a file type with the corresponding UNICODE value. A JSON object with the file type as key and the UNICODE value as value is assigned to this parameter.
  • Image: Maps the file type with the source file of the image. The source file of the image must be provided along with the extension.

Default Value

{
   "FontIcon": {
      "pdf": "\ue95f"
   },
   "Image": {
      "pdf": "pdf.png",
      "word": "word.png",
      "xlsx": "excel.png",
      "doc": "docs.png"
   }
}

Type

JSON

onError Event

The OnError event is invoked when an error occurs during the user journey. When the onError event is invoked, an error object is passed to the parent widget. This object contains the information about the error as well as where it had occurred.

Parameter Value
Input parameter JSON object

Object Description

The JSON object contains the following keys:

  • level: This key contains the String value regarding the place in which the error occurs. It can be from the component View controller or from the component Business controller.
  • method: This key contains the method to be executed when an error occurs.
  • error: This key contains the actual error message and the stack.

Sample Input

var errordata = {
	"level": "ComponentViewController",
	"method": "render",
	"error": err
};
this.onError(errordata);

onFileDownload Event

When the user clicks a row containing the list of attachment, this event is used to pass the data of the selected row to the Form Controller.

Parameter Value
Input parameter

The following parameters are passed as a JSON object.

  • fileID: The file ID in a String format.
  • fileName: The file name with the extension in a String format.
Programmatic Name onFileDownload

Sample Code

var filedata = {
	"fileID": "abFtlB2zDwVRoCqUATVuFTtiEz9lljnS",
	"fileName": "Attachment1.pdf"
};
this.onFileDownload(filedata);

Return Type

None

setContext Method

This method is invoked inside the parent component or form controller. Using this method, you can pass the context object containing the information required for the component.

Parameter Value

Syntax

this.view.componentID.setContext(contextData);

Input parameter JSON object containing the context variable. For more information on the context object, click here.

Sample Input

this.view.DocumentList.setContext(contextData);

Return Type

None

Context Object

The context object is a JSON object that is used as an input in the Document List Component containing the details of the transaction.

Out of the response provided, the following parameters are used in the component.

  • fileNames
  • fileID
  • fileName

Here is a sample of the Context JSON Object used inside the component.

var context = {
	"fileNames": [{
			"fileID": "abFtlB2zDwVRoCqUATVuFTtiEz9lljnS",
			"fileName": "Attachment1.pdf"
		},
		{
			"fileID": "ZOTtS0xRVa0l8JXgTIsEt1vlH6DUcACY",
			"fileName": "Attachment2.xlsx"
		}
	]
};

Format for Dynamic Skinning

The Document List component provides two methods to assign skins to the segDocumentList parameter. These are

  • Applying Skin Directly: Using this method, a direct static pre-defined skin is assigned to the widget as a key value pair.
    In the following example, the lblGrey400FS30 skin is applied to the lblFieldLabel Label inside the segDetails template.
     "segDetails": {
          "lblFieldLabel" : "lblGrey400FS30"
       },
  • Applying Skin Based on a Condition: Using this method, the label is assigned a pre-defined skin based on certain conditions. For example, to apply different Font icons for different file extensions (such as PDF).
    In the following example, the lblAttachmentType Label applies the lblGrey300FS50 skin when a PDF files is displayed.
    "lblAttachmentType" : {
      "PDF" : "lblIconGrey300FS50"
    }
    

    The constants for each font icons (such as PDF) must be created in the componentUtility file. After creating the constants, a developer can map the constant with the skin name in the contract.

 

Copyright © 2020- Temenos Headquarters SA

Published on :
Monday, May 2, 2022 5:08:51 PM IST

Feedback
x