ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
238 lines (225 loc) • 10.7 kB
TypeScript
import * as i0 from '@angular/core';
import { TemplateRef, ComponentRef, Type, InjectionToken, OnInit, AfterViewInit, OnChanges, EventEmitter, SimpleChanges } from '@angular/core';
import { Direction } from '@angular/cdk/bidi';
import { NzSafeAny, NgStyleInterface } from 'ng-zorro-antd/core/types';
import { Observable, Subject } from 'rxjs';
import { FocusTrap } from '@angular/cdk/a11y';
import { OverlayRef, Overlay } from '@angular/cdk/overlay';
import { CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
import { NzConfigService, NzConfigKey } from 'ng-zorro-antd/core/config';
import { isTemplateRef } from 'ng-zorro-antd/core/util';
/**
* 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
*/
declare class NzDrawerContentDirective {
templateRef: TemplateRef<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<NzDrawerContentDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NzDrawerContentDirective, "[nzDrawerContent]", ["nzDrawerContent"], {}, {}, never, never, true, never>;
}
/**
* 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
*/
declare abstract class NzDrawerRef<T = NzSafeAny, R = NzSafeAny> {
abstract afterClose: Observable<R | undefined>;
abstract afterOpen: Observable<void>;
abstract close(result?: R): void;
abstract open(): void;
abstract getContentComponent(): T | null;
abstract getContentComponentRef(): Readonly<ComponentRef<T>> | null;
abstract nzClosable?: boolean;
abstract nzNoAnimation?: boolean;
abstract nzMaskClosable?: boolean;
abstract nzKeyboard?: boolean;
abstract nzMask?: boolean;
abstract nzTitle?: string | TemplateRef<{}>;
abstract nzPlacement?: NzDrawerPlacement;
abstract nzMaskStyle?: object;
abstract nzBodyStyle?: object;
abstract nzWrapClassName?: string;
abstract nzWidth?: number | string;
abstract nzHeight?: number | string;
abstract nzZIndex?: number | string;
abstract nzOffsetX?: number | string;
abstract nzOffsetY?: number | string;
}
/**
* 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
*/
declare const DRAWER_DEFAULT_SIZE = 378;
declare const DRAWER_LARGE_SIZE = 736;
type NzDrawerPlacement = 'left' | 'right' | 'top' | 'bottom';
type NzDrawerSize = 'default' | 'large';
interface NzDrawerOptionsOfComponent<T = NzSafeAny, D = NzSafeAny> {
nzClosable?: boolean;
nzMaskClosable?: boolean;
nzCloseOnNavigation?: boolean;
nzDirection?: Direction;
nzMask?: boolean;
nzKeyboard?: boolean;
nzNoAnimation?: boolean;
nzTitle?: string | TemplateRef<{}>;
nzExtra?: string | TemplateRef<{}>;
nzFooter?: string | TemplateRef<{}>;
nzContent?: TemplateRef<{
$implicit: D;
drawerRef: NzDrawerRef;
}> | Type<T>;
/**@Deprecated**/
nzContentParams?: Partial<T & D>;
nzData?: D;
nzMaskStyle?: object;
nzBodyStyle?: object;
nzWrapClassName?: string;
nzSize?: NzDrawerSize;
nzWidth?: number | string;
nzHeight?: number | string;
nzPlacement?: NzDrawerPlacement;
nzZIndex?: number;
nzOffsetX?: number;
nzOffsetY?: number;
}
interface NzDrawerOptions<T = NzSafeAny, D = NzSafeAny> extends NzDrawerOptionsOfComponent<T, D> {
nzOnCancel?(): Promise<NzSafeAny>;
}
declare const NZ_DRAWER_DATA: InjectionToken<any>;
/**
* 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
*/
declare const DRAWER_ANIMATE_DURATION = 300;
declare class NzDrawerComponent<T extends {} = NzSafeAny, R = NzSafeAny, D extends Partial<T> = NzSafeAny> extends NzDrawerRef<T, R> implements OnInit, AfterViewInit, OnChanges, NzDrawerOptionsOfComponent {
private cdr;
nzConfigService: NzConfigService;
private renderer;
private overlay;
private injector;
private changeDetectorRef;
private focusTrapFactory;
private viewContainerRef;
private overlayKeyboardDispatcher;
private directionality;
private destroyRef;
readonly _nzModuleName: NzConfigKey;
nzContent: TemplateRef<{
$implicit: D;
drawerRef: NzDrawerRef<R>;
}> | Type<T>;
nzCloseIcon: string | TemplateRef<void>;
nzClosable: boolean;
nzMaskClosable: boolean;
nzMask: boolean;
nzCloseOnNavigation: boolean;
nzNoAnimation: boolean;
nzKeyboard: boolean;
nzTitle?: string | TemplateRef<{}>;
nzExtra?: string | TemplateRef<{}>;
nzFooter?: string | TemplateRef<{}>;
nzPlacement: NzDrawerPlacement;
nzSize: NzDrawerSize;
nzMaskStyle: NgStyleInterface;
nzBodyStyle: NgStyleInterface;
nzWrapClassName?: string;
nzWidth?: number | string;
nzHeight?: number | string;
nzZIndex: number;
nzOffsetX: number;
nzOffsetY: number;
private componentInstance;
private componentRef;
set nzVisible(value: boolean);
get nzVisible(): boolean;
readonly nzOnViewInit: EventEmitter<void>;
readonly nzOnClose: EventEmitter<MouseEvent>;
readonly nzVisibleChange: EventEmitter<boolean>;
drawerTemplate: TemplateRef<void>;
bodyPortalOutlet?: CdkPortalOutlet;
contentFromContentChild?: TemplateRef<NzSafeAny>;
previouslyFocusedElement?: HTMLElement;
placementChanging: boolean;
placementChangeTimeoutId?: ReturnType<typeof setTimeout>;
nzContentParams?: NzSafeAny;
nzData?: D;
overlayRef?: OverlayRef | null;
portal?: TemplatePortal;
focusTrap?: FocusTrap;
isOpen: boolean;
inAnimation: boolean;
templateContext: {
$implicit: D | undefined;
drawerRef: NzDrawerRef<R>;
};
protected isTemplateRef: typeof isTemplateRef;
get offsetTransform(): string | null;
get transform(): string | null;
get width(): string | null;
get height(): string | null;
get isLeftOrRight(): boolean;
nzAfterOpen: Subject<void>;
nzAfterClose: Subject<R | undefined>;
get afterOpen(): Observable<void>;
get afterClose(): Observable<R | undefined>;
get isNzContentTemplateRef(): boolean;
nzDirection?: Direction;
dir: Direction;
private document;
constructor();
ngOnInit(): void;
ngAfterViewInit(): void;
ngOnChanges(changes: SimpleChanges): void;
private getAnimationDuration;
private triggerPlacementChangeCycleOnce;
close(result?: R): void;
open(): void;
getContentComponent(): T | null;
getContentComponentRef(): ComponentRef<T> | null;
closeClick(): void;
maskClick(): void;
private attachBodyContent;
private attachOverlay;
private disposeOverlay;
private getOverlayConfig;
private updateOverlayStyle;
private updateBodyOverflow;
savePreviouslyFocusedElement(): void;
private trapFocus;
private restoreFocus;
static ɵfac: i0.ɵɵFactoryDeclaration<NzDrawerComponent<any, any, any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzDrawerComponent<any, any, any>, "nz-drawer", ["nzDrawer"], { "nzContent": { "alias": "nzContent"; "required": false; }; "nzCloseIcon": { "alias": "nzCloseIcon"; "required": false; }; "nzClosable": { "alias": "nzClosable"; "required": false; }; "nzMaskClosable": { "alias": "nzMaskClosable"; "required": false; }; "nzMask": { "alias": "nzMask"; "required": false; }; "nzCloseOnNavigation": { "alias": "nzCloseOnNavigation"; "required": false; }; "nzNoAnimation": { "alias": "nzNoAnimation"; "required": false; }; "nzKeyboard": { "alias": "nzKeyboard"; "required": false; }; "nzTitle": { "alias": "nzTitle"; "required": false; }; "nzExtra": { "alias": "nzExtra"; "required": false; }; "nzFooter": { "alias": "nzFooter"; "required": false; }; "nzPlacement": { "alias": "nzPlacement"; "required": false; }; "nzSize": { "alias": "nzSize"; "required": false; }; "nzMaskStyle": { "alias": "nzMaskStyle"; "required": false; }; "nzBodyStyle": { "alias": "nzBodyStyle"; "required": false; }; "nzWrapClassName": { "alias": "nzWrapClassName"; "required": false; }; "nzWidth": { "alias": "nzWidth"; "required": false; }; "nzHeight": { "alias": "nzHeight"; "required": false; }; "nzZIndex": { "alias": "nzZIndex"; "required": false; }; "nzOffsetX": { "alias": "nzOffsetX"; "required": false; }; "nzOffsetY": { "alias": "nzOffsetY"; "required": false; }; "nzVisible": { "alias": "nzVisible"; "required": false; }; }, { "nzOnViewInit": "nzOnViewInit"; "nzOnClose": "nzOnClose"; "nzVisibleChange": "nzVisibleChange"; }, ["contentFromContentChild"], never, true, never>;
static ngAcceptInputType_nzClosable: unknown;
static ngAcceptInputType_nzMaskClosable: unknown;
static ngAcceptInputType_nzMask: unknown;
static ngAcceptInputType_nzCloseOnNavigation: unknown;
static ngAcceptInputType_nzNoAnimation: unknown;
static ngAcceptInputType_nzKeyboard: unknown;
static ngAcceptInputType_nzVisible: unknown;
}
declare class NzDrawerModule {
static ɵfac: i0.ɵɵFactoryDeclaration<NzDrawerModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<NzDrawerModule, never, [typeof NzDrawerComponent, typeof NzDrawerContentDirective], [typeof NzDrawerComponent, typeof NzDrawerContentDirective]>;
static ɵinj: i0.ɵɵInjectorDeclaration<NzDrawerModule>;
}
/**
* 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
*/
declare class DrawerBuilderForService<T extends {}, R> {
private overlay;
private options;
private drawerRef;
private overlayRef;
private unsubscribe$;
constructor(overlay: Overlay, options: NzDrawerOptions);
getInstance(): NzDrawerRef<T, R>;
updateOptions(options: NzDrawerOptionsOfComponent): void;
}
declare class NzDrawerService {
private overlay;
create<T extends {} = NzSafeAny, D = undefined, R = NzSafeAny>(options: NzDrawerOptions<T, D extends undefined ? {} : D>): NzDrawerRef<T, R>;
static ɵfac: i0.ɵɵFactoryDeclaration<NzDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NzDrawerService>;
}
export { DRAWER_ANIMATE_DURATION, DRAWER_DEFAULT_SIZE, DRAWER_LARGE_SIZE, DrawerBuilderForService, NZ_DRAWER_DATA, NzDrawerComponent, NzDrawerContentDirective, NzDrawerModule, NzDrawerRef, NzDrawerService };
export type { NzDrawerOptions, NzDrawerOptionsOfComponent, NzDrawerPlacement, NzDrawerSize };