Merge branch 'master' of http://10.81.13.221:6990/Web/next-ucap-messenger
This commit is contained in:
commit
5c05a04cca
|
@ -10,6 +10,7 @@
|
||||||
class="ucap-message-write-editor"
|
class="ucap-message-write-editor"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
(paste)="onPasteEditor($event)"
|
(paste)="onPasteEditor($event)"
|
||||||
|
(input)="onInputEditor()"
|
||||||
></div>
|
></div>
|
||||||
<input type="file" #fileInput style="display: none" multiple />
|
<input type="file" #fileInput style="display: none" multiple />
|
||||||
<mat-list>
|
<mat-list>
|
||||||
|
@ -52,6 +53,15 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="editor-actions-spacer"></div>
|
<div class="editor-actions-spacer"></div>
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
[class.editor-length-invalid]="
|
||||||
|
0 === contentLength || 1000 < contentLength
|
||||||
|
"
|
||||||
|
>{{ contentLength }}</span
|
||||||
|
>/1000
|
||||||
|
</div>
|
||||||
|
<div class="editor-actions-spacer"></div>
|
||||||
<div class="editor-actions">
|
<div class="editor-actions">
|
||||||
<button
|
<button
|
||||||
mat-stroked-button
|
mat-stroked-button
|
||||||
|
@ -67,10 +77,18 @@
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|
||||||
<ucap-split-button [menu]="appMenu" (buttonClick)="onClickSend()"
|
<ucap-split-button
|
||||||
|
[menu]="appMenu"
|
||||||
|
(buttonClick)="onClickSend()"
|
||||||
|
[disabled]="
|
||||||
|
messageWriteForm.invalid ||
|
||||||
|
!receiverList ||
|
||||||
|
0 === receiverList.length ||
|
||||||
|
0 === contentLength ||
|
||||||
|
1000 < contentLength
|
||||||
|
"
|
||||||
>보내기</ucap-split-button
|
>보내기</ucap-split-button
|
||||||
>
|
>
|
||||||
<!-- [disabled]="messageWriteForm.invalid" -->
|
|
||||||
</div>
|
</div>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -22,12 +22,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
[contenteditable] {
|
[contenteditable] {
|
||||||
transition: padding 0.3s ease-in-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[contenteditable]:hover,
|
[contenteditable]:hover,
|
||||||
[contenteditable]:focus {
|
[contenteditable]:focus {
|
||||||
padding: 0.25em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[contenteditable]:hover {
|
[contenteditable]:hover {
|
||||||
|
@ -39,6 +37,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.editor-length-invalid {
|
||||||
|
color: crimson;
|
||||||
|
}
|
||||||
|
|
||||||
mat-card-actions {
|
mat-card-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -77,6 +77,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
attachmentList: File[];
|
attachmentList: File[];
|
||||||
fileUploadItem: FileUploadItem;
|
fileUploadItem: FileUploadItem;
|
||||||
receiverList: UserInfo[] = [];
|
receiverList: UserInfo[] = [];
|
||||||
|
contentLength = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
@ -87,8 +88,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.messageWriteForm = this.formBuilder.group({
|
this.messageWriteForm = this.formBuilder.group({
|
||||||
receiverList: ['', [Validators.required]],
|
title: ['', []]
|
||||||
title: ['', [Validators.required]]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,9 +143,15 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
);
|
);
|
||||||
this.insertNode(text, true);
|
this.insertNode(text, true);
|
||||||
|
|
||||||
|
this.checkContentLength();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onInputEditor() {
|
||||||
|
this.checkContentLength();
|
||||||
|
}
|
||||||
|
|
||||||
onRemovedReceiver(receiver: UserInfo) {
|
onRemovedReceiver(receiver: UserInfo) {
|
||||||
const index = this.receiverList.indexOf(receiver);
|
const index = this.receiverList.indexOf(receiver);
|
||||||
|
|
||||||
|
@ -183,32 +189,39 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendMessage(reservationDate?: moment.Moment) {
|
private checkContentLength() {
|
||||||
const contentList: Content[] = this.generateContent();
|
const result = this.parseContent();
|
||||||
if (!contentList || 0 === contentList.length) {
|
if (!result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const listOrder: ContentType[] = [];
|
const { textContent } = result;
|
||||||
const textContent: { text: string }[] = [];
|
|
||||||
const recvUserList: { userSeq: number; userName: string }[] = [];
|
|
||||||
const files: File[] = [];
|
|
||||||
const title = this.messageWriteForm.get('title').value;
|
|
||||||
|
|
||||||
contentList.forEach(v => {
|
if (!textContent || 0 === textContent.length) {
|
||||||
listOrder.push(v.contentType);
|
this.contentLength = 0;
|
||||||
switch (v.contentType) {
|
} else {
|
||||||
case ContentType.Text:
|
let len = 0;
|
||||||
textContent.push({ text: v.content as string });
|
textContent.forEach(c => {
|
||||||
break;
|
len += c.text.length;
|
||||||
case ContentType.Image:
|
});
|
||||||
case ContentType.AttachFile:
|
this.contentLength = len;
|
||||||
files.push(v.content as File);
|
}
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
break;
|
private sendMessage(reservationDate?: moment.Moment) {
|
||||||
}
|
const result = this.parseContent();
|
||||||
});
|
if (!result) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { listOrder, textContent, files } = result;
|
||||||
|
|
||||||
|
if (!listOrder || 0 === listOrder.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const recvUserList: { userSeq: number; userName: string }[] = [];
|
||||||
|
const title = this.messageWriteForm.get('title').value;
|
||||||
|
|
||||||
this.receiverList.forEach(v => {
|
this.receiverList.forEach(v => {
|
||||||
recvUserList.push({
|
recvUserList.push({
|
||||||
|
@ -234,6 +247,48 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private parseContent():
|
||||||
|
| {
|
||||||
|
listOrder: ContentType[];
|
||||||
|
textContent: { text: string }[];
|
||||||
|
files: File[];
|
||||||
|
}
|
||||||
|
| undefined {
|
||||||
|
const contentList: Content[] = this.generateContent();
|
||||||
|
if (!contentList || 0 === contentList.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const listOrder: ContentType[] = [];
|
||||||
|
const textContent: { text: string }[] = [];
|
||||||
|
const files: File[] = [];
|
||||||
|
|
||||||
|
contentList.forEach(v => {
|
||||||
|
listOrder.push(v.contentType);
|
||||||
|
switch (v.contentType) {
|
||||||
|
case ContentType.Text:
|
||||||
|
let content = v.content as string;
|
||||||
|
if ('\n' === content.charAt(content.length - 1)) {
|
||||||
|
content = content.substring(0, content.length - 2);
|
||||||
|
}
|
||||||
|
textContent.push({ text: content });
|
||||||
|
break;
|
||||||
|
case ContentType.Image:
|
||||||
|
case ContentType.AttachFile:
|
||||||
|
files.push(v.content as File);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
listOrder,
|
||||||
|
textContent,
|
||||||
|
files
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private generateContent(): Content[] {
|
private generateContent(): Content[] {
|
||||||
const contentList: Content[] = [];
|
const contentList: Content[] = [];
|
||||||
|
|
||||||
|
|
|
@ -101,14 +101,30 @@
|
||||||
</div>
|
</div>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
<mat-card-actions>
|
<mat-card-actions>
|
||||||
<div class="editor-actions-spacer"></div>
|
<div class="actions-container">
|
||||||
<div class="editor-actions">
|
<div class="actions-message">
|
||||||
<button mat-stroked-button (click)="onClickCancel()" class="mat-primary">
|
<span *ngIf="dateIsToEarly">
|
||||||
취소
|
현재 시각으로부터 30분 이후로만 설정 가능합니다.
|
||||||
</button>
|
</span>
|
||||||
<button mat-stroked-button (click)="onClickSend()" class="mat-primary">
|
</div>
|
||||||
예약 발송
|
<div class="actions-spacer"></div>
|
||||||
</button>
|
<div class="actions">
|
||||||
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
(click)="onClickCancel()"
|
||||||
|
class="mat-primary"
|
||||||
|
>
|
||||||
|
취소
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
[disabled]="dateIsToEarly"
|
||||||
|
(click)="onClickSend()"
|
||||||
|
class="mat-primary"
|
||||||
|
>
|
||||||
|
예약 발송
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
.preset-button {
|
.preset-button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.actions-container {
|
||||||
|
display: flex;
|
||||||
|
position: fixed;
|
||||||
|
|
||||||
|
.actions-message {
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions-spacer {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ export class ScheduleSendDialogComponent implements OnInit {
|
||||||
hourStep = 1;
|
hourStep = 1;
|
||||||
minuteStep = 10;
|
minuteStep = 10;
|
||||||
|
|
||||||
|
dateIsToEarly = false;
|
||||||
|
|
||||||
get selectedDate() {
|
get selectedDate() {
|
||||||
return this._selectedDate;
|
return this._selectedDate;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +33,8 @@ export class ScheduleSendDialogComponent implements OnInit {
|
||||||
this.minuteStep * Math.round(v.minute() / this.minuteStep)
|
this.minuteStep * Math.round(v.minute() / this.minuteStep)
|
||||||
);
|
);
|
||||||
this._selectedDate = v;
|
this._selectedDate = v;
|
||||||
|
const aa = moment().add(30, 'minutes');
|
||||||
|
this.dateIsToEarly = v.isBefore(moment().add(30, 'minutes'));
|
||||||
}
|
}
|
||||||
// tslint:disable-next-line: variable-name
|
// tslint:disable-next-line: variable-name
|
||||||
private _selectedDate: moment.Moment;
|
private _selectedDate: moment.Moment;
|
||||||
|
@ -59,10 +63,10 @@ export class ScheduleSendDialogComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onHourSelected(hour: number) {
|
onHourSelected(hour: number) {
|
||||||
this.selectedDate.hour(hour);
|
this.selectedDate = this.selectedDate.hour(hour);
|
||||||
}
|
}
|
||||||
onMinuteSelected(minute: number) {
|
onMinuteSelected(minute: number) {
|
||||||
this.selectedDate.minute(minute);
|
this.selectedDate = this.selectedDate.minute(minute);
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickPresetTommorowMorning() {
|
onClickPresetTommorowMorning() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user