Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/primefaces/primeng
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Dec 6, 2023
2 parents cc739b0 + ee19ce6 commit 6adce47
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/app/components/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ export const CHECKBOX_VALUE_ACCESSOR: any = {
[value]="value"
[attr.name]="name"
[checked]="checked()"
(focus)="onInputFocus($event)"
(blur)="onInputBlur($event)"
(change)="handleChange($event)"
[disabled]="disabled"
[attr.tabindex]="tabindex"
[disabled]="disabled"
[readonly]="readonly"
[attr.required]="required"
[attr.aria-labelledby]="ariaLabelledBy"
[attr.aria-label]="ariaLabel"
[attr.aria-checked]="checked()"
(focus)="onFocus()"
(blur)="onBlur()"
[attr.data-pc-section]="'hiddenInput'"
/>
</div>
Expand Down Expand Up @@ -182,6 +184,18 @@ export class Checkbox implements ControlValueAccessor {
* @group Emits
*/
@Output() onChange: EventEmitter<CheckboxChangeEvent> = new EventEmitter();
/**
* Callback to invoke when the receives focus.
* @param {Event} event - Browser event.
* @group Emits
*/
@Output() onFocus: EventEmitter<Event> = new EventEmitter<Event>();
/**
* Callback to invoke when the loses focus.
* @param {Event} event - Browser event.
* @group Emits
*/
@Output() onBlur: EventEmitter<Event> = new EventEmitter<Event>();

@ViewChild('input') inputViewChild: Nullable<ElementRef>;

Expand Down Expand Up @@ -234,13 +248,15 @@ export class Checkbox implements ControlValueAccessor {
}
}

onFocus() {
onInputFocus(event: Event) {
this.focused = true;
this.onFocus.emit();
}

onBlur() {
onInputBlur(event: Event) {
this.focused = false;
this.onModelTouched();
this.onBlur.emit();
}

writeValue(model: any): void {
Expand Down

0 comments on commit 6adce47

Please sign in to comment.