Skip to content

Commit

Permalink
refactor(theme-shared): change button outputs and use click.stop dire…
Browse files Browse the repository at this point in the history
…ctive
  • Loading branch information
thediaval committed Nov 19, 2019
1 parent 7d85c6c commit 044a2a3
Showing 1 changed file with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>;

Expand All @@ -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);
}
}

0 comments on commit 044a2a3

Please sign in to comment.