2019-10-07 17:02:14 +09:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnInit,
|
|
|
|
Input,
|
|
|
|
Output,
|
|
|
|
EventEmitter,
|
2019-10-11 17:52:00 +09:00
|
|
|
ViewChild,
|
|
|
|
ContentChild,
|
|
|
|
TemplateRef
|
2019-10-07 17:02:14 +09:00
|
|
|
} from '@angular/core';
|
2019-09-25 17:41:16 +09:00
|
|
|
|
2019-10-02 14:34:17 +09:00
|
|
|
import { ucapAnimations } from '@ucap-webmessenger/ui';
|
|
|
|
|
2019-09-27 12:53:21 +09:00
|
|
|
import { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync';
|
2019-10-07 17:02:14 +09:00
|
|
|
import { MatAccordion } from '@angular/material';
|
2019-10-11 17:52:00 +09:00
|
|
|
import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item.directive';
|
2019-09-24 09:03:36 +09:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ucap-group-expansion-panel',
|
|
|
|
templateUrl: './expansion-panel.component.html',
|
2019-10-02 14:34:17 +09:00
|
|
|
styleUrls: ['./expansion-panel.component.scss'],
|
|
|
|
animations: ucapAnimations
|
2019-09-24 09:03:36 +09:00
|
|
|
})
|
|
|
|
export class ExpansionPanelComponent implements OnInit {
|
|
|
|
@Input()
|
2019-09-27 12:53:21 +09:00
|
|
|
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[];
|
|
|
|
|
2019-10-10 18:35:23 +09:00
|
|
|
@Input()
|
|
|
|
favoritBuddyList: UserInfo[];
|
|
|
|
|
2019-10-16 17:46:53 +09:00
|
|
|
@Input()
|
|
|
|
checkable = false;
|
|
|
|
|
2019-10-15 11:50:59 +09:00
|
|
|
@Output()
|
|
|
|
more = new EventEmitter<{
|
|
|
|
event: MouseEvent;
|
|
|
|
group: GroupDetailData;
|
|
|
|
}>();
|
|
|
|
|
2019-10-17 11:49:41 +09:00
|
|
|
@Output()
|
|
|
|
checkGroup = new EventEmitter<{
|
|
|
|
isChecked: boolean;
|
|
|
|
group: GroupDetailData;
|
|
|
|
}>();
|
|
|
|
|
2019-10-11 17:52:00 +09:00
|
|
|
@ContentChild(ExpansionPanelItemDirective, {
|
|
|
|
read: TemplateRef,
|
|
|
|
static: true
|
|
|
|
})
|
|
|
|
expansionPanelItemTemplateRef: TemplateRef<ExpansionPanelItemDirective>;
|
|
|
|
|
2019-10-07 17:02:14 +09:00
|
|
|
@ViewChild('groupAccordion', { static: true }) groupAccordion: MatAccordion;
|
|
|
|
|
2019-09-24 09:03:36 +09:00
|
|
|
constructor() {}
|
|
|
|
|
|
|
|
ngOnInit() {}
|
2019-09-27 12:53:21 +09:00
|
|
|
|
2019-10-07 17:02:14 +09:00
|
|
|
expandMore() {
|
|
|
|
this.groupAccordion.openAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
expandLess() {
|
|
|
|
this.groupAccordion.closeAll();
|
|
|
|
}
|
2019-10-15 11:50:59 +09:00
|
|
|
|
|
|
|
onClickMore(event: MouseEvent, group: GroupDetailData) {
|
|
|
|
this.more.emit({ event, group });
|
|
|
|
}
|
2019-10-17 11:49:41 +09:00
|
|
|
|
|
|
|
onChangeCheck(value: boolean, group: GroupDetailData) {
|
|
|
|
this.checkGroup.emit({
|
|
|
|
isChecked: value,
|
|
|
|
group
|
|
|
|
});
|
|
|
|
}
|
2019-09-24 09:03:36 +09:00
|
|
|
}
|