Merge pull request #9264 from abbasmhd/master

add clearOptions to force clearing a toast
This commit is contained in:
Boris Yankov
2016-05-24 06:39:25 +03:00
2 changed files with 131 additions and 11 deletions
+123 -10
View File
@@ -1,10 +1,15 @@
// Type definitions for jquery.pnotify 2.x
// Type definitions for jquery.pnotify 3.x
// Project: https://github.com/sciactive/pnotify
// Definitions by: David Sichau <https://github.com/DavidSichau>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
// could not pass the Travis Test if enabled
//type NoticeTypeOptions = "notice" | "info" | "success" | "error";
//type StylingOptions = "brighttheme" | "jqueryui" | "bootstrap2" | "bootstrap3" | "fontawesome";
//type StateOptions = "initializing" | "opening" | "open" | "closing" | "closed";
interface PNotifyStack {
dir1?: string;
dir2?: string;
@@ -24,11 +29,98 @@ interface PNotifyLabel {
stick?: string;
}
interface PNotifyconfirmButton {
text?: string;
addClass?: string;
/**
* Whether to trigger this button when the user hits enter in a single line prompt.
*/
promptTrigger?: boolean;
click: (notice: PNotify, value: any) => void
}
interface PNotifyconfirm {
/**
* Make a confirmation box.
*/
confirm?: boolean;
/**
* Make a prompt.
*/
prompt?: boolean;
/**
* Classes to add to the input element of the prompt.
*/
prompt_class?: string
/**
* The default value of the prompt.
*/
prompt_default?: string
/**
* Whether the prompt should accept multiple lines of text.
*/
prompt_multi_line?: boolean;
/**
* Where to align the buttons. (right, center, left, justify)
*/
align?: string;
/**
* The buttons to display, and their callbacks.
*/
buttons?: PNotifyconfirmButton[];
}
interface PNotifyButtons {
/**
* Provide a button for the user to manually close the notice.
*/
closer?: boolean;
/**
* Only show the closer button on hover.
*/
closer_hover?: boolean;
/**
* Provide a button for the user to manually stick the notice.
*/
sticker?: boolean;
/**
* Only show the sticker button on hover.
*/
sticker_hover?: boolean;
/**
* Show the buttons even when the nonblock module is in use.
*/
show_on_nonblock?: boolean;
/**
* The various displayed text, helps facilitating internationalization.
*/
labels?: {
close?: string;
stick?: string;
unstick?: string;
};
/**
* The classes to use for button icons. Leave them null to use the classes from the styling you're using.
*/
classes?: {
closer?: string;
pin_up?: string;
pin_down?: string;
};
}
interface PNotifyOptions {
/**
* The notice's title. Either boolean false or string
*/
title?: any;
title?: string | boolean;
/**
* Whether to escape the content of the title. (Not allow HTML.)
*/
@@ -36,13 +128,13 @@ interface PNotifyOptions {
/**
* The notice's text. Either boolean false or string
*/
text?: any;
text?: string | boolean;
/**
* Whether to escape the content of the text. (Not allow HTML.)
*/
text_escape?: boolean;
/**
* What styling classes to use. (Can be either jqueryui or bootstrap.)
* What styling classes to use. (Can be either "brighttheme", "jqueryui", "bootstrap2", "bootstrap3", or "fontawesome".)
*/
styling?: string;
/**
@@ -58,7 +150,7 @@ interface PNotifyOptions {
/**
* Create a non-blocking notice. It lets the user click elements underneath it.
*/
nonblock: boolean;
nonblock?: boolean;
/**
* The opacity of the notice (if it's non-blocking) when the mouse is over it.
@@ -166,17 +258,38 @@ interface PNotifyOptions {
}
interface PNotify {
elem: JQuery;
update(options?: PNotifyOptions): void;
/**
* The state can be "initializing", "opening", "open", "closing", and "closed"
*/
state?: string;
/**
* This function is for updating the notice.
*/
update(options?: PNotifyOptions): PNotify;
/**
* Remove the notice.
*/
remove(): void;
/**
* Display the notice.
*/
open(): void;
/**
* Get the DOM element.
*/
get(): JQuery;
}
interface PNotifyConstructor {
new (options?: PNotifyOptions): PNotify;
removeAll(): void;
}
declare var PNotify: PNotifyConstructor;
+8 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Toastr 2.0.1
// Type definitions for Toastr 2.1.1
// Project: https://github.com/CodeSeven/toastr
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -174,6 +174,13 @@ interface Toastr {
* @param toast Toast to clear
*/
(toast: JQuery): void;
/**
* Clear specific toast
*
* @param toast Toast to clear
* @param clearOptions force clearing a toast, ignoring focus
*/
(toast: JQuery, clearOptions: { force: boolean }): void;
};
/**
* Create an error toast