Merge pull request #2145 from dpalou/MOBILE-3187
MOBILE-3187 myoverview: Fix keyboard flicker on filtermain
commit
fb5c9576b4
|
@ -9,7 +9,7 @@
|
|||
<ion-spinner *ngIf="!prefetchCoursesData[selectedFilter].icon || prefetchCoursesData[selectedFilter].icon == 'spinner'"></ion-spinner>
|
||||
</div>
|
||||
<core-context-menu item-end>
|
||||
<core-context-menu-item *ngIf="loaded && showFilterSwitchButton()" [priority]="1000" [content]="'core.courses.filtermycourses' | translate" (action)="switchFilter()" iconAction="funnel"></core-context-menu-item>
|
||||
<core-context-menu-item *ngIf="loaded && showFilterSwitchButton()" [priority]="1000" [content]="'core.courses.filtermycourses' | translate" (action)="switchFilter()" iconAction="funnel" (onClosed)="switchFilterClosed()"></core-context-menu-item>
|
||||
<core-context-menu-item *ngIf="loaded && showSortFilter" [priority]="900" content="{{('core.sortby' | translate) + ' ' + ('addon.block_myoverview.title' | translate)}}" (action)="switchSort('fullname')" [iconAction]="sort == 'fullname' ? 'radio-button-on' : 'radio-button-off'"></core-context-menu-item>
|
||||
<core-context-menu-item *ngIf="loaded && showSortFilter" [priority]="800" content="{{('core.sortby' | translate) + ' ' + ('addon.block_myoverview.lastaccessed' | translate)}}" (action)="switchSort('lastaccess')" [iconAction]="sort == 'lastaccess' ? 'radio-button-on' : 'radio-button-off'"></core-context-menu-item>
|
||||
</core-context-menu>
|
||||
|
|
|
@ -334,10 +334,16 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
|||
this.showFilter = !this.showFilter;
|
||||
this.courses.filter = '';
|
||||
this.filteredCourses = this.courses[this.showFilter ? 'all' : this.selectedFilter];
|
||||
}
|
||||
|
||||
/**
|
||||
* Popover closed after clicking switch filter.
|
||||
*/
|
||||
switchFilterClosed(): void {
|
||||
if (this.showFilter) {
|
||||
setTimeout(() => {
|
||||
this.searchbar.setFocus();
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,12 +51,14 @@ export class CoreContextMenuItemComponent implements OnInit, OnDestroy, OnChange
|
|||
@Input() badgeClass?: number; // A class to set in the badge.
|
||||
@Input() hidden?: boolean; // Whether the item should be hidden.
|
||||
@Output() action?: EventEmitter<() => void>; // Will emit an event when the item clicked.
|
||||
@Output() onClosed?: EventEmitter<() => void>; // Will emit an event when the popover is closed because the item was clicked.
|
||||
|
||||
protected hasAction = false;
|
||||
protected destroyed = false;
|
||||
|
||||
constructor(private ctxtMenu: CoreContextMenuComponent) {
|
||||
this.action = new EventEmitter();
|
||||
this.onClosed = new EventEmitter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,8 +40,8 @@ export class CoreContextMenuPopoverComponent {
|
|||
/**
|
||||
* Close the popover.
|
||||
*/
|
||||
closeMenu(): void {
|
||||
this.viewCtrl.dismiss();
|
||||
closeMenu(item?: CoreContextMenuItemComponent): void {
|
||||
this.viewCtrl.dismiss(item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,12 +61,12 @@ export class CoreContextMenuPopoverComponent {
|
|||
}
|
||||
|
||||
if (item.closeOnClick) {
|
||||
this.closeMenu();
|
||||
this.closeMenu(item);
|
||||
}
|
||||
|
||||
item.action.emit(this.closeMenu.bind(this));
|
||||
} else if (item.href && item.closeOnClick) {
|
||||
this.closeMenu();
|
||||
item.action.emit(this.closeMenu.bind(this, item));
|
||||
} else if (item.closeOnClick && (item.href || item.onClosed.observers.length > 0)) {
|
||||
this.closeMenu(item);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -180,8 +180,12 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy {
|
|||
const popover = this.popoverCtrl.create(CoreContextMenuPopoverComponent,
|
||||
{ title: this.title, items: this.items, id: this.uniqueId, showBackdrop: true });
|
||||
|
||||
popover.onDidDismiss(() => {
|
||||
popover.onDidDismiss((item: CoreContextMenuItemComponent) => {
|
||||
this.expanded = false;
|
||||
|
||||
if (item) {
|
||||
item.onClosed.emit();
|
||||
}
|
||||
});
|
||||
popover.present({
|
||||
ev: event
|
||||
|
|
Loading…
Reference in New Issue