Skip to content

Commit 8e997c9

Browse files
authored
add blur events to fabric text field components (#98)
Continuing work done in #83 by @MarcOne68
1 parent 1d94ddc commit 8e997c9

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

libs/fabric/src/lib/components/text-field/base-text-field.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ export class FabBaseTextFieldComponent extends ReactWrapperComponent<ITextFieldP
6565
@Input() renderPrefix?: InputRendererOptions<ITextFieldProps>;
6666
@Input() renderSuffix?: InputRendererOptions<ITextFieldProps>;
6767

68-
@Output() readonly onFocus = new EventEmitter<FocusEvent>();
6968
@Output() readonly onClick = new EventEmitter<MouseEvent>();
69+
@Output() readonly onFocus = new EventEmitter<FocusEvent>();
70+
@Output() readonly onBlur = new EventEmitter<Event>();
7071

7172
@Output() readonly onChange = new EventEmitter<{ event: Event; newValue?: string }>();
7273
@Output() readonly onBeforeChange = new EventEmitter<{ newValue: any }>();
@@ -104,9 +105,12 @@ export class FabBaseTextFieldComponent extends ReactWrapperComponent<ITextFieldP
104105
this.onFocus.emit(ev && ev.nativeEvent);
105106
}
106107

108+
onBlurHandler(ev?: React.SyntheticEvent) {
109+
this.onBlur.emit(ev && ev.nativeEvent);
110+
}
111+
107112
onChangeHandler(event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) {
108113
this.onChange.emit({ event: event.nativeEvent, newValue });
109-
110114
this.valueChange.emit(newValue);
111115
}
112116

libs/fabric/src/lib/components/text-field/masked-text-field.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { FabBaseTextFieldComponent } from './base-text-field.component';
6060
[NotifyValidationResult]="onNotifyValidationResultHandler"
6161
(onClick)="onClickHandler($event)"
6262
(onFocus)="onFocusHandler($event)"
63+
(onBlur)="onBlurHandler($event)"
6364
>
6465
</MaskedTextField>
6566
`,

libs/fabric/src/lib/components/text-field/text-field.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { FabBaseTextFieldComponent } from './base-text-field.component';
6060
[NotifyValidationResult]="onNotifyValidationResultHandler"
6161
(onClick)="onClickHandler($event)"
6262
(onFocus)="onFocusHandler($event)"
63+
(onBlur)="onBlurHandler($event)"
6364
>
6465
</TextField>
6566
`,

0 commit comments

Comments
 (0)