|
|
@ -1,4 +1,4 @@
|
|
|
|
import { SubscriptionService } from '@abp/ng.core';
|
|
|
|
import { SubscriptionService, uuid } from '@abp/ng.core';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
Component,
|
|
|
|
ContentChild,
|
|
|
|
ContentChild,
|
|
|
@ -6,13 +6,13 @@ import {
|
|
|
|
EventEmitter,
|
|
|
|
EventEmitter,
|
|
|
|
Inject,
|
|
|
|
Inject,
|
|
|
|
Input,
|
|
|
|
Input,
|
|
|
|
|
|
|
|
isDevMode,
|
|
|
|
OnDestroy,
|
|
|
|
OnDestroy,
|
|
|
|
|
|
|
|
OnInit,
|
|
|
|
Optional,
|
|
|
|
Optional,
|
|
|
|
Output,
|
|
|
|
Output,
|
|
|
|
TemplateRef,
|
|
|
|
TemplateRef,
|
|
|
|
ViewChild,
|
|
|
|
ViewChild
|
|
|
|
isDevMode,
|
|
|
|
|
|
|
|
OnInit,
|
|
|
|
|
|
|
|
} from '@angular/core';
|
|
|
|
} from '@angular/core';
|
|
|
|
import { NgbModal, NgbModalOptions, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
|
|
|
import { NgbModal, NgbModalOptions, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
|
|
|
import { fromEvent, Subject } from 'rxjs';
|
|
|
|
import { fromEvent, Subject } from 'rxjs';
|
|
|
@ -21,7 +21,7 @@ import { Confirmation } from '../../models/confirmation';
|
|
|
|
import { ConfirmationService } from '../../services/confirmation.service';
|
|
|
|
import { ConfirmationService } from '../../services/confirmation.service';
|
|
|
|
import { SUPPRESS_UNSAVED_CHANGES_WARNING } from '../../tokens/suppress-unsaved-changes-warning.token';
|
|
|
|
import { SUPPRESS_UNSAVED_CHANGES_WARNING } from '../../tokens/suppress-unsaved-changes-warning.token';
|
|
|
|
import { ButtonComponent } from '../button/button.component';
|
|
|
|
import { ButtonComponent } from '../button/button.component';
|
|
|
|
import { DismissableModal, ModalRefService, ModalDismissMode } from './modal-ref.service';
|
|
|
|
import { DismissableModal, ModalDismissMode, ModalRefService } from './modal-ref.service';
|
|
|
|
|
|
|
|
|
|
|
|
export type ModalSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
|
|
export type ModalSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
|
|
|
|
|
|
|
|
|
@ -105,10 +105,16 @@ export class ModalComponent implements OnInit, OnDestroy, DismissableModal {
|
|
|
|
|
|
|
|
|
|
|
|
destroy$ = new Subject<void>();
|
|
|
|
destroy$ = new Subject<void>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modalIdentifier = `modal-${uuid()}`;
|
|
|
|
|
|
|
|
|
|
|
|
private toggle$ = new Subject<boolean>();
|
|
|
|
private toggle$ = new Subject<boolean>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get modalWindowRef() {
|
|
|
|
|
|
|
|
return document.querySelector(`ngb-modal-window.${this.modalIdentifier}`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get isFormDirty(): boolean {
|
|
|
|
get isFormDirty(): boolean {
|
|
|
|
return Boolean(document.querySelector('.modal-dialog .ng-dirty'));
|
|
|
|
return Boolean(this.modalWindowRef.querySelector('.ng-dirty'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
@ -160,7 +166,6 @@ export class ModalComponent implements OnInit, OnDestroy, DismissableModal {
|
|
|
|
this.modalRef = this.modal.open(this.modalContent, {
|
|
|
|
this.modalRef = this.modal.open(this.modalContent, {
|
|
|
|
// TODO: set size to 'lg' when removed the size variable
|
|
|
|
// TODO: set size to 'lg' when removed the size variable
|
|
|
|
size: this.size,
|
|
|
|
size: this.size,
|
|
|
|
windowClass: this.modalClass,
|
|
|
|
|
|
|
|
centered: this.centered,
|
|
|
|
centered: this.centered,
|
|
|
|
keyboard: false,
|
|
|
|
keyboard: false,
|
|
|
|
scrollable: true,
|
|
|
|
scrollable: true,
|
|
|
@ -171,6 +176,7 @@ export class ModalComponent implements OnInit, OnDestroy, DismissableModal {
|
|
|
|
return !this.visible;
|
|
|
|
return !this.visible;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
...this.options,
|
|
|
|
...this.options,
|
|
|
|
|
|
|
|
windowClass: `${this.modalClass} ${this.options.windowClass || ''} ${this.modalIdentifier}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.appear.emit();
|
|
|
|
this.appear.emit();
|
|
|
@ -193,6 +199,7 @@ export class ModalComponent implements OnInit, OnDestroy, DismissableModal {
|
|
|
|
.warn(
|
|
|
|
.warn(
|
|
|
|
'AbpAccount::AreYouSureYouWantToCancelEditingWarningMessage',
|
|
|
|
'AbpAccount::AreYouSureYouWantToCancelEditingWarningMessage',
|
|
|
|
'AbpAccount::AreYouSure',
|
|
|
|
'AbpAccount::AreYouSure',
|
|
|
|
|
|
|
|
{ dismissible: false },
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.subscribe((status: Confirmation.Status) => {
|
|
|
|
.subscribe((status: Confirmation.Status) => {
|
|
|
|
this.isConfirmationOpen = false;
|
|
|
|
this.isConfirmationOpen = false;
|
|
|
@ -206,7 +213,7 @@ export class ModalComponent implements OnInit, OnDestroy, DismissableModal {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
listen() {
|
|
|
|
listen() {
|
|
|
|
fromEvent(document, 'keyup')
|
|
|
|
fromEvent(this.modalWindowRef, 'keyup')
|
|
|
|
.pipe(
|
|
|
|
.pipe(
|
|
|
|
takeUntil(this.destroy$),
|
|
|
|
takeUntil(this.destroy$),
|
|
|
|
debounceTime(150),
|
|
|
|
debounceTime(150),
|
|
|
|