ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
961 lines (951 loc) • 30.5 kB
JavaScript
import { __decorate, __metadata, __rest } from 'tslib';
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
import { ESCAPE } from '@angular/cdk/keycodes';
import { OverlayConfig, Overlay, OverlayKeyboardDispatcher, OverlayModule } from '@angular/cdk/overlay';
import { PortalInjector, ComponentPortal, TemplatePortal, CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
import { DOCUMENT, CommonModule } from '@angular/common';
import { EventEmitter, TemplateRef, Type, Component, ChangeDetectionStrategy, Optional, Inject, Renderer2, Injector, ChangeDetectorRef, ViewContainerRef, Input, Output, ViewChild, NgModule, Injectable, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
import { NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
import { toCssPixel, InputBoolean } from 'ng-zorro-antd/core/util';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { NzNoAnimationModule } from 'ng-zorro-antd/core/no-animation';
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
import { NzIconModule } from 'ng-zorro-antd/icon';
/**
* @fileoverview added by tsickle
* Generated from: drawer-ref.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
/**
* @abstract
* @template R
*/
class NzDrawerRef {
}
if (false) {
/** @type {?} */
NzDrawerRef.prototype.afterClose;
/** @type {?} */
NzDrawerRef.prototype.afterOpen;
/** @type {?} */
NzDrawerRef.prototype.nzClosable;
/** @type {?} */
NzDrawerRef.prototype.nzNoAnimation;
/** @type {?} */
NzDrawerRef.prototype.nzMaskClosable;
/** @type {?} */
NzDrawerRef.prototype.nzKeyboard;
/** @type {?} */
NzDrawerRef.prototype.nzMask;
/** @type {?} */
NzDrawerRef.prototype.nzTitle;
/** @type {?} */
NzDrawerRef.prototype.nzPlacement;
/** @type {?} */
NzDrawerRef.prototype.nzMaskStyle;
/** @type {?} */
NzDrawerRef.prototype.nzBodyStyle;
/** @type {?} */
NzDrawerRef.prototype.nzWrapClassName;
/** @type {?} */
NzDrawerRef.prototype.nzWidth;
/** @type {?} */
NzDrawerRef.prototype.nzHeight;
/** @type {?} */
NzDrawerRef.prototype.nzZIndex;
/** @type {?} */
NzDrawerRef.prototype.nzOffsetX;
/** @type {?} */
NzDrawerRef.prototype.nzOffsetY;
/**
* @abstract
* @param {?=} result
* @return {?}
*/
NzDrawerRef.prototype.close = function (result) { };
/**
* @abstract
* @return {?}
*/
NzDrawerRef.prototype.open = function () { };
}
/**
* @fileoverview added by tsickle
* Generated from: drawer.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const DRAWER_ANIMATE_DURATION = 300;
/** @type {?} */
const NZ_CONFIG_COMPONENT_NAME = 'drawer';
/**
* @template T, R, D
*/
class NzDrawerComponent extends NzDrawerRef {
/**
* @param {?} document
* @param {?} nzConfigService
* @param {?} renderer
* @param {?} overlay
* @param {?} injector
* @param {?} changeDetectorRef
* @param {?} focusTrapFactory
* @param {?} viewContainerRef
* @param {?} overlayKeyboardDispatcher
*/
constructor(document, nzConfigService, renderer, overlay, injector, changeDetectorRef, focusTrapFactory, viewContainerRef, overlayKeyboardDispatcher) {
super();
this.document = document;
this.nzConfigService = nzConfigService;
this.renderer = renderer;
this.overlay = overlay;
this.injector = injector;
this.changeDetectorRef = changeDetectorRef;
this.focusTrapFactory = focusTrapFactory;
this.viewContainerRef = viewContainerRef;
this.overlayKeyboardDispatcher = overlayKeyboardDispatcher;
this.nzClosable = true;
this.nzMaskClosable = true;
this.nzMask = true;
this.nzCloseOnNavigation = true;
this.nzNoAnimation = false;
this.nzKeyboard = true;
this.nzPlacement = 'right';
this.nzMaskStyle = {};
this.nzBodyStyle = {};
this.nzWidth = 256;
this.nzHeight = 256;
this.nzZIndex = 1000;
this.nzOffsetX = 0;
this.nzOffsetY = 0;
this.nzOnViewInit = new EventEmitter();
this.nzOnClose = new EventEmitter();
this.destroy$ = new Subject();
this.placementChanging = false;
this.placementChangeTimeoutId = -1;
this.isOpen = false;
this.templateContext = {
$implicit: undefined,
drawerRef: (/** @type {?} */ (this))
};
this.nzAfterOpen = new Subject();
this.nzAfterClose = new Subject();
}
/**
* @param {?} value
* @return {?}
*/
set nzVisible(value) {
this.isOpen = value;
}
/**
* @return {?}
*/
get nzVisible() {
return this.isOpen;
}
/**
* @return {?}
*/
get offsetTransform() {
if (!this.isOpen || this.nzOffsetX + this.nzOffsetY === 0) {
return null;
}
switch (this.nzPlacement) {
case 'left':
return `translateX(${this.nzOffsetX}px)`;
case 'right':
return `translateX(-${this.nzOffsetX}px)`;
case 'top':
return `translateY(${this.nzOffsetY}px)`;
case 'bottom':
return `translateY(-${this.nzOffsetY}px)`;
}
}
/**
* @return {?}
*/
get transform() {
if (this.isOpen) {
return null;
}
switch (this.nzPlacement) {
case 'left':
return `translateX(-100%)`;
case 'right':
return `translateX(100%)`;
case 'top':
return `translateY(-100%)`;
case 'bottom':
return `translateY(100%)`;
}
}
/**
* @return {?}
*/
get width() {
return this.isLeftOrRight ? toCssPixel(this.nzWidth) : null;
}
/**
* @return {?}
*/
get height() {
return !this.isLeftOrRight ? toCssPixel(this.nzHeight) : null;
}
/**
* @return {?}
*/
get isLeftOrRight() {
return this.nzPlacement === 'left' || this.nzPlacement === 'right';
}
/**
* @return {?}
*/
get afterOpen() {
return this.nzAfterOpen.asObservable();
}
/**
* @return {?}
*/
get afterClose() {
return this.nzAfterClose.asObservable();
}
/**
* @param {?} value
* @return {?}
*/
isTemplateRef(value) {
return value instanceof TemplateRef;
}
/**
* @return {?}
*/
ngOnInit() {
this.attachOverlay();
this.updateOverlayStyle();
this.updateBodyOverflow();
this.templateContext = { $implicit: this.nzContentParams, drawerRef: (/** @type {?} */ (this)) };
this.changeDetectorRef.detectChanges();
}
/**
* @return {?}
*/
ngAfterViewInit() {
this.attachBodyContent();
setTimeout((/**
* @return {?}
*/
() => {
this.nzOnViewInit.emit();
}));
}
/**
* @param {?} changes
* @return {?}
*/
ngOnChanges(changes) {
const { nzPlacement, nzVisible } = changes;
if (nzVisible) {
/** @type {?} */
const value = changes.nzVisible.currentValue;
if (value) {
this.open();
}
else {
this.close();
}
}
if (nzPlacement && !nzPlacement.isFirstChange()) {
this.triggerPlacementChangeCycleOnce();
}
}
/**
* @return {?}
*/
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
clearTimeout(this.placementChangeTimeoutId);
this.disposeOverlay();
}
/**
* @private
* @return {?}
*/
getAnimationDuration() {
return this.nzNoAnimation ? 0 : DRAWER_ANIMATE_DURATION;
}
// Disable the transition animation temporarily when the placement changing
/**
* @private
* @return {?}
*/
triggerPlacementChangeCycleOnce() {
if (!this.nzNoAnimation) {
this.placementChanging = true;
this.changeDetectorRef.markForCheck();
clearTimeout(this.placementChangeTimeoutId);
this.placementChangeTimeoutId = setTimeout((/**
* @return {?}
*/
() => {
this.placementChanging = false;
this.changeDetectorRef.markForCheck();
}), this.getAnimationDuration());
}
}
/**
* @param {?=} result
* @return {?}
*/
close(result) {
this.isOpen = false;
this.updateOverlayStyle();
this.overlayKeyboardDispatcher.remove((/** @type {?} */ (this.overlayRef)));
this.changeDetectorRef.detectChanges();
setTimeout((/**
* @return {?}
*/
() => {
this.updateBodyOverflow();
this.restoreFocus();
this.nzAfterClose.next(result);
this.nzAfterClose.complete();
}), this.getAnimationDuration());
}
/**
* @return {?}
*/
open() {
this.attachOverlay();
this.isOpen = true;
this.overlayKeyboardDispatcher.add((/** @type {?} */ (this.overlayRef)));
this.updateOverlayStyle();
this.updateBodyOverflow();
this.savePreviouslyFocusedElement();
this.trapFocus();
this.changeDetectorRef.detectChanges();
setTimeout((/**
* @return {?}
*/
() => {
this.nzAfterOpen.next();
}), this.getAnimationDuration());
}
/**
* @return {?}
*/
closeClick() {
this.nzOnClose.emit();
}
/**
* @return {?}
*/
maskClick() {
if (this.nzMaskClosable && this.nzMask) {
this.nzOnClose.emit();
}
}
/**
* @private
* @return {?}
*/
attachBodyContent() {
(/** @type {?} */ (this.bodyPortalOutlet)).dispose();
if (this.nzContent instanceof Type) {
/** @type {?} */
const childInjector = new PortalInjector(this.injector, new WeakMap([[NzDrawerRef, this]]));
/** @type {?} */
const componentPortal = new ComponentPortal(this.nzContent, null, childInjector);
/** @type {?} */
const componentRef = (/** @type {?} */ (this.bodyPortalOutlet)).attachComponentPortal(componentPortal);
Object.assign(componentRef.instance, this.nzContentParams);
componentRef.changeDetectorRef.detectChanges();
}
}
/**
* @private
* @return {?}
*/
attachOverlay() {
if (!this.overlayRef) {
this.portal = new TemplatePortal(this.drawerTemplate, this.viewContainerRef);
this.overlayRef = this.overlay.create(this.getOverlayConfig());
}
if (this.overlayRef && !this.overlayRef.hasAttached()) {
this.overlayRef.attach(this.portal);
(/** @type {?} */ (this.overlayRef)).keydownEvents()
.pipe(takeUntil(this.destroy$))
.subscribe((/**
* @param {?} event
* @return {?}
*/
(event) => {
if (event.keyCode === ESCAPE && this.isOpen && this.nzKeyboard) {
this.nzOnClose.emit();
}
}));
this.overlayRef
.detachments()
.pipe(takeUntil(this.destroy$))
.subscribe((/**
* @return {?}
*/
() => {
this.disposeOverlay();
}));
}
}
/**
* @private
* @return {?}
*/
disposeOverlay() {
var _a;
(_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.dispose();
this.overlayRef = null;
}
/**
* @private
* @return {?}
*/
getOverlayConfig() {
return new OverlayConfig({
disposeOnNavigation: this.nzCloseOnNavigation,
positionStrategy: this.overlay.position().global(),
scrollStrategy: this.overlay.scrollStrategies.block()
});
}
/**
* @private
* @return {?}
*/
updateOverlayStyle() {
if (this.overlayRef && this.overlayRef.overlayElement) {
this.renderer.setStyle(this.overlayRef.overlayElement, 'pointer-events', this.isOpen ? 'auto' : 'none');
}
}
/**
* @private
* @return {?}
*/
updateBodyOverflow() {
if (this.overlayRef) {
if (this.isOpen) {
(/** @type {?} */ (this.overlayRef.getConfig().scrollStrategy)).enable();
}
else {
(/** @type {?} */ (this.overlayRef.getConfig().scrollStrategy)).disable();
}
}
}
/**
* @return {?}
*/
savePreviouslyFocusedElement() {
if (this.document && !this.previouslyFocusedElement) {
this.previouslyFocusedElement = (/** @type {?} */ (this.document.activeElement));
// We need the extra check, because IE's svg element has no blur method.
if (this.previouslyFocusedElement && typeof this.previouslyFocusedElement.blur === 'function') {
this.previouslyFocusedElement.blur();
}
}
}
/**
* @private
* @return {?}
*/
trapFocus() {
if (!this.focusTrap && this.overlayRef && this.overlayRef.overlayElement) {
this.focusTrap = this.focusTrapFactory.create((/** @type {?} */ (this.overlayRef)).overlayElement);
this.focusTrap.focusInitialElement();
}
}
/**
* @private
* @return {?}
*/
restoreFocus() {
// We need the extra check, because IE can set the `activeElement` to null in some cases.
if (this.previouslyFocusedElement && typeof this.previouslyFocusedElement.focus === 'function') {
this.previouslyFocusedElement.focus();
}
if (this.focusTrap) {
this.focusTrap.destroy();
}
}
}
NzDrawerComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-drawer',
exportAs: 'nzDrawer',
template: `
<ng-template #drawerTemplate>
<div
class="ant-drawer"
[nzNoAnimation]="nzNoAnimation"
[class.ant-drawer-open]="isOpen"
[class.no-mask]="!nzMask"
[class.ant-drawer-top]="nzPlacement === 'top'"
[class.ant-drawer-bottom]="nzPlacement === 'bottom'"
[class.ant-drawer-right]="nzPlacement === 'right'"
[class.ant-drawer-left]="nzPlacement === 'left'"
[style.transform]="offsetTransform"
[style.transition]="placementChanging ? 'none' : null"
[style.zIndex]="nzZIndex"
>
<div class="ant-drawer-mask" (click)="maskClick()" *ngIf="nzMask" [ngStyle]="nzMaskStyle"></div>
<div
class="ant-drawer-content-wrapper {{ nzWrapClassName }}"
[style.width]="width"
[style.height]="height"
[style.transform]="transform"
[style.transition]="placementChanging ? 'none' : null"
>
<div class="ant-drawer-content">
<div class="ant-drawer-wrapper-body" [style.height]="isLeftOrRight ? '100%' : null">
<div *ngIf="nzTitle || nzClosable" [class.ant-drawer-header]="!!nzTitle" [class.ant-drawer-header-no-title]="!nzTitle">
<div *ngIf="nzTitle" class="ant-drawer-title">
<ng-container *nzStringTemplateOutlet="nzTitle"><div [innerHTML]="nzTitle"></div></ng-container>
</div>
<button *ngIf="nzClosable" (click)="closeClick()" aria-label="Close" class="ant-drawer-close" style="--scroll-bar: 0px;">
<i nz-icon nzType="close"></i>
</button>
</div>
<div class="ant-drawer-body" [ngStyle]="nzBodyStyle">
<ng-template cdkPortalOutlet></ng-template>
<ng-container *ngIf="isTemplateRef(nzContent)">
<ng-container *ngTemplateOutlet="$any(nzContent); context: templateContext"></ng-container>
</ng-container>
<ng-content *ngIf="!nzContent"></ng-content>
</div>
</div>
</div>
</div>
</div>
</ng-template>
`,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush
}] }
];
/** @nocollapse */
NzDrawerComponent.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
{ type: NzConfigService },
{ type: Renderer2 },
{ type: Overlay },
{ type: Injector },
{ type: ChangeDetectorRef },
{ type: ConfigurableFocusTrapFactory },
{ type: ViewContainerRef },
{ type: OverlayKeyboardDispatcher }
];
NzDrawerComponent.propDecorators = {
nzContent: [{ type: Input }],
nzClosable: [{ type: Input }],
nzMaskClosable: [{ type: Input }],
nzMask: [{ type: Input }],
nzCloseOnNavigation: [{ type: Input }],
nzNoAnimation: [{ type: Input }],
nzKeyboard: [{ type: Input }],
nzTitle: [{ type: Input }],
nzPlacement: [{ type: Input }],
nzMaskStyle: [{ type: Input }],
nzBodyStyle: [{ type: Input }],
nzWrapClassName: [{ type: Input }],
nzWidth: [{ type: Input }],
nzHeight: [{ type: Input }],
nzZIndex: [{ type: Input }],
nzOffsetX: [{ type: Input }],
nzOffsetY: [{ type: Input }],
nzVisible: [{ type: Input }],
nzOnViewInit: [{ type: Output }],
nzOnClose: [{ type: Output }],
drawerTemplate: [{ type: ViewChild, args: ['drawerTemplate', { static: true },] }],
bodyPortalOutlet: [{ type: ViewChild, args: [CdkPortalOutlet, { static: false },] }]
};
__decorate([
InputBoolean(),
__metadata("design:type", Boolean)
], NzDrawerComponent.prototype, "nzClosable", void 0);
__decorate([
WithConfig(NZ_CONFIG_COMPONENT_NAME), InputBoolean(),
__metadata("design:type", Boolean)
], NzDrawerComponent.prototype, "nzMaskClosable", void 0);
__decorate([
WithConfig(NZ_CONFIG_COMPONENT_NAME), InputBoolean(),
__metadata("design:type", Boolean)
], NzDrawerComponent.prototype, "nzMask", void 0);
__decorate([
WithConfig(NZ_CONFIG_COMPONENT_NAME), InputBoolean(),
__metadata("design:type", Boolean)
], NzDrawerComponent.prototype, "nzCloseOnNavigation", void 0);
__decorate([
InputBoolean(),
__metadata("design:type", Object)
], NzDrawerComponent.prototype, "nzNoAnimation", void 0);
__decorate([
InputBoolean(),
__metadata("design:type", Boolean)
], NzDrawerComponent.prototype, "nzKeyboard", void 0);
if (false) {
/** @type {?} */
NzDrawerComponent.ngAcceptInputType_nzClosable;
/** @type {?} */
NzDrawerComponent.ngAcceptInputType_nzMaskClosable;
/** @type {?} */
NzDrawerComponent.ngAcceptInputType_nzMask;
/** @type {?} */
NzDrawerComponent.ngAcceptInputType_nzNoAnimation;
/** @type {?} */
NzDrawerComponent.ngAcceptInputType_nzKeyboard;
/** @type {?} */
NzDrawerComponent.ngAcceptInputType_nzCloseOnNavigation;
/** @type {?} */
NzDrawerComponent.prototype.nzContent;
/** @type {?} */
NzDrawerComponent.prototype.nzClosable;
/** @type {?} */
NzDrawerComponent.prototype.nzMaskClosable;
/** @type {?} */
NzDrawerComponent.prototype.nzMask;
/** @type {?} */
NzDrawerComponent.prototype.nzCloseOnNavigation;
/** @type {?} */
NzDrawerComponent.prototype.nzNoAnimation;
/** @type {?} */
NzDrawerComponent.prototype.nzKeyboard;
/** @type {?} */
NzDrawerComponent.prototype.nzTitle;
/** @type {?} */
NzDrawerComponent.prototype.nzPlacement;
/** @type {?} */
NzDrawerComponent.prototype.nzMaskStyle;
/** @type {?} */
NzDrawerComponent.prototype.nzBodyStyle;
/** @type {?} */
NzDrawerComponent.prototype.nzWrapClassName;
/** @type {?} */
NzDrawerComponent.prototype.nzWidth;
/** @type {?} */
NzDrawerComponent.prototype.nzHeight;
/** @type {?} */
NzDrawerComponent.prototype.nzZIndex;
/** @type {?} */
NzDrawerComponent.prototype.nzOffsetX;
/** @type {?} */
NzDrawerComponent.prototype.nzOffsetY;
/** @type {?} */
NzDrawerComponent.prototype.nzOnViewInit;
/** @type {?} */
NzDrawerComponent.prototype.nzOnClose;
/** @type {?} */
NzDrawerComponent.prototype.drawerTemplate;
/** @type {?} */
NzDrawerComponent.prototype.bodyPortalOutlet;
/** @type {?} */
NzDrawerComponent.prototype.destroy$;
/** @type {?} */
NzDrawerComponent.prototype.previouslyFocusedElement;
/** @type {?} */
NzDrawerComponent.prototype.placementChanging;
/** @type {?} */
NzDrawerComponent.prototype.placementChangeTimeoutId;
/** @type {?} */
NzDrawerComponent.prototype.nzContentParams;
/** @type {?} */
NzDrawerComponent.prototype.overlayRef;
/** @type {?} */
NzDrawerComponent.prototype.portal;
/** @type {?} */
NzDrawerComponent.prototype.focusTrap;
/** @type {?} */
NzDrawerComponent.prototype.isOpen;
/** @type {?} */
NzDrawerComponent.prototype.templateContext;
/** @type {?} */
NzDrawerComponent.prototype.nzAfterOpen;
/** @type {?} */
NzDrawerComponent.prototype.nzAfterClose;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.document;
/** @type {?} */
NzDrawerComponent.prototype.nzConfigService;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.renderer;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.overlay;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.injector;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.changeDetectorRef;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.focusTrapFactory;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.viewContainerRef;
/**
* @type {?}
* @private
*/
NzDrawerComponent.prototype.overlayKeyboardDispatcher;
}
/**
* @fileoverview added by tsickle
* Generated from: drawer.service.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzDrawerServiceModule {
}
NzDrawerServiceModule.decorators = [
{ type: NgModule }
];
/**
* @fileoverview added by tsickle
* Generated from: drawer.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzDrawerModule {
}
NzDrawerModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule, OverlayModule, PortalModule, NzIconModule, NzOutletModule, NzNoAnimationModule, NzDrawerServiceModule],
exports: [NzDrawerComponent],
declarations: [NzDrawerComponent],
entryComponents: [NzDrawerComponent]
},] }
];
/**
* @fileoverview added by tsickle
* Generated from: drawer.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @template R
*/
class DrawerBuilderForService {
/**
* @param {?} overlay
* @param {?} options
*/
constructor(overlay, options) {
this.overlay = overlay;
this.options = options;
this.unsubscribe$ = new Subject();
/**
* pick {\@link NzDrawerOptions.nzOnCancel} and omit this option
*/
const _a = this.options, { nzOnCancel } = _a, componentOption = __rest(_a, ["nzOnCancel"]);
this.overlayRef = this.overlay.create();
this.drawerRef = this.overlayRef.attach(new ComponentPortal(NzDrawerComponent));
this.updateOptions(componentOption);
// Prevent repeatedly open drawer when tap focus element.
(/** @type {?} */ (this.drawerRef)).instance.savePreviouslyFocusedElement();
(/** @type {?} */ (this.drawerRef)).instance.nzOnViewInit.pipe(takeUntil(this.unsubscribe$)).subscribe((/**
* @return {?}
*/
() => {
(/** @type {?} */ (this.drawerRef)).instance.open();
}));
(/** @type {?} */ (this.drawerRef)).instance.nzOnClose.subscribe((/**
* @return {?}
*/
() => {
if (nzOnCancel) {
nzOnCancel().then((/**
* @param {?} canClose
* @return {?}
*/
canClose => {
if (canClose !== false) {
(/** @type {?} */ (this.drawerRef)).instance.close();
}
}));
}
else {
(/** @type {?} */ (this.drawerRef)).instance.close();
}
}));
(/** @type {?} */ (this.drawerRef)).instance.afterClose.pipe(takeUntil(this.unsubscribe$)).subscribe((/**
* @return {?}
*/
() => {
this.overlayRef.dispose();
this.drawerRef = null;
this.unsubscribe$.next();
this.unsubscribe$.complete();
}));
}
/**
* @return {?}
*/
getInstance() {
return (/** @type {?} */ (this.drawerRef)) && (/** @type {?} */ (this.drawerRef)).instance;
}
/**
* @param {?} options
* @return {?}
*/
updateOptions(options) {
Object.assign((/** @type {?} */ (this.drawerRef)).instance, options);
}
}
if (false) {
/**
* @type {?}
* @private
*/
DrawerBuilderForService.prototype.drawerRef;
/**
* @type {?}
* @private
*/
DrawerBuilderForService.prototype.overlayRef;
/**
* @type {?}
* @private
*/
DrawerBuilderForService.prototype.unsubscribe$;
/**
* @type {?}
* @private
*/
DrawerBuilderForService.prototype.overlay;
/**
* @type {?}
* @private
*/
DrawerBuilderForService.prototype.options;
}
class NzDrawerService {
/**
* @param {?} overlay
*/
constructor(overlay) {
this.overlay = overlay;
}
/**
* @template T, D, R
* @param {?} options
* @return {?}
*/
create(options) {
return new DrawerBuilderForService(this.overlay, options).getInstance();
}
}
NzDrawerService.decorators = [
{ type: Injectable, args: [{ providedIn: NzDrawerServiceModule },] }
];
/** @nocollapse */
NzDrawerService.ctorParameters = () => [
{ type: Overlay }
];
/** @nocollapse */ NzDrawerService.ɵprov = ɵɵdefineInjectable({ factory: function NzDrawerService_Factory() { return new NzDrawerService(ɵɵinject(Overlay)); }, token: NzDrawerService, providedIn: NzDrawerServiceModule });
if (false) {
/**
* @type {?}
* @private
*/
NzDrawerService.prototype.overlay;
}
/**
* @fileoverview added by tsickle
* Generated from: drawer-options.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
/**
* @record
* @template T, D
*/
function NzDrawerOptionsOfComponent() { }
if (false) {
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzClosable;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzMaskClosable;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzCloseOnNavigation;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzMask;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzKeyboard;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzNoAnimation;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzTitle;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzContent;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzContentParams;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzMaskStyle;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzBodyStyle;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzWrapClassName;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzWidth;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzHeight;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzPlacement;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzZIndex;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzOffsetX;
/** @type {?|undefined} */
NzDrawerOptionsOfComponent.prototype.nzOffsetY;
}
/**
* @record
* @template T, D
*/
function NzDrawerOptions() { }
if (false) {
/**
* @return {?}
*/
NzDrawerOptions.prototype.nzOnCancel = function () { };
}
/**
* @fileoverview added by tsickle
* Generated from: public-api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: ng-zorro-antd-drawer.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { DRAWER_ANIMATE_DURATION, DrawerBuilderForService, NzDrawerComponent, NzDrawerModule, NzDrawerRef, NzDrawerService, NzDrawerServiceModule };
//# sourceMappingURL=ng-zorro-antd-drawer.js.map