124 lines
3.0 KiB
TypeScript
124 lines
3.0 KiB
TypeScript
import { Subject } from 'rxjs';
|
|
|
|
import {
|
|
Component,
|
|
OnInit,
|
|
OnDestroy,
|
|
ChangeDetectionStrategy,
|
|
ChangeDetectorRef,
|
|
Inject,
|
|
Input
|
|
} from '@angular/core';
|
|
|
|
import {
|
|
MatDialogRef,
|
|
MAT_DIALOG_DATA,
|
|
MatDialog
|
|
} from '@angular/material/dialog';
|
|
|
|
import { UserInfo, GroupDetailData } from '@ucap/protocol-sync';
|
|
import { UserInfoSS, UserInfoF, UserInfoDN } from '@ucap/protocol-query';
|
|
import { UserInfo as RoomUserInfo } from '@ucap/protocol-room';
|
|
import { MatStepper } from '@angular/material/stepper';
|
|
import { I18nService } from '@ucap/ng-i18n';
|
|
import { GroupActions } from '@ucap/ng-store-group';
|
|
import {
|
|
AlertDialogComponent,
|
|
AlertDialogData,
|
|
AlertDialogResult
|
|
} from '@ucap/ng-ui';
|
|
import { environment } from '@environments';
|
|
|
|
export type UserInfoTypes =
|
|
| UserInfo
|
|
| UserInfoSS
|
|
| UserInfoF
|
|
| UserInfoDN
|
|
| RoomUserInfo;
|
|
|
|
export interface ForwardDialogData {}
|
|
export interface ForwardDialogResult {
|
|
userSeqs: string[];
|
|
isTimer: boolean | undefined;
|
|
}
|
|
|
|
@Component({
|
|
selector: 'app-dialog-chat-forward',
|
|
templateUrl: './forward.dialog.component.html',
|
|
styleUrls: ['./forward.dialog.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class ForwardDialogComponent implements OnInit, OnDestroy {
|
|
currentStep = 0;
|
|
maxChatRoomUser: number;
|
|
|
|
isTimer: boolean | undefined;
|
|
selectedUserList: UserInfoTypes[] = [];
|
|
|
|
constructor(
|
|
public dialogRef: MatDialogRef<ForwardDialogData, ForwardDialogResult>,
|
|
@Inject(MAT_DIALOG_DATA) public data: ForwardDialogData,
|
|
private i18nService: I18nService,
|
|
public dialog: MatDialog,
|
|
private changeDetectorRef: ChangeDetectorRef
|
|
) {
|
|
this.maxChatRoomUser = environment.productConfig.chat.maxChatRoomUser;
|
|
}
|
|
|
|
ngOnInit(): void {}
|
|
|
|
ngOnDestroy(): void {}
|
|
|
|
onClosed(event: MouseEvent): void {
|
|
this.dialogRef.close();
|
|
}
|
|
|
|
onCancel() {
|
|
|
|
}
|
|
onConfirm() {
|
|
|
|
}
|
|
|
|
onChangeUserList(data: { checked: boolean; userInfo: UserInfoSS }) {
|
|
const i = this.selectedUserList.findIndex(
|
|
(u) => u.seq === data.userInfo.seq
|
|
);
|
|
|
|
if (data.checked) {
|
|
if (-1 === i) {
|
|
this.selectedUserList = [...this.selectedUserList, data.userInfo];
|
|
}
|
|
} else {
|
|
if (-1 < i) {
|
|
this.selectedUserList = this.selectedUserList.filter(
|
|
(u) => u.seq !== data.userInfo.seq
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
onChangeGroupList(params: {
|
|
isChecked: boolean;
|
|
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] };
|
|
}) {
|
|
if (params.isChecked) {
|
|
params.groupBuddyList.buddyList.forEach((item) => {
|
|
if (
|
|
this.selectedUserList.filter((user) => user.seq === item.seq)
|
|
.length === 0
|
|
) {
|
|
this.selectedUserList = [...this.selectedUserList, item];
|
|
}
|
|
});
|
|
} else {
|
|
this.selectedUserList = this.selectedUserList.filter(
|
|
(item) =>
|
|
params.groupBuddyList.buddyList.filter((del) => del.seq === item.seq)
|
|
.length === 0
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|