NotificationBase
TypeScript notification component for extending with all features described and partially implemented.
Installing
Using npm:
$ npm install @etsoo/notificationbase
Using yarn:
$ yarn add @etsoo/notificationbase
Notification
Notification object to display. INotification is the interface. INotificationBase is for data definition.
Properties:
align | Readonly, display align |
content | Content to display |
id | Unique id |
inputProps | Input or additional control properties |
modal | Display as modal window or not |
onDismiss | Dismiss callback |
onReturn | Return value callback |
open | Is open or not |
ref | Render result reference |
renderSetup | Setup callback before render |
showIcon | Show icon or not |
timespan | Seconds to auto dismiss |
title | Title |
type | Notification type |
Methods:
constructor(
type: NotificationType,
content: NotificationContent<UI>,
title?: NotificationContent<UI>,
align?: NotificationAlign
)
dismiss(delaySeconds: number = 0): boolean
dispose()
render(
props: NotificationRenderProps,
className?: string,
options?: any
): UI | undefined;
returnValue(value: any): Promise<void>;
NotificationContainer
NotificationContainer is to hold all notifications. INotificationContainer is the interface.
Properties:
notifications | Readonly. Notification collection to display |
isLoading | Is loading bar showing |
isModeling | Is model window showing |
Methods:
add(notification: INotification<UI, C>, top?: boolean): void;
alert(
error: NotificationContent<UI> | [NotificationContent<UI>, NotificationContent<UI>],
callback?: NotificationReturn<void>,
type?: NotificationMessageType,
props?: C
): INotification<UI, C>;
alignCount(align: NotificationAlign): number;
alignOpenCount(align: NotificationAlign): number;
clear(): void;
confirm(
message: NotificationContent<UI>,
title?: NotificationContent<UI>,
callback?: NotificationReturn<boolean>,
props?: C
): INotification<UI, C>;
dispose(): void;
get(align: NotificationAlign, id: string): INotification<UI, C> | undefined;
getById(id: string): INotification<UI, C> | undefined;
hideLoading(force?: boolean): void;
message(
type: NotificationMessageType,
message: NotificationContent<UI>,
title?: NotificationContent<UI>,
parameters?: NotificationParameters,
props?: C
): INotification<UI, C>;
popup(
component: NotificationContent<UI>,
anchor?: HTMLElement | string | { left: number; top: number }
): INotification<UI, C>;
prompt<T = string>(
message: NotificationContent<UI>,
callback: NotificationReturn<T>,
title?: NotificationContent<UI>,
props?: C
): INotification<UI, C>;
showLoading(title?: NotificationContent<UI>): void;
succeed(
message: NotificationContent<UI>,
title?: NotificationContent<UI>,
callback?: NotificationReturn<void>,
timespan?: number,
props?: C
): INotification<UI, C>;