Merge remote-tracking branch 'origin/v19' into v19
# Conflicts: # src/layout/applayout.ts
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Component, Renderer2, ViewChild } from '@angular/core';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AppTopBar } from '@/src/layout/apptopbar';
|
||||
import { AppSidebar } from '@/src/layout/appsidebar';
|
||||
@@ -11,12 +10,10 @@ import { LayoutService } from '@/src/service/layout/layout.service';
|
||||
@Component({
|
||||
selector: 'app-layout',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ToastModule, AppTopBar, AppSidebar, RouterModule, AppFooter],
|
||||
imports: [CommonModule, AppTopBar, AppSidebar, RouterModule, AppFooter],
|
||||
template: `<div class="layout-wrapper" [ngClass]="containerClass">
|
||||
<app-topbar></app-topbar>
|
||||
<div class="layout-sidebar">
|
||||
<app-sidebar></app-sidebar>
|
||||
</div>
|
||||
<app-sidebar></app-sidebar>
|
||||
<div class="layout-main-container">
|
||||
<div class="layout-main">
|
||||
<router-outlet></router-outlet>
|
||||
@@ -51,20 +48,6 @@ export class AppLayout {
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.profileMenuOutsideClickListener) {
|
||||
this.profileMenuOutsideClickListener = this.renderer.listen('document', 'click', (event) => {
|
||||
const isOutsideClicked = !(
|
||||
this.appTopBar.menu.nativeElement.isSameNode(event.target) ||
|
||||
this.appTopBar.menu.nativeElement.contains(event.target) ||
|
||||
this.appTopBar.topbarMenuButton.nativeElement.isSameNode(event.target) ||
|
||||
this.appTopBar.topbarMenuButton.nativeElement.contains(event.target)
|
||||
);
|
||||
|
||||
if (isOutsideClicked) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.layoutService.layoutState().staticMenuMobileActive) {
|
||||
this.blockBodyScroll();
|
||||
}
|
||||
@@ -75,11 +58,12 @@ export class AppLayout {
|
||||
});
|
||||
}
|
||||
|
||||
isOutsideClicked(event) {
|
||||
isOutsideClicked(event: MouseEvent) {
|
||||
const sidebarEl = document.querySelector('.layout-sidebar');
|
||||
const topbarEl = document.querySelector('.layout-menu-button');
|
||||
const eventTarget = event.target as Node;
|
||||
|
||||
return !(sidebarEl.isSameNode(event.target) || sidebarEl.contains(event.target) || topbarEl.isSameNode(event.target) || topbarEl.contains(event.target));
|
||||
return !(sidebarEl.isSameNode(eventTarget) || sidebarEl.contains(eventTarget) || topbarEl.isSameNode(eventTarget) || topbarEl.contains(eventTarget));
|
||||
}
|
||||
|
||||
hideMenu() {
|
||||
|
||||
@@ -44,7 +44,6 @@ import { LayoutService } from '@/src/service/layout/layout.service';
|
||||
</button>
|
||||
<div class="relative">
|
||||
<button
|
||||
#menubutton
|
||||
class="layout-topbar-action layout-topbar-action-highlight"
|
||||
pStyleClass="@next"
|
||||
enterFromClass="hidden"
|
||||
@@ -60,7 +59,6 @@ import { LayoutService } from '@/src/service/layout/layout.service';
|
||||
</div>
|
||||
|
||||
<button
|
||||
#topbarmenubutton
|
||||
class="layout-topbar-menu-button layout-topbar-action"
|
||||
pStyleClass="@next"
|
||||
enterFromClass="hidden"
|
||||
@@ -72,7 +70,7 @@ import { LayoutService } from '@/src/service/layout/layout.service';
|
||||
<i class="pi pi-ellipsis-v"></i>
|
||||
</button>
|
||||
|
||||
<div #topbarmenu class="layout-topbar-menu hidden lg:block">
|
||||
<div class="layout-topbar-menu hidden lg:block">
|
||||
<div class="layout-topbar-menu-content">
|
||||
<button type="button" class="layout-topbar-action">
|
||||
<i class="pi pi-calendar"></i>
|
||||
@@ -92,17 +90,13 @@ import { LayoutService } from '@/src/service/layout/layout.service';
|
||||
</div>`
|
||||
})
|
||||
export class AppTopBar {
|
||||
|
||||
items!: MenuItem[];
|
||||
|
||||
@ViewChild('menubutton') menuButton!: ElementRef;
|
||||
|
||||
@ViewChild('topbarmenubutton') topbarMenuButton!: ElementRef;
|
||||
|
||||
@ViewChild('topbarmenu') menu!: ElementRef;
|
||||
|
||||
constructor(public layoutService: LayoutService) {}
|
||||
|
||||
toggleDarkMode() {
|
||||
this.layoutService.layoutConfig.update((state) => ({ ...state, darkTheme: !state.darkTheme }));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user