This commit is contained in:
leejinho 2020-02-07 17:40:50 +09:00
commit dadc980af3
4 changed files with 56 additions and 4 deletions

View File

@ -29,6 +29,7 @@
[groupBuddyList]="groupBuddyList" [groupBuddyList]="groupBuddyList"
[favoritBuddyList]="favoritBuddyList$ | async" [favoritBuddyList]="favoritBuddyList$ | async"
[myProfileInfo]="loginRes.userInfo" [myProfileInfo]="loginRes.userInfo"
[activate$]="groupTreeActivatedSubject.asObservable()"
(more)="onMoreGroup($event)" (more)="onMoreGroup($event)"
> >
<ucap-profile-user-list-item <ucap-profile-user-list-item

View File

@ -8,7 +8,13 @@ import {
Output Output
} from '@angular/core'; } from '@angular/core';
import { Observable, combineLatest, Subscription, of } from 'rxjs'; import {
Observable,
combineLatest,
Subscription,
of,
BehaviorSubject
} from 'rxjs';
import { map, tap, catchError, exhaustMap } from 'rxjs/operators'; import { map, tap, catchError, exhaustMap } from 'rxjs/operators';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
@ -27,7 +33,8 @@ import {
UserSelectDialogType, UserSelectDialogType,
EnvironmentsInfo, EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO, KEY_ENVIRONMENTS_INFO,
KEY_VER_INFO KEY_VER_INFO,
MainMenu
} from '@app/types'; } from '@app/types';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
@ -120,6 +127,11 @@ export class GroupComponent implements OnInit, OnDestroy {
searchProcessing = false; searchProcessing = false;
searchUserInfos: UserInfoSS[] = []; searchUserInfos: UserInfoSS[] = [];
groupTreeActivatedSubject: BehaviorSubject<boolean> = new BehaviorSubject<
boolean
>(false);
groupTreeActivatedSubscription: Subscription;
constructor( constructor(
private store: Store<any>, private store: Store<any>,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
@ -233,6 +245,14 @@ export class GroupComponent implements OnInit, OnDestroy {
return this.favoritBuddyList; return this.favoritBuddyList;
}) })
); );
this.groupTreeActivatedSubscription = combineLatest([
this.store.pipe(
select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex)
)
]).subscribe(([menu]) => {
this.groupTreeActivatedSubject.next(menu === MainMenu.Group);
});
} }
ngOnDestroy(): void { ngOnDestroy(): void {

View File

@ -27,7 +27,8 @@ import { VirtualScrollTreeFlatDataSource } from '@ucap-webmessenger/ui';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar'; import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar';
import { Subscription } from 'rxjs'; import { Subscription, Observable, timer } from 'rxjs';
import { debounce } from 'rxjs/operators';
enum NodeType { enum NodeType {
None = 'None', None = 'None',
@ -166,6 +167,9 @@ export class ExpansionPanelComponent
/** 선택할 수 없는 사용자 리스트 */ /** 선택할 수 없는 사용자 리스트 */
ignoreUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; ignoreUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input()
activate$: Observable<boolean>;
@Output() @Output()
more = new EventEmitter<{ more = new EventEmitter<{
event: MouseEvent; event: MouseEvent;
@ -187,7 +191,7 @@ export class ExpansionPanelComponent
@ViewChild('groupTree', { static: false }) @ViewChild('groupTree', { static: false })
groupTree: MatTree<FlatNode>; groupTree: MatTree<FlatNode>;
@ViewChild('cvsvGroup', { static: false }) @ViewChild('cvsvGroup', { static: true })
cvsvGroup: CdkVirtualScrollViewport; cvsvGroup: CdkVirtualScrollViewport;
@ViewChild(PerfectScrollbarDirective, { static: false }) @ViewChild(PerfectScrollbarDirective, { static: false })
@ -207,6 +211,8 @@ export class ExpansionPanelComponent
groupList: { group: GroupDetailData; buddyList: UserInfo[] }[]; groupList: { group: GroupDetailData; buddyList: UserInfo[] }[];
treeControlExpansionChangeSubscription: Subscription; treeControlExpansionChangeSubscription: Subscription;
activateSubscription: Subscription;
scrollSubscription: Subscription;
constructor( constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
@ -245,15 +251,38 @@ export class ExpansionPanelComponent
ngOnInit() { ngOnInit() {
this.treeControlExpansionChangeSubscription = this.treeControl.expansionModel.changed.subscribe( this.treeControlExpansionChangeSubscription = this.treeControl.expansionModel.changed.subscribe(
() => { () => {
this.cvsvGroup.checkViewportSize();
this.psDirectiveRef.update(); this.psDirectiveRef.update();
} }
); );
this.activateSubscription = this.activate$.subscribe(activate => {
if (activate) {
setTimeout(() => {
if (!!this.cvsvGroup) {
this.cvsvGroup.checkViewportSize();
this.psDirectiveRef.update();
}
}, 100);
}
});
this.scrollSubscription = this.cvsvGroup.renderedRangeStream
.pipe(debounce(() => timer(100)))
.subscribe(() => {
this.psDirectiveRef.update();
});
} }
ngOnDestroy(): void { ngOnDestroy(): void {
if (!!this.treeControlExpansionChangeSubscription) { if (!!this.treeControlExpansionChangeSubscription) {
this.treeControlExpansionChangeSubscription.unsubscribe(); this.treeControlExpansionChangeSubscription.unsubscribe();
} }
if (!!this.activateSubscription) {
this.activateSubscription.unsubscribe();
}
if (!!this.scrollSubscription) {
this.scrollSubscription.unsubscribe();
}
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {

View File

@ -156,6 +156,7 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
ngOnInit() { ngOnInit() {
this.treeControlExpansionChangeSubscription = this.treeControl.expansionModel.changed.subscribe( this.treeControlExpansionChangeSubscription = this.treeControl.expansionModel.changed.subscribe(
() => { () => {
this.cvsvOrganization.checkViewportSize();
this.psDirectiveRef.update(); this.psDirectiveRef.update();
} }
); );
@ -164,6 +165,7 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
setTimeout(() => { setTimeout(() => {
if (!!this.cvsvOrganization) { if (!!this.cvsvOrganization) {
this.cvsvOrganization.checkViewportSize(); this.cvsvOrganization.checkViewportSize();
this.psDirectiveRef.update();
} }
}, 100); }, 100);
} }