[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
[oraganizationList]="departmentInfoList$ | async"
[loginRes]="loginRes"
[activate$]="gnbMenuChangedSubject.asObservable()"
(selected)="onSelectedOrganization($event)"
class="tab-tree-frame"
></ucap-organization-tree>

View File

@ -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<boolean> = 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();
}
}
/** 유저검색 */

View File

@ -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<boolean>;
@Output()
selected = new EventEmitter<DeptInfo>();
@ -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 {

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 { 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() {