diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html
index 559bc6b429..48027b54a4 100644
--- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html
+++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html
@@ -1,6 +1,7 @@
{
this.setVisible(value);
- // this.renderer.removeClass(this.modalContent.nativeElement, 'fade-out-top');
this.ngOnDestroy();
}, ANIMATION_TIMEOUT - 10);
}
}
+ @Input()
+ get busy(): boolean {
+ return this._busy;
+ }
+ set busy(value: boolean) {
+ if (this.abpSubmit && this.abpSubmit instanceof ButtonComponent) {
+ this.abpSubmit.loading = value;
+ }
+
+ this._busy = value;
+ }
+
@Input() centered: boolean = false;
@Input() modalClass: string = '';
@Input() size: ModalSize = 'lg';
- @Output() visibleChange = new EventEmitter
();
-
@Input() height: number;
@Input() minHeight: number;
+ @Output() visibleChange = new EventEmitter();
+
@Output() init = new EventEmitter();
@ContentChild('abpHeader', { static: false }) abpHeader: TemplateRef;
@@ -77,10 +90,16 @@ export class ModalComponent implements OnDestroy {
@ContentChild('abpClose', { static: false, read: ElementRef }) abpClose: ElementRef;
+ @ContentChild(ButtonComponent, { static: false, read: ButtonComponent }) abpSubmit: ButtonComponent;
+
@ViewChild('abpModalContent', { static: false }) modalContent: ElementRef;
+ @ViewChildren('abp-button') abpButtons;
+
_visible: boolean = false;
+ _busy: boolean = false;
+
showModal: boolean = false;
isOpenConfirmation: boolean = false;
@@ -108,16 +127,6 @@ export class ModalComponent implements OnDestroy {
}
listen() {
- fromEvent(document, 'keyup')
- .pipe(
- takeUntil(this.destroy$),
- debounceTime(250),
- filter((key: KeyboardEvent) => key && key.code === 'Escape' && this.closable),
- )
- .subscribe(_ => {
- this.close();
- });
-
setTimeout(() => {
if (!this.abpClose) return;
@@ -129,10 +138,13 @@ export class ModalComponent implements OnDestroy {
.subscribe(() => this.close());
}, 0);
+ window.location.hash = '#abp-modal';
this.init.emit();
}
close() {
+ if (!this.closable || this.busy) return;
+
const nodes = getFlatNodes(
(this.modalContent.nativeElement.querySelector('#abp-modal-body') as HTMLElement).childNodes,
);
@@ -155,10 +167,8 @@ export class ModalComponent implements OnDestroy {
} else {
this.visible = false;
}
- }
- onClickBackdrop() {
- this.close();
+ window.location.hash = 'body';
}
}