Skip to content

Commit

Permalink
fix(module:modal): integration problem with select component
Browse files Browse the repository at this point in the history
close #3213
  • Loading branch information
hsuanxyz committed Apr 10, 2019
1 parent 51c0d53 commit f2c10ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
24 changes: 0 additions & 24 deletions components/modal/modal-util.ts

This file was deleted.

4 changes: 2 additions & 2 deletions components/modal/nz-modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<i nz-icon type="close" class="ant-modal-close-icon"></i>
</span>
</button>
<ng-container [ngSwitch]="!hidden">
<ng-container *ngIf="!hidden" [ngSwitch]="true">
<ng-container *ngSwitchCase="isModalType('default')" [ngTemplateOutlet]="tplContentDefault"></ng-container>
<ng-container *ngSwitchCase="isModalType('confirm')" [ngTemplateOutlet]="tplContentConfirm"></ng-container>
</ng-container>
Expand Down Expand Up @@ -100,7 +100,7 @@
</ng-container>
</span>
<div class="ant-modal-confirm-content">
<ng-container #bodyContainer>
<ng-container>
<ng-container *ngIf="!isComponent(nzContent)" [ngSwitch]="true">
<ng-container *ngSwitchCase="isTemplateRef(nzContent)" [ngTemplateOutlet]="nzContent"></ng-container>
<ng-container *ngSwitchCase="isNonEmptyString(nzContent)"><div [innerHTML]="nzContent"></div></ng-container>
Expand Down
12 changes: 7 additions & 5 deletions components/modal/nz-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import { fromEvent, Observable, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { InputBoolean } from '../core/util/convert';
import { getElementOffset } from '../core/util/dom';
import { isPromise } from '../core/util/is-promise';
import { NzI18nService } from '../i18n/nz-i18n.service';
import ModalUtil from './modal-util';
import { NzModalConfig, NZ_MODAL_CONFIG, NZ_MODAL_DEFAULT_CONFIG } from './nz-modal-config';
import { NzModalControlService } from './nz-modal-control.service';
import { NzModalRef } from './nz-modal-ref.class';
Expand Down Expand Up @@ -437,10 +437,12 @@ export class NzModalComponent<T = any, R = any> extends NzModalRef<T, R>
// Update transform-origin to the last click position on document
private updateTransformOrigin(): void {
const modalElement = this.modalContainer.nativeElement as HTMLElement;
const lastPosition = ModalUtil.getLastClickPosition();
if (lastPosition) {
this.transformOrigin = `${lastPosition.x - modalElement.offsetLeft}px ${lastPosition.y -
modalElement.offsetTop}px 0px`;
if (this.previouslyFocusedElement) {
const previouslyDOMRect = this.previouslyFocusedElement.getBoundingClientRect();
const lastPosition = getElementOffset(this.previouslyFocusedElement);
const x = lastPosition.left + previouslyDOMRect.width / 2;
const y = lastPosition.top + previouslyDOMRect.height / 2;
this.transformOrigin = `${x - modalElement.offsetLeft}px ${y - modalElement.offsetTop}px 0px`;
}
}

Expand Down

0 comments on commit f2c10ba

Please sign in to comment.