CUI Components

From AgileApps Support Wiki

ace-app-nav-list

Overview

It will list down all the objects and web tabs which are configured in users tab preferences.
Selector: <ace-app-nav-list>
Use the following code to render the component:

<ace-app-nav-list></ace-app-nav-list>


API

Following attribute is available for ace-app-nav-list tag.

Attribute Description
css-classlist It helps to specify css class(es) for the tag. Use whitespace to separate Multiple css classes.

Following events are dispatched by the ace-app-tabs-list tag:

Event Description
selectionchange Event dispatched on clicking a row.
load Event dispatched on loading the component. This provides the list of objects for the active application.


Sample code

<a id="selection-change"></a>

selectionchange

html
<ace-app-nav-list id="appTabsInstance"></ace-app-nav-list>
javascript
const appTabsIns = document.querySelector('#appTabsInstance');
appTabsIns.addEventListener('selectionchange', function (event) {
 //Perform your action here
 const tabData = event['detail'];
 console.log(tabData);
});

Response

javascript
{
    canAdd: "${true/false}",
    id: "${id}",
    title: "${title}",
    uri: "${uri}", // for webtabs
    webtabname: "${webtab name}", // for webtabs
}

<a id="load"></a>

load

html
<ace-app-nav-list id="appTabs"></ace-app-nav-list>
javascript
document.querySelector('#appTabs').addEventListener('load', (event) => {console.log(event['detail'])});

Response

javascript
[
	{
		id: "cases"
		title: "Cases"
		singularTitle: "Case"
		canAdd: true
		type: "object"
	},
	{....},
	{....}
	
]

Important Note: Only the properties mentioned here are supported.


ace-bookmark-list

Overview

This displays the bookmarked item corresponding to the user as a custom component.
Selector: <ace-bookmark-list>
Use the following code to render the component:
html
<ace-bookmark-list></ace-bookmark-list>

API

Following attributes are available for the ace-bookmark-list tag.

Attribute Description
search If the value is true, then it displays the search box for bookmark list. If the value is false, it hides the search input.
Default value: 'true'
group-ids Displays only the list of selected group ID items. User needs to pass comma separated group IDs.
css-classlist It helps to specify css class(es) for the tag. Use whitespace to separate multiple css classes.

Following events are dispatched by the ace-bookmark-list tag:

Event Description
selectionchange Event dispatched on clicking a bookmark item.
load Event dispatched on loading the component. This provides the list of bookmarked data.

Following are the tag instance methods:

Method Description
clearAll() Removes all the data present in the bookmarked list.
setGroupOrder(arrayofGroupIDs) Sort the group by group IDs. Only the IDs mentioned in parameter are sorted and others will remain in the same order.
removeItem(groupId, itemId) Removes the item mentioned from the specific group.
removeGroup(groupId) Removes the specific group from the list by passing the group ID.
getListData() Get bookmarked list data for the active user.
reload() Does a refresh of the bookmarked list with updated bookmarked data.
isItemPresent(groupId, itemId) Returns true if the item is present inside a group ID. If not, returns false.

Bookmark register service

Use this service to register the item or group for a bookmark component. User should be logged in to register an item in the bookmark.

Notepad.png

Note: At the least any one of the CUI components should be present in the DOM to register the item in the bookmark list.

An example for registering a bookmark is as follows:

aceLib.bookmark.addGroup({id:'test',displayTitle:'Group 1'});

Following are the methods available in the bookmark library:

Methods Description
addGroup Add a new group in the list.
  • Syntax: addGroup({id, displayTitle})
  • id: Group ID where the user wants to add the item. This value is Mandatory.
  • displayTitle: Displays the value of the group
  • updateGroup Update the group information.
  • Syntax: updateGroup({id, displayTitle})
  • id: Group ID where the user wants to update the item. This value is Mandatory.
  • displayTitle: Displays the value of the group
  • removeGroup Removes the group from the list by passing the group ID.
  • Syntax: removeGroup(id)
  • id: Group ID where the user wants to remove the item. This value is Mandatory.
  • addItem Add an item to the bookmark list corresponding to a group ID.
  • Syntax: addItem({groupId, id, displayTitle, category, value})
  • id: item ID. This value is Mandatory.
  • groupId: Group ID where the user wants to add the item. This value is Mandatory.
  • displayTitle: Displays the value of the item.
  • category: Type of item. It can be Record, Report or user-defined type.
  • value: Value of the item.
  • updateItem Update the bookmark list item.
  • Syntax: updateItem({groupId, id, displayTitle, category, value})
  • id: item ID. This value is Mandatory.
  • groupId: Group ID where the user wants to add the item. This value is Mandatory.
  • displayTitle: Displays the value of the item.
  • category: Type of item. It can be Record, Report or user-defined type.
  • value: Value of the item.
  • removeItem Remove an item from the bookmark list corresponding to the group ID.
  • Syntax: removeItem(groupId, id)
  • groupId: Group ID where the user wants to delete the item. This value is Mandatory. If the group ID is not a match with an existing group, then it throws an error message.
  • id: ID of the item to delete. This value is Mandatory.
  • refresh Refresh the bookmark list.
  • Syntax: aceLib.bookmark.refresh();
  • Note: Some considerations are as follows:

    • Any white-spaces present are removed (trimmed) from groupIds and itemIds. For example, if you pass the ID as "Agile apps", then it is converted to "Agileapps".
    • All the IDs are considered as case-sensitive. For example, if you pass the ID as "agileapps" and "Agileapps", then both are considered as separate IDs.

    Sample code

    <a id="selection-change"></a>

    selectionchange

    html
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    const bookmarkIns = document.querySelector('#aceBookmarksList');
    bookmarkIns.addEventListener('selectionchange', function (event) {
     //Perform your action here
     const bookmarkItemData = event['detail'];
     console.log(bookmarkItemData);
    });
    


    Response

    javascript
    {
    	id: string,
    	groupId: string,
    	displayTitle: string,
    	category: string,
    	value:string
    }
    

    <a id="load"></a>

    load

    html
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    const bookmarkIns = document.querySelector('#aceBookmarksList');
    bookmarkIns.addEventListener('load', (event) => {
    	console.log(event['detail'])
    });
    

    Response

    javascript
    [
        {
            displayTitle: "Case Records",
            groupId: "caseRecord",
            items: [{
                displayTitle: "Record name",
                id: "123456",
    			category: "record",
                value: "storted value data"
                },
                {...},
                {...}
            ]
        },
        {...},
        {...}
    ]
    

    <a id="clear-all-method"></a>

    clearAll

    html
    <button type="button" onclick="clearAllHandler()">Clear all</button>
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    function clearAllHandler(){
    	const bookmarkListIns = document.querySelector('#aceBookmarksList');
    	bookmarkListIns.clearAll();
    }
    

    <a id="set-group-order-method"></a>

    setGroupOrder

    html
    <button type="button" onclick="setGroupOrderHandler()">Set Group Order</button>
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    function setGroupOrderHandler(){
    	const bookmarkListIns = document.querySelector('#aceBookmarksList');
    	const listOfGroupIds = ['caseRecord','reports','dashboard'];
    	bookmarkListIns.setGroupOrder(listOfGroupIds);
    }
    

    <a id="remove-item-method"></a>

    removeItem

    html
    <button type="button" onclick="removeItemHandler()">Remove Item</button>
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    function removeItemHandler(){
    	const bookmarkListIns = document.querySelector('#aceBookmarksList');
    	bookmarkListIns.removeItem('caseRecord','recordId');
    }
    

    <a id="remove-group-method"></a>

    removeGroup

    html
    <button type="button" onclick="removeGroupHandler()">Remove Group</button>
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    function removeGroupHandler(){
    	const bookmarkListIns = document.querySelector('#aceBookmarksList');
    	bookmarkListIns.removeGroup('caseRecord');
    }
    

    <a id="get-list-data-method"></a>

    getListData

    html
    <button type="button" onclick="getListDataHandler()">Get bookmark list data</button>
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    function getListDataHandler(){
    	const bookmarkListIns = document.querySelector('#aceBookmarksList');
    	bookmarkListIns.getListData();
    }
    

    <a id="reload-method"></a>

    reload

    html
    <button type="button" onclick="reloadHandler()">Reload list</button>
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    function reloadHandler(){
    	const bookmarkListIns = document.querySelector('#aceBookmarksList');
    	bookmarkListIns.reload();
    }
    

    <a id="is-item-present"></a>

    isItemPresent

    html
    <button type="button" onclick="isItemPresentHandler()">Is Item Present</button>
    <ace-bookmark-list id="aceBookmarksList"></ace-bookmark-list>
    
    javascript
    function isItemPresentHandler(){
    	const bookmarkListIns = document.querySelector('#aceBookmarksList');
    	const isItemPresent = bookmarkListIns.isItemPresentHandler('caseRecord','recordId');
    }
    


    <a id="registerService"></a>

    registerService

    javascript
    //Add Group data
    const addGroupInfo = {
        id: 'caseRecord',
        displayTitle: 'Case Record'
    };
    aceLib.bookmark.addGroup(addGroupInfo);
     
    //Update Group display title
    const updateGroupInfo = {
        id: 'caseRecord',
        displayTitle: 'Update Case Record'
    };
    aceLib.bookmark.updateGroup(updateGroupInfo);
     
    // Add Item inside above group
    const addItemInfo = {
     groupId: 'caseRecord',
     id: 'recordId',
     displayTitle: 'Record title',
     category: 'record',
     value: 'http://agileappscloud.info/'
    };
    aceLib.bookmark.addItem(addItemInfo);
     
    // Update Item data
    const updateItemInfo = {
     groupId: 'caseRecord',
     id: 'recordId',
     displayTitle: 'Update Record title'
    };
    aceLib.bookmark.updateItem(updateItemInfo);
     
    // remove item from a group
    aceLib.bookmark.removeItem('caseRecord','recordId');
     
    //remove group
    aceLib.bookmark.removeGroup('caseRecord');
    

    Important Note: Only the properties mentioned here are supported.



    ace-record-attachment

    Overview

    This component allows you to add attachments to a record and to display the attached files. It also displays the list of files attached through the Notes Editor component.
    Selector: <ace-record-attachment>
    Use the following code to render the component:

    html
    <ace-record-attachment id="recordAttachmentRef" object-id="cases" record-id="23232234">
    </ace-record-attachment>