77 lines
1.6 KiB
TypeScript
Raw Normal View History

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';
@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
})
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[];
@Input()
checkable = false;
2019-10-15 11:50:59 +09:00
@Output()
more = new EventEmitter<{
event: MouseEvent;
group: GroupDetailData;
}>();
@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;
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 });
}
onChangeCheck(value: boolean, group: GroupDetailData) {
this.checkGroup.emit({
isChecked: value,
group
});
}
}