diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html
index 0c77d7da..6585124d 100644
--- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html
+++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html
@@ -15,6 +15,7 @@
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts
index 37427654..892aba33 100644
--- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts
+++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts
@@ -10,7 +10,7 @@ import {
ChangeDetectorRef
} from '@angular/core';
import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui';
-import { Observable, Subscription, of } from 'rxjs';
+import { Observable, Subscription, of, BehaviorSubject } from 'rxjs';
import {
DeptInfo,
QueryProtocolService,
@@ -40,7 +40,8 @@ import {
KEY_VER_INFO,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO,
- KEY_AUTH_INFO
+ KEY_AUTH_INFO,
+ MainMenu
} from '@app/types';
import { take, map, tap, delay, catchError } from 'rxjs/operators';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
@@ -154,6 +155,11 @@ export class OrganizationComponent
isShowSearch = false;
searchUserInfos: UserInfoSS[] = [];
+ gnbMenuChangedSubject: BehaviorSubject = new BehaviorSubject<
+ boolean
+ >(false);
+ gnbMenuChangedSubscription: Subscription;
+
/** 부서원 리스트에 virture scroll의 size 가 체킹되지 않아 강제 수행. 1번만. */
isInitList = false;
@@ -256,6 +262,12 @@ export class OrganizationComponent
this.psDirectiveRef.update();
}
});
+
+ this.gnbMenuChangedSubscription = this.store
+ .pipe(select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex))
+ .subscribe(menu => {
+ this.gnbMenuChangedSubject.next(menu === MainMenu.Organization);
+ });
}
ngAfterViewChecked(): void {
@@ -277,6 +289,9 @@ export class OrganizationComponent
if (!!this.myDepartmentUserInfoListSubscription) {
this.myDepartmentUserInfoListSubscription.unsubscribe();
}
+ if (!!this.gnbMenuChangedSubscription) {
+ this.gnbMenuChangedSubscription.unsubscribe();
+ }
}
/** 유저검색 */
diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.ts b/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.ts
index 57cc3bf8..2bba954f 100644
--- a/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.ts
+++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.ts
@@ -20,7 +20,7 @@ import { VirtualScrollTreeFlatDataSource } from '@ucap-webmessenger/ui';
import { ucapAnimations } from '@ucap-webmessenger/ui';
import { trigger, transition, style, animate } from '@angular/animations';
import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar';
-import { Subscription } from 'rxjs';
+import { Subscription, Observable } from 'rxjs';
interface OrganizationNode {
deptInfo: DeptInfo;
@@ -103,6 +103,9 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
this.dataSource.data = rootNodeList;
}
+ @Input()
+ activate$: Observable;
+
@Output()
selected = new EventEmitter();
@@ -121,6 +124,8 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
treeControlExpansionChangeSubscription: Subscription;
+ activateSubscription: Subscription;
+
constructor(
private changeDetectorRef: ChangeDetectorRef,
private logger: NGXLogger
@@ -154,13 +159,24 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
this.psDirectiveRef.update();
}
);
+ this.activateSubscription = this.activate$.subscribe(activate => {
+ if (activate) {
+ setTimeout(() => {
+ if (!!this.cvsvOrganization) {
+ this.cvsvOrganization.checkViewportSize();
+ }
+ }, 100);
+ }
+ });
}
ngOnDestroy(): void {
- this.logger.debug('-----------------------TreeComponent ngOnDestroy');
if (!!this.treeControlExpansionChangeSubscription) {
this.treeControlExpansionChangeSubscription.unsubscribe();
}
+ if (!!this.activateSubscription) {
+ this.activateSubscription.unsubscribe();
+ }
}
ngAfterViewInit(): void {
diff --git a/projects/ucap-webmessenger-ui/src/lib/directives/cdk-virtual-scroll-viewport-patch.directive.ts b/projects/ucap-webmessenger-ui/src/lib/directives/cdk-virtual-scroll-viewport-patch.directive.ts
index 849879a6..6ce2d95f 100644
--- a/projects/ucap-webmessenger-ui/src/lib/directives/cdk-virtual-scroll-viewport-patch.directive.ts
+++ b/projects/ucap-webmessenger-ui/src/lib/directives/cdk-virtual-scroll-viewport-patch.directive.ts
@@ -1,7 +1,15 @@
-import { Directive, OnInit, OnDestroy, Self, Inject } from '@angular/core';
+import {
+ Directive,
+ OnInit,
+ OnDestroy,
+ Self,
+ Inject,
+ ChangeDetectorRef
+} from '@angular/core';
import { Subject, fromEvent } from 'rxjs';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { debounceTime, takeUntil } from 'rxjs/operators';
+import { DOCUMENT } from '@angular/common';
@Directive({
// tslint:disable-next-line: directive-selector
@@ -14,13 +22,17 @@ export class CdkVirtualScrollViewportPatchDirective
constructor(
@Self()
@Inject(CdkVirtualScrollViewport)
- private readonly viewportComponent: CdkVirtualScrollViewport
+ private readonly viewportComponent: CdkVirtualScrollViewport,
+ @Inject(DOCUMENT)
+ private readonly document: Document
) {}
ngOnInit() {
- fromEvent(window, 'resize')
+ fromEvent(this.document.defaultView, 'resize')
.pipe(debounceTime(10), takeUntil(this.destroySubject))
- .subscribe(() => this.viewportComponent.checkViewportSize());
+ .subscribe(() => {
+ this.viewportComponent.checkViewportSize();
+ });
}
ngOnDestroy() {