ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
115 lines • 5.18 kB
TypeScript
import * as i0 from "@angular/core";
import { ElementRef, EventEmitter, TemplateRef } from "@angular/core";
import { NzMNComponent, NzMNContainerComponent, NzMNService } from "ng-zorro-antd/message";
import { Subject } from "rxjs";
import { NgClassInterface, NgStyleInterface, NzSafeAny } from "ng-zorro-antd/core/types";
import { Direction } from "@angular/cdk/bidi";
import { NotificationConfig } from "ng-zorro-antd/core/config";
export type NzNotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'top' | 'bottom';
export type NzNotificationContentType = string | TemplateRef<void | {
$implicit: NzNotificationComponent;
data: NzSafeAny;
}>;
export interface NzNotificationDataOptions<T = {}> {
nzKey?: string;
nzStyle?: NgStyleInterface;
nzClass?: NgClassInterface | string;
nzCloseIcon?: TemplateRef<void> | string;
nzButton?: TemplateRef<{
$implicit: NzNotificationComponent;
}>;
nzPlacement?: NzNotificationPlacement;
nzData?: T;
nzDuration?: number;
nzAnimate?: boolean;
nzPauseOnHover?: boolean;
}
export interface NzNotificationData {
title?: string | TemplateRef<void>;
content?: NzNotificationContentType;
createdAt?: Date;
messageId?: string;
options?: NzNotificationDataOptions;
state?: 'enter' | 'leave';
template?: TemplateRef<{}>;
type?: 'success' | 'info' | 'warning' | 'error' | 'blank' | string;
onClose?: Subject<boolean>;
onClick?: Subject<MouseEvent>;
}
export type NzNotificationRef = Pick<Required<NzNotificationData>, 'onClose' | 'onClick' | 'messageId'>;
export declare class NzNotificationComponent extends NzMNComponent {
instance: Required<NzNotificationData>;
index: number;
placement?: string;
readonly destroyed: EventEmitter<{
id: string;
userAction: boolean;
}>;
readonly animationElement: import("@angular/core").Signal<ElementRef<any>>;
protected readonly _animationKeyframeMap: {
enter: string[];
leave: string;
};
protected readonly _animationClassMap: {
enter: string;
leave: string;
};
constructor();
onClick(event: MouseEvent): void;
close(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NzNotificationComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzNotificationComponent, "nz-notification", ["nzNotification"], {
"instance": {
"alias": "instance";
"required": false;
};
"index": {
"alias": "index";
"required": false;
};
"placement": {
"alias": "placement";
"required": false;
};
}, {
"destroyed": "destroyed";
}, never, never, true, never>;
}
export declare class NzNotificationContainerComponent extends NzMNContainerComponent<NotificationConfig, NzNotificationData> {
dir: Direction;
bottom?: string | null;
top?: string | null;
topLeftInstances: Array<Required<NzNotificationData>>;
topRightInstances: Array<Required<NzNotificationData>>;
bottomLeftInstances: Array<Required<NzNotificationData>>;
bottomRightInstances: Array<Required<NzNotificationData>>;
topInstances: Array<Required<NzNotificationData>>;
bottomInstances: Array<Required<NzNotificationData>>;
constructor();
create(notification: NzNotificationData): Required<NzNotificationData>;
protected onCreate(instance: NzNotificationData): Required<NzNotificationData>;
protected subscribeConfigChange(): void;
protected updateConfig(): void;
private replaceNotification;
protected readyInstances(): void;
protected mergeOptions(options?: NzNotificationDataOptions): NzNotificationDataOptions;
static ɵfac: i0.ɵɵFactoryDeclaration<NzNotificationContainerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzNotificationContainerComponent, "nz-notification-container", ["nzNotificationContainer"], {}, {}, never, never, true, never>;
}
export declare class NzNotificationService extends NzMNService<NzNotificationContainerComponent> {
protected componentPrefix: string;
success(title: string | TemplateRef<void>, content: NzNotificationContentType, options?: NzNotificationDataOptions): NzNotificationRef;
error(title: string | TemplateRef<void>, content: NzNotificationContentType, options?: NzNotificationDataOptions): NzNotificationRef;
info(title: string | TemplateRef<void>, content: NzNotificationContentType, options?: NzNotificationDataOptions): NzNotificationRef;
warning(title: string | TemplateRef<void>, content: NzNotificationContentType, options?: NzNotificationDataOptions): NzNotificationRef;
blank(title: string | TemplateRef<void>, content: NzNotificationContentType, options?: NzNotificationDataOptions): NzNotificationRef;
create(type: 'success' | 'info' | 'warning' | 'error' | 'blank' | string, title: string | TemplateRef<void>, content: NzNotificationContentType, options?: NzNotificationDataOptions): NzNotificationRef;
template(template: TemplateRef<{
$implicit: NzNotificationComponent;
data: NzSafeAny;
}>, options?: NzNotificationDataOptions): NzNotificationRef;
protected generateMessageId(): string;
private createInstance;
static ɵfac: i0.ɵɵFactoryDeclaration<NzNotificationService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
}