- Global Methods
- UIApplication
- UIHttpService
- UIModel
- UIValidationStrategy
- UIConverters
- UIFormat
- UIEvent
- UIUtils
// Global Constants Object attached to Window
Constants = {}
// check true using regex `/^(true|yes|1|y|on)$`
window.isTrue(?)
// undefined | null | array.length=0 | empty object | empty string
window.isEmpty(?)
window.isFunction(?)
// Get DOM Parent by TagName
window.getParentByTag(element:Element, selector:string):HTMLElement
// Get DOM Parent by ClassName, stop when parent class-name contains `lastElement`
window.getParentByClass(element:Element, selector:string, lastElement?:string):HTMLElement
Singleton class for application level settings and methods
/**
* Usage
*/
import {UIApplication} from "aurelia-ui-framework";
@inject(UIApplication)
export class AppClass {
constructor(appState) {
...
}
}
/**
* Properties
*/
AppConfig:Object
HttpConfig:Object
// Boolean indicator set/unset by the HttpService
IsHttpInUse:boolean
IsAuthenticated:boolean
// Authorization user and password for Basic Authentication header
AuthUser:string
AuthToken:string
Username:string
UserGroup:string
UserGroupLabel:string
/**
* Methods
*/
// Route navigation
navigate(hash)
navigateTo(route, params)
// Toast notifications
toast({
icon:string,
message:string,
theme:string, // primary | info | danger | success | warning
extraClass:string,
autoHide:boolean
})
// Storage
session(key, value?) // session storage, if value is null it will be deleted
persist(key, value?) // local storage, if value is null it will be deleted
clearSession()
// Logging
info(tag, message, ...args?)
warn(tag, message, ...args?)
debug(tag, message, ...args?)
error(tag, message, ...args?)
/**
* Usage
*/
import {UIHttpService} from "aurelia-ui-framework";
@inject(UIHttpService)
export class AppClass {
constructor(httpService) {
...
}
}
/**
* Methods
*/
get(api-route):Promise
post(api-route, json-body):Promise
put(api-route, json-body):Promise
delete(api-route):Promise
MarkdownValueConverter
<div>${markdownText | markdown}</div>
DateValueConverter
<div>${value | date:'format?'}</div>
FromNowValueConverter
<div>${value | formNow}</div>
NumberValueConverter
<div>${value | number:'format?'}</div>
CurrencyValueConverter
<div>${value | currency:'symbol?':'format?'}</div>
PercentValueConverter
<div>${value | percent}</div>
JsonValueConverter
<div>${value | json}</div>
KeysValueConverter
<div repeat.for="key of object | keys"></div>
SortValueConverter
<div repeat.for="key of object | sort:'property'"></div>
IsTrueValueConverter
<div if.bind="value | isTrue"></div>
IsFalseValueConverter
<div if.bind="value | isFalse"></div>
IsStringValueConverter
<div if.bind="value | isString"></div>
IsObjectValueConverter
<div if.bind="value | isObject"></div>
IsArrayValueConverter
<div if.bind="value | isArray"></div>
// parse markdown text into HTML markup, uses marked js library
UIFormat.toHTML(markdown):string
// format a date|date string|moment object, default format 'DD MMM YYYY hh:mm A'
UIFormat.date(value,format?):string
// format a date|date string|moment object using the `fromNow` method in moment
UIFormat.dateToISO(value):string
// format a date|date string|moment object, default format 'DD MMM YYYY hh:mm A'
UIFormat.fromNow(value):string
// format a number using the numeral js library, default format '0,0[.]00'
UIFormat.number(value,format?):string
// format a number using the numeral js library, default symbol '$', default format '$ 0,0[.]00'
UIFormat.currency(value,symbol?,format?):string
// format a number into percentage using the numeral js library
UIFormat.percent(value):string
// fire an event
UIEvent.fireEvent(event,target,data?):boolean
// broadcast an event using `Aurelia.EventAggregator`
UIEvent.broadcast(event,data)
// subscribe to custom events, returns `Aurelia.Subscription`
UIEvent.subscribe(event,callback):Subscription
// observe for property changes, returns `Aurelia.PropertyObserver`
UIEvent.observe(object,property):PropertyObserver
// set the container on app startup to support lazy loading
UIUtils.setContainer(container)
// Lazy load class of type T, return instance of T
UIUtils.lazy(T):<T>
// Convert all latin alphabets into ascii equivalent alphabet
UIUtils.getAscii(string):string