1. 조직도 order 적용.

2. 쪽지 보내기 버튼 debounce 적용.
3. dialog 에 재동 focus 로 인한 버튼 focused 문제 수정.
This commit is contained in:
leejinho 2019-12-26 11:19:43 +09:00
parent 4a1be6b422
commit 52bf47e489
5 changed files with 53 additions and 2 deletions

View File

@ -48,6 +48,9 @@ export class Effects {
departmentInfoList.push(...(res as DeptData).departmentInfos); departmentInfoList.push(...(res as DeptData).departmentInfos);
break; break;
case SSVC_TYPE_QUERY_DEPT_RES: case SSVC_TYPE_QUERY_DEPT_RES:
departmentInfoList.sort((a, b) =>
a.order < b.order ? -1 : a.order > b.order ? 1 : 0
);
this.store.dispatch( this.store.dispatch(
deptSuccess({ deptSuccess({
departmentInfoList departmentInfoList

View File

@ -4,7 +4,11 @@
[disabled]="disabled" [disabled]="disabled"
#matMenuTrigger="matMenuTrigger" #matMenuTrigger="matMenuTrigger"
> >
<mat-button-toggle color="primary" (click)="onClick($event)"> <mat-button-toggle
color="primary"
ucapDebounceClick
(debounceClick)="onClick($event)"
>
<ng-content></ng-content> <ng-content></ng-content>
</mat-button-toggle> </mat-button-toggle>

View File

@ -0,0 +1,40 @@
import {
Directive,
EventEmitter,
HostListener,
Input,
OnDestroy,
OnInit,
Output
} from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
@Directive({
selector: '[ucapDebounceClick]'
})
export class ClickDebounceDirective implements OnInit, OnDestroy {
@Input() debounceTime = 500;
@Output() debounceClick = new EventEmitter();
private clicks = new Subject();
private subscription: Subscription;
constructor() {}
ngOnInit() {
this.subscription = this.clicks
.pipe(debounceTime(this.debounceTime))
.subscribe(e => this.debounceClick.emit(e));
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
@HostListener('click', ['$event'])
clickEvent(event) {
event.preventDefault();
event.stopPropagation();
this.clicks.next(event);
}
}

View File

@ -16,6 +16,8 @@ export class DialogService {
config?: MatDialogConfig<D> config?: MatDialogConfig<D>
): Promise<R> { ): Promise<R> {
return new Promise<R>((resolve, reject) => { return new Promise<R>((resolve, reject) => {
config = { ...config, autoFocus: false };
const dialogRef = this.matDialog.open<T, D, R>( const dialogRef = this.matDialog.open<T, D, R>(
componentOrTemplateRef, componentOrTemplateRef,
config config

View File

@ -71,6 +71,7 @@ import {
StringEmptyCheckPipe, StringEmptyCheckPipe,
StringFormatterPhonePipe StringFormatterPhonePipe
} from './pipes/string.pipe'; } from './pipes/string.pipe';
import { ClickDebounceDirective } from './directives/click-debounce.directive';
const COMPONENTS = [ const COMPONENTS = [
FileUploadQueueComponent, FileUploadQueueComponent,
@ -94,7 +95,8 @@ const DIRECTIVES = [
ClickOutsideDirective, ClickOutsideDirective,
FileUploadForDirective, FileUploadForDirective,
ImageDirective, ImageDirective,
CdkVirtualScrollViewportPatchDirective CdkVirtualScrollViewportPatchDirective,
ClickDebounceDirective
]; ];
const PIPES = [ const PIPES = [
BytesPipe, BytesPipe,