/** * Icon class provide icons for all Graphical Controls. It is expanding Core Component for that. *
{
* name: 'home';
* type: 'mi';
* size: '24px';
* color: {
* foreground: '#197fa5',
* background: 'transparent'
* }
* }
*/
export class IconModel {
/**
* It is name of icon. Default is home. Optional.
*Next icons libraries are available:
* * *If icon name consists of more then one word, then:
*- for Material Icons: join words with underscore (like: thumb_up)
*- for Font Awesome Icons: join words with dash (like: fa-address-book)
*/ name?: string = 'home'; /** *It is type of icon. Optional, but must be set with icon name together.
*Types are: mi (Material Icons) and fa (Font Awesome Icons). Default is mi type.
*/ type?: string = 'mi'; /** *Display or hide the icon.
*/ display?:boolean = true; /** * It is icon size. Optional. Can be in pixels, em, percetages. Default is 24px. */ size?: string = '24px'; /** *The value to be emitted in case of a toggle icon on click.
*/ value?: any; toggle?: { /** *It is name of icon. Default is home. Optional.
*Next icons libraries are available:
* * *If icon name consists of more then one word, then:
*- for Material Icons: join words with underscore (like: thumb_up)
*- for Font Awesome Icons: join words with dash (like: fa-address-book)
*/ name?: string; /** *It is type of icon. Optional, but must be set with icon name together.
*Types are: mi (Material Icons) and fa (Font Awesome Icons). Default is mi type.
*/ type?: string; /** * It is icon size. Optional. Can be in pixels, em, percetages. Default is 24px. */ size?: string; /** *The value to be emitted in case of a toggle icon on click.
*/ value?: any; } /** * It is icon constructor, which take string values from Icon Component and create Icon object. */ constructor(values: Object = {}) { Object.assign(this, values); if(this.size!=null) if(!this.size.endsWith("px") && !this.size.endsWith("%")) this.size = this.size + "%"; if(this.name.startsWith("fa-")) this.type = "fa"; else this.type = "mi"; if(this.toggle!=null) { if(this.toggle.name.startsWith("fa-")) this.toggle.type = "fa"; else this.toggle.type = "mi"; } } }