mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
fixed issue with hostwindowservice, search filter bug, changed sidebar toggle text to pin, fixed mobile view of header
This commit is contained in:
@@ -5,8 +5,10 @@ import { MenuID } from '../../shared/menu/initial-menus-state';
|
||||
import { MenuSection } from '../../shared/menu/menu.reducer';
|
||||
import { first, map } from 'rxjs/operators';
|
||||
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
||||
import { hasValue } from '../empty.util';
|
||||
import { MenuSectionComponent } from './menu-section/menu-section.component';
|
||||
import { getComponentForMenu } from './menu-section.decorator';
|
||||
import Timer = NodeJS.Timer;
|
||||
|
||||
/**
|
||||
* A basic implementation of a MenuComponent
|
||||
@@ -56,6 +58,11 @@ export class MenuComponent implements OnInit {
|
||||
*/
|
||||
changeDetection: ChangeDetectionStrategy.OnPush;
|
||||
|
||||
/**
|
||||
* Timer to briefly delay the sidebar preview from opening or closing
|
||||
*/
|
||||
private previewTimer: Timer;
|
||||
|
||||
constructor(protected menuService: MenuService, protected injector: Injector) {
|
||||
}
|
||||
|
||||
@@ -108,7 +115,7 @@ export class MenuComponent implements OnInit {
|
||||
*/
|
||||
expandPreview(event: Event) {
|
||||
event.preventDefault();
|
||||
this.menuService.expandMenuPreview(this.menuID);
|
||||
this.previewToggleDebounce(() => this.menuService.expandMenuPreview(this.menuID), 100);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +124,20 @@ export class MenuComponent implements OnInit {
|
||||
*/
|
||||
collapsePreview(event: Event) {
|
||||
event.preventDefault();
|
||||
this.menuService.collapseMenuPreview(this.menuID);
|
||||
this.previewToggleDebounce(() => this.menuService.collapseMenuPreview(this.menuID), 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* delay the handler function by the given amount of time
|
||||
*
|
||||
* @param {Function} handler The function to delay
|
||||
* @param {number} ms The amount of ms to delay the handler function by
|
||||
*/
|
||||
private previewToggleDebounce(handler: () => void, ms: number): void {
|
||||
if (hasValue(this.previewTimer)) {
|
||||
clearTimeout(this.previewTimer);
|
||||
}
|
||||
this.previewTimer = setTimeout(handler, ms);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user