import { Component, OnInit, Input } from '@angular/core'; import { NotificationModel } from 'cedrus-project-fusion'; import { IconModel } from 'cedrus-project-fusion'; import { IconStylingModel } from 'cedrus-project-fusion'; import { ButtonModel } from 'cedrus-project-fusion'; import { ButtonStylingModel } from 'cedrus-project-fusion'; import { SelectableModel } from 'cedrus-project-fusion'; import { Themes } from 'cedrus-project-fusion'; @Component({ moduleId: module.id, selector: 'cf-demo-button-1', templateUrl: './demo.button-1.html', styleUrls: ['./demo.button-1.scss'] }) export class CfDemoButton1 implements OnInit { title = "DemoButton"; @Input() themeName = ""; themes: string[]; isShown: Boolean = false; isDisabled: Boolean = true; wait: boolean = false; disable: boolean = false; icon1 = new IconModel ({ name: "thumb_up", type: "mi", size: "30px" }); button1 = new ButtonModel ({ label: "", iconProperty: this.icon1, iconPosition:"right" }); buttonStyle1 = new ButtonStylingModel ({ iconStyling : new IconStylingModel ({ icon: { class:"thumb" } }), button:{ class:"button1" } }); icon3 = new IconModel ({ name: "pets", type: "mi", size: "20px" }); button3= new ButtonModel ({ label: "BTN3", iconProperty: this.icon3, iconPosition:"left", }); buttonStyle3 = new ButtonStylingModel({ iconStyling: new IconStylingModel ({ icon: { class:"icon3" } }), button:{ class:"button3", themeColor: "accent" } }); icon2= new IconModel ({ name: "fa-bell", type: "fa", size: "20px" }); button2= new ButtonModel ({ label: "BTN2", iconProperty: this.icon2, iconPosition:"right" }); buttonStyle2 = new ButtonStylingModel({ button:{ class:"button2" } }); waiting: Array = [false, false]; waitButtonMessages: Array = []; waitingIcon = new IconModel ({ name: "fa-spinner", type: "fa", size: "20px" }); button4= new ButtonModel ({ label: "Button with waiting", iconProperty: this.icon3, iconPosition:"right", waiting: { value: this.wait, disabled: this.disable, iconProperty: this.waitingIcon } }); waitingCheckbox = new SelectableModel ({ value: true, item: 'Toggle waiting' }); disableCheckbox = new SelectableModel ({ value: true, item: 'Toggle disable' }); constructor() { } ngOnInit() { this.themes = ["","cf-red-theme","cf-blue-theme","cf-green-theme"]; } function1(): void { alert('This is Button 1 speaking...'); } function2(): void { alert('This is Button 2 speaking...'); } function3(): void { alert('This is Button 3 speaking...'); } waitEvents(e): void { switch (e.cfIndex) { case 0: this.button4.waiting.value = e.cfState; break; case 1: this.button4.waiting.disabled = e.cfState; break; } } waitButtonLogs(): void { if(this.button4.waiting.value) this.waitButtonMessages.push("I'm active in waiting state"); else this.waitButtonMessages.push("I'm active"); } letters = 0; myNotifications: NotificationModel = { value: this.letters, classes: 'mat-accent', position: 'top-right' }; sender = new ButtonModel({ label: "Send mail" }); sendMessage() { ++this.myNotifications.value; } }