115 lines
5.6 KiB
TypeScript
115 lines
5.6 KiB
TypeScript
import * as i0 from '@angular/core';
|
|
import { TemplateRef, EventEmitter } from '@angular/core';
|
|
import { NzMNComponent, NzMNContainerComponent, NzMNService } from 'ng-zorro-antd/message';
|
|
import { Subject } from 'rxjs';
|
|
import { NzSafeAny, NgStyleInterface, NgClassInterface } from 'ng-zorro-antd/core/types';
|
|
import { Direction } from '@angular/cdk/bidi';
|
|
import { NotificationConfig } from 'ng-zorro-antd/core/config';
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
type NzNotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'top' | 'bottom';
|
|
type NzNotificationContentType = string | TemplateRef<void | {
|
|
$implicit: NzNotificationComponent;
|
|
data: NzSafeAny;
|
|
}>;
|
|
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;
|
|
}
|
|
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>;
|
|
}
|
|
type NzNotificationRef = Pick<Required<NzNotificationData>, 'onClose' | 'onClick' | 'messageId'>;
|
|
|
|
declare class NzNotificationComponent extends NzMNComponent {
|
|
instance: Required<NzNotificationData>;
|
|
index: number;
|
|
placement?: string;
|
|
readonly destroyed: EventEmitter<{
|
|
id: string;
|
|
userAction: boolean;
|
|
}>;
|
|
constructor();
|
|
onClick(event: MouseEvent): void;
|
|
close(): void;
|
|
get state(): string | undefined;
|
|
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>;
|
|
}
|
|
|
|
/**
|
|
* 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 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>;
|
|
}
|
|
|
|
/**
|
|
* 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 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<NzNotificationService>;
|
|
}
|
|
|
|
export { NzNotificationComponent, NzNotificationContainerComponent, NzNotificationService };
|
|
export type { NzNotificationContentType, NzNotificationData, NzNotificationDataOptions, NzNotificationPlacement, NzNotificationRef };
|