Skip to content

Commit

Permalink
fix touched
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo200206 committed May 11, 2024
1 parent 9d82a05 commit b5fe5d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 26 additions & 5 deletions src/app/components/treeselect/treeselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export const TREESELECT_VALUE_ACCESSOR: any = {
[attr.id]="inputId"
readonly
[disabled]="disabled"
(focus)="onFocus()"
(blur)="onBlur()"
(focus)="onInputFocus($event)"
(blur)="onInputBlur($event)"
(keydown)="onKeyDown($event)"
[attr.tabindex]="!disabled ? tabindex : -1"
[attr.aria-controls]="overlayVisible ? listId : null"
Expand Down Expand Up @@ -437,6 +437,7 @@ export class TreeSelect implements AfterContentInit {
* @group Emits
*/
@Output() onNodeCollapse: EventEmitter<TreeSelectNodeCollapseEvent> = new EventEmitter<TreeSelectNodeCollapseEvent>();

/**
* Callback to invoke when the overlay is shown.
* @param {Event} event - Browser event.
Expand All @@ -459,6 +460,18 @@ export class TreeSelect implements AfterContentInit {
* @group Emits
*/
@Output() onFilter: EventEmitter<TreeFilterEvent> = new EventEmitter<TreeFilterEvent>();
/**
* Callback to invoke when treeselect gets focus.
* @param {Event} event - Browser event.
* @group Emits
*/
@Output() onFocus: EventEmitter<Event> = new EventEmitter<Event>();
/**
* Callback to invoke when treeselect loses focus.
* @param {Event} event - Browser event.
* @group Emits
*/
@Output() onBlur: EventEmitter<Event> = new EventEmitter<Event>();
/**
* Callback to invoke when a node is unselected.
* @param {TreeNodeUnSelectEvent} event - node unselect event.
Expand Down Expand Up @@ -912,17 +925,25 @@ export class TreeSelect implements AfterContentInit {
this.focusInput?.nativeElement.focus();
}
}

t
onUnselect(event: TreeNodeUnSelectEvent) {
this.onNodeUnselect.emit(event);
}

onFocus() {
onInputFocus(event: Event) {
if (this.disabled) {
// For ScreenReaders
return;
}

this.focused = true;
this.onFocus.emit(event);
}

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

writeValue(value: any): void {
Expand Down

0 comments on commit b5fe5d1

Please sign in to comment.