refactor(theme-shared): change button outputs and use click.stop directive

pull/2215/head
thediaval 6 years ago
parent 7d85c6c59a
commit 044a2a3f51

@ -11,9 +11,9 @@ import { ABP } from '@abp/ng.core';
[attr.type]="buttonType"
[ngClass]="buttonClass"
[disabled]="loading || disabled"
(click)="onClick($event)"
(focus)="onFocus($event)"
(blur)="onBlur($event)"
(click.stop)="click.next($event); abpClick.next($event)"
(focus)="focus.next($event); abpFocus.next($event)"
(blur)="blur.next($event); abpBlur.next($event)"
>
<i [ngClass]="icon" class="mr-1"></i><ng-content></ng-content>
</button>
@ -41,15 +41,39 @@ export class ButtonComponent implements OnInit {
@Input()
attributes: ABP.Dictionary<string>;
/*
*
*
* @deprecated use abpClick instead
*/
// tslint:disable-next-line: no-output-native
@Output() readonly click = new EventEmitter<MouseEvent>();
/*
*
*
* @deprecated use abpFocus instead
*/
// tslint:disable-next-line: no-output-native
@Output() readonly focus = new EventEmitter<FocusEvent>();
/*
*
*
* @deprecated use abpBlur instead
*/
// tslint:disable-next-line: no-output-native
@Output() readonly blur = new EventEmitter<FocusEvent>();
// tslint:disable-next-line: no-output-native
@Output() readonly abpClick = new EventEmitter<MouseEvent>();
// tslint:disable-next-line: no-output-native
@Output() readonly abpFocus = new EventEmitter<FocusEvent>();
// tslint:disable-next-line: no-output-native
@Output() readonly abpBlur = new EventEmitter<FocusEvent>();
@ViewChild('button', { static: true })
buttonRef: ElementRef<HTMLButtonElement>;
@ -66,19 +90,4 @@ export class ButtonComponent implements OnInit {
});
}
}
onClick(event: MouseEvent) {
event.stopPropagation();
this.click.next(event);
}
onFocus(event: FocusEvent) {
event.stopPropagation();
this.focus.next(event);
}
onBlur(event: FocusEvent) {
event.stopPropagation();
this.blur.next(event);
}
}

Loading…
Cancel
Save