|
|
|
|
import { Component, OnInit, Input, Output, EventEmitter, Directive, ElementRef, HostListener } from '@angular/core';
|
|
|
|
|
import { ButtonSettings } from './models/button-settingsl';
|
|
|
|
|
import { TranslatorService } from '../../services/translator/translator.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-button',
|
|
|
|
|
templateUrl: './button.component.html',
|
|
|
|
|
styleUrls: ['./button.component.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class ButtonComponent implements OnInit {
|
|
|
|
|
constructor() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
@Input() icon: string;
|
|
|
|
|
@Input() title: string;
|
|
|
|
|
@Output() trigger = new EventEmitter();
|
|
|
|
|
@Input() settings: ButtonSettings;
|
|
|
|
|
public direction: string;
|
|
|
|
|
public style: any;
|
|
|
|
|
@Input() disabled = false;
|
|
|
|
|
constructor(
|
|
|
|
|
public ts: TranslatorService
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.direction = TranslatorService.getCurrentDirection();
|
|
|
|
|
if (this.settings) {
|
|
|
|
|
this.style =
|
|
|
|
|
{
|
|
|
|
|
'border-top-left-radius': this.isEnabled(this.settings.topLeft),
|
|
|
|
|
'border-top-right-radius': this.isEnabled(this.settings.topRight),
|
|
|
|
|
'border-bottom-right-radius': this.isEnabled(this.settings.bottomRight),
|
|
|
|
|
'border-bottom-left-radius': this.isEnabled(this.settings.bottomLeft)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private isEnabled(enabled: boolean): string {
|
|
|
|
|
return enabled ? '30px' : '0px';
|
|
|
|
|
}
|
|
|
|
|
public onClicked() {
|
|
|
|
|
if (!this.disabled) {
|
|
|
|
|
this.trigger.emit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Directive({ selector: '[modal]' })
|
|
|
|
|
export class Modal implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor(private elRef: ElementRef) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
console.log(' on initialization');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMouseEnter() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@HostListener('click', ['$event'])
|
|
|
|
|
onClick(event: any) {
|
|
|
|
|
alert('click');
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|