Skip to content

Commit

Permalink
Emit cancel event
Browse files Browse the repository at this point in the history
  • Loading branch information
monroepe committed Oct 2, 2024
1 parent 5f1c887 commit e599eee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class NovoTabbedGroupPickerElement implements OnDestroy, OnInit {
@Output() activation = new EventEmitter<any>();
@Output() selectionChange = new EventEmitter<TabbedGroupPickerTab[]>();
@Output() applyChange: EventEmitter<any> = new EventEmitter<any>();
@Output() cancelChange: EventEmitter<any> = new EventEmitter<any>();

displayTabs: TabbedGroupPickerTab[];
displayTabIndex: number = 0;
Expand Down Expand Up @@ -373,7 +374,7 @@ export class NovoTabbedGroupPickerElement implements OnDestroy, OnInit {

cancel() {
this.revertState();
this.emitSelectedValues();
this.cancelChange.emit(this.getSelectedValues());
this.ref.markForCheck();
this.dropdown.closePanel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[quickSelectConfig]="example_quickSelectConfig"
[buttonConfig]="example_buttonConfig"
(selectionChange)="onSelectionChange($event)"
(cancelChange)="onCancelChange($event)"
[showFooter]="true"
></novo-tabbed-group-picker>
<div class="selected-data-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export class TabbedGroupPickerFooterExample {
this.example_buttonConfig.label = this.buildButtonLabel();
}

onCancelChange(selectedData: TabbedGroupPickerTab[]) {
this.onSelectionChange(selectedData);
}

buildButtonLabel(): string {
return this.selectedAnimals.length ? `Animals (${this.selectedAnimals.length})` : 'Nothing Selected';
}
Expand Down

0 comments on commit e599eee

Please sign in to comment.