Skip to content

Commit

Permalink
🐛 fix(angular): use EventEmitter again (#1077)
Browse files Browse the repository at this point in the history
* fix(angular): use EventEmitter again

* chore: format files
  • Loading branch information
hirsch88 authored Oct 19, 2023
1 parent 0ebe5fd commit b468abd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-months-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/design-system-components-angular': patch
---

Utilize an Angular EventEmitter for output instead of RX.JS fromEvent, as it tends to trigger events twice
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ export class DataValue {
*/
@Event() balBlur!: EventEmitter<BalEvents.BalDataValueBlurDetail>

onClickHandler(ev: MouseEvent) {
this.balClick.emit(ev)
private onClickHandler = (ev: MouseEvent) => {
const input = this.el.querySelector('bal-input')
if (!isNil(input)) {
input.setFocus()
}

this.balClick.emit(ev)
}

render() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
/* tslint:disable */
import { fromEvent } from 'rxjs'
import { EventEmitter } from '@angular/core'

export const proxyInputs = (Cmp: any, inputs: string[]) => {
const Prototype = Cmp.prototype
Expand Down Expand Up @@ -28,8 +28,8 @@ export const proxyMethods = (Cmp: any, methods: string[]) => {
})
}

export const proxyOutputs = (instance: any, el: any, events: string[]) => {
events.forEach(eventName => (instance[eventName] = fromEvent(el, eventName)))
export const proxyOutputs = (instance: any, _el: any, events: string[]) => {
events.forEach(eventName => (instance[eventName] = new EventEmitter()))
}

export const defineCustomElement = (tagName: string, customElement: any) => {
Expand Down

0 comments on commit b468abd

Please sign in to comment.