Component Development API Guide
This is an ad hoc API dictionary for development of components.
Created May/June 2019 by pdexter.
Tokens used in Component HTML
Token | Description |
---|---|
{{::fieldName}} | Name of the field. |
{{:fieldValue}} | Value of the field. |
{{::key}} | --unknown-- |
{{tplItem.property}} | Value of a configuration property from the template. |
scope
"scope" is an object that is available under the Load function and the Watch function ??
Property | Type | Description |
---|---|---|
controlWidth | string | CSS classnames defining the width of this field on the page, eg md2 |
doc | object | Document currently open |
fieldName | string | Name of the field. |
fieldValue | undefined | Value of the field. |
readOnly | boolean | Whether the field is read only (not enabled). |
tpl | object | Template of the document. |
tplId | string | Document ID of the Template. |
tplItem | object | Template configuration item corresponding to the field. (may be derived from tpl.component[fieldName] ) |
urlBasePath | string | --unknown-- |
document
The document object is available in the Server Preprocessor Function.
It will reflect the current document object, eg including systemHeader, fields, etc.
field
The field object is available in the Server Preprocessor Function.
It reflects the field configuration as configured in the template.
Core Functions
The core makes a number of functions available to a component. This section lists some of them.
SearchServiceProvider
Provides Elastic Search functions
Example:
var SearchServiceProvider = $injector.get('SearchServiceProvider');
var searchService = SearchServiceProvider.getInstance();
SearchService contains the elastic search function.
To use the function:
searchService.search(searchOptions).then(function(result){
....
})
searchOptions is an object with the following properties:
Property | Type | Description |
---|---|---|
filter | object | elastic search filter object |
sourceFilter | object | Object containing the include property |
sourceFilter.include | array | contains field names to be included in the elastic search result |
from | number | start of elastic page. |
pageSize | boolean | number of results to return. |
searchService returns a javascript promise
NotificationService
Provides Notification function
Example:
var NotificationService = $injector.get('NotificationService');
To use the function:
NotificationService.printMessage(message, status);
Part | Description |
---|---|
message | text to display |
status | mode/state of the notification |
values: 'error', 'info', 'success', "warning', 'forbidden' |
If status is not passed, 'info' is used
LoggedInUserService
Example
var loggedInUser = LoggedInUserService.user
returns an object with the following properties:
Property | Description |
---|---|
welcomeMsg | Text displayed in the top right corner of the framework |
account | Logged in users account document |
filteredAccount | Logged in users account without the menu |
menu | Menu from the logged in users account document |
publicAccount | Whether the current user is logged in as public account |
accountPublicURL | URL of the public account |
accountControlDocument | Logged in users account control document |
ConfigService
Example
var ConfigService = $injector.get("ConfigService");
var clientConfig = ConfigService.clientConfig()
Returns the clientConfiguration object from the Configuration document
Using Angular Service Components
Angular service components can be referenced in the following way (example):
var $timeout = $injector.get('$timeout');
Angular service components reference : https://docs.angularjs.org/api/ng/service