[ISSUE 208] fixed

This commit is contained in:
richard-loafle 2020-02-07 14:42:11 +09:00
parent 3b2560948a
commit 65fbf8ab77
4 changed files with 52 additions and 8 deletions

View File

@ -15,6 +15,7 @@
<ucap-organization-tree <ucap-organization-tree
[oraganizationList]="departmentInfoList$ | async" [oraganizationList]="departmentInfoList$ | async"
[loginRes]="loginRes" [loginRes]="loginRes"
[activate$]="gnbMenuChangedSubject.asObservable()"
(selected)="onSelectedOrganization($event)" (selected)="onSelectedOrganization($event)"
class="tab-tree-frame" class="tab-tree-frame"
></ucap-organization-tree> ></ucap-organization-tree>

View File

@ -10,7 +10,7 @@ import {
ChangeDetectorRef ChangeDetectorRef
} from '@angular/core'; } from '@angular/core';
import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui';
import { Observable, Subscription, of } from 'rxjs'; import { Observable, Subscription, of, BehaviorSubject } from 'rxjs';
import { import {
DeptInfo, DeptInfo,
QueryProtocolService, QueryProtocolService,
@ -40,7 +40,8 @@ import {
KEY_VER_INFO, KEY_VER_INFO,
EnvironmentsInfo, EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO, KEY_ENVIRONMENTS_INFO,
KEY_AUTH_INFO KEY_AUTH_INFO,
MainMenu
} from '@app/types'; } from '@app/types';
import { take, map, tap, delay, catchError } from 'rxjs/operators'; import { take, map, tap, delay, catchError } from 'rxjs/operators';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
@ -154,6 +155,11 @@ export class OrganizationComponent
isShowSearch = false; isShowSearch = false;
searchUserInfos: UserInfoSS[] = []; searchUserInfos: UserInfoSS[] = [];
gnbMenuChangedSubject: BehaviorSubject<boolean> = new BehaviorSubject<
boolean
>(false);
gnbMenuChangedSubscription: Subscription;
/** 부서원 리스트에 virture scroll의 size 가 체킹되지 않아 강제 수행. 1번만. */ /** 부서원 리스트에 virture scroll의 size 가 체킹되지 않아 강제 수행. 1번만. */
isInitList = false; isInitList = false;
@ -256,6 +262,12 @@ export class OrganizationComponent
this.psDirectiveRef.update(); this.psDirectiveRef.update();
} }
}); });
this.gnbMenuChangedSubscription = this.store
.pipe(select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex))
.subscribe(menu => {
this.gnbMenuChangedSubject.next(menu === MainMenu.Organization);
});
} }
ngAfterViewChecked(): void { ngAfterViewChecked(): void {
@ -277,6 +289,9 @@ export class OrganizationComponent
if (!!this.myDepartmentUserInfoListSubscription) { if (!!this.myDepartmentUserInfoListSubscription) {
this.myDepartmentUserInfoListSubscription.unsubscribe(); this.myDepartmentUserInfoListSubscription.unsubscribe();
} }
if (!!this.gnbMenuChangedSubscription) {
this.gnbMenuChangedSubscription.unsubscribe();
}
} }
/** 유저검색 */ /** 유저검색 */

View File

@ -20,7 +20,7 @@ import { VirtualScrollTreeFlatDataSource } from '@ucap-webmessenger/ui';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { trigger, transition, style, animate } from '@angular/animations'; import { trigger, transition, style, animate } from '@angular/animations';
import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar'; import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar';
import { Subscription } from 'rxjs'; import { Subscription, Observable } from 'rxjs';
interface OrganizationNode { interface OrganizationNode {
deptInfo: DeptInfo; deptInfo: DeptInfo;
@ -103,6 +103,9 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
this.dataSource.data = rootNodeList; this.dataSource.data = rootNodeList;
} }
@Input()
activate$: Observable<boolean>;
@Output() @Output()
selected = new EventEmitter<DeptInfo>(); selected = new EventEmitter<DeptInfo>();
@ -121,6 +124,8 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
treeControlExpansionChangeSubscription: Subscription; treeControlExpansionChangeSubscription: Subscription;
activateSubscription: Subscription;
constructor( constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private logger: NGXLogger private logger: NGXLogger
@ -154,13 +159,24 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
this.psDirectiveRef.update(); this.psDirectiveRef.update();
} }
); );
this.activateSubscription = this.activate$.subscribe(activate => {
if (activate) {
setTimeout(() => {
if (!!this.cvsvOrganization) {
this.cvsvOrganization.checkViewportSize();
}
}, 100);
}
});
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.logger.debug('-----------------------TreeComponent ngOnDestroy');
if (!!this.treeControlExpansionChangeSubscription) { if (!!this.treeControlExpansionChangeSubscription) {
this.treeControlExpansionChangeSubscription.unsubscribe(); this.treeControlExpansionChangeSubscription.unsubscribe();
} }
if (!!this.activateSubscription) {
this.activateSubscription.unsubscribe();
}
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {

View File

@ -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 { Subject, fromEvent } from 'rxjs';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { debounceTime, takeUntil } from 'rxjs/operators'; import { debounceTime, takeUntil } from 'rxjs/operators';
import { DOCUMENT } from '@angular/common';
@Directive({ @Directive({
// tslint:disable-next-line: directive-selector // tslint:disable-next-line: directive-selector
@ -14,13 +22,17 @@ export class CdkVirtualScrollViewportPatchDirective
constructor( constructor(
@Self() @Self()
@Inject(CdkVirtualScrollViewport) @Inject(CdkVirtualScrollViewport)
private readonly viewportComponent: CdkVirtualScrollViewport private readonly viewportComponent: CdkVirtualScrollViewport,
@Inject(DOCUMENT)
private readonly document: Document
) {} ) {}
ngOnInit() { ngOnInit() {
fromEvent(window, 'resize') fromEvent(this.document.defaultView, 'resize')
.pipe(debounceTime(10), takeUntil(this.destroySubject)) .pipe(debounceTime(10), takeUntil(this.destroySubject))
.subscribe(() => this.viewportComponent.checkViewportSize()); .subscribe(() => {
this.viewportComponent.checkViewportSize();
});
} }
ngOnDestroy() { ngOnDestroy() {