@nextcloud/dialogs
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -5,2 +5,6 @@ # Changelog | ||
## 1.2.0 - 2020-03-03 | ||
### Added | ||
- Configurable Toasts selector (for tests) | ||
## 1.1.0 - 2020-02-04 | ||
@@ -7,0 +11,0 @@ ### Added |
@@ -30,5 +30,3 @@ "use strict"; | ||
var FilePicker = | ||
/*#__PURE__*/ | ||
function () { | ||
var FilePicker = /*#__PURE__*/function () { | ||
function FilePicker(title, multiSelect, mimeTypeFilter, modal, type, directoriesAllowed, path) { | ||
@@ -64,5 +62,3 @@ _classCallCheck(this, FilePicker); | ||
var FilePickerBuilder = | ||
/*#__PURE__*/ | ||
function () { | ||
var FilePickerBuilder = /*#__PURE__*/function () { | ||
function FilePickerBuilder(title) { | ||
@@ -69,0 +65,0 @@ _classCallCheck(this, FilePickerBuilder); |
@@ -10,3 +10,3 @@ declare class ToastType { | ||
/** | ||
* Defines the timeout after which the toast is closed. Set to 0 to have a persistent toast. | ||
* Defines the timeout after which the toast is closed. Set to -1 to have a persistent toast. | ||
*/ | ||
@@ -22,7 +22,7 @@ timeout?: number; | ||
*/ | ||
type?: ToastType | undefined; | ||
type?: ToastType; | ||
/** | ||
* Provide a function that is called after the toast is shown | ||
* Provide a function that is called after the toast is removed | ||
*/ | ||
onShow?: Function; | ||
onRemove?: Function; | ||
/** | ||
@@ -36,2 +36,6 @@ * Provide a function that is called when the toast is clicked | ||
close?: Boolean; | ||
/** | ||
* Specify the element to attach the toast element to (for testing) | ||
*/ | ||
selector?: string; | ||
} | ||
@@ -38,0 +42,0 @@ /** |
@@ -63,3 +63,4 @@ "use strict"; | ||
type: undefined, | ||
onShow: function onShow() {}, | ||
selector: 'body-user', | ||
onRemove: function onRemove() {}, | ||
onClick: function onClick() {}, | ||
@@ -80,7 +81,7 @@ close: true | ||
duration: options.timeout ? options.timeout * 1000 : null, | ||
callback: options.onShow, | ||
callback: options.onRemove, | ||
onClick: options.onClick, | ||
close: options.close, | ||
gravity: 'top', | ||
selector: 'body-user', | ||
selector: options.selector, | ||
position: 'right', | ||
@@ -87,0 +88,0 @@ backgroundColor: '', |
@@ -13,5 +13,6 @@ import Toastify from 'toastify-js' | ||
/** | ||
* Defines the timeout after which the toast is closed. Set to 0 to have a persistent toast. | ||
* Defines the timeout after which the toast is closed. Set to -1 to have a persistent toast. | ||
*/ | ||
timeout?: number; | ||
timeout?: number | ||
/** | ||
@@ -21,19 +22,28 @@ * Set to true to allow HTML content inside of the toast text | ||
*/ | ||
isHTML?: Boolean; | ||
isHTML?: Boolean | ||
/** | ||
* Set a type of {ToastType} to style the modal | ||
*/ | ||
type?: ToastType|undefined; | ||
type?: ToastType | ||
/** | ||
* Provide a function that is called after the toast is shown | ||
* Provide a function that is called after the toast is removed | ||
*/ | ||
onShow?: Function, | ||
onRemove?: Function | ||
/** | ||
* Provide a function that is called when the toast is clicked | ||
*/ | ||
onClick?: Function, | ||
onClick?: Function | ||
/** | ||
* Make the toast closable | ||
*/ | ||
close?: Boolean; | ||
close?: Boolean | ||
/** | ||
* Specify the element to attach the toast element to (for testing) | ||
*/ | ||
selector?: string | ||
} | ||
@@ -52,4 +62,5 @@ | ||
type: undefined, | ||
onShow: () => {}, | ||
onClick: () => {}, | ||
selector: 'body-user', | ||
onRemove: () => { }, | ||
onClick: () => { }, | ||
close: true | ||
@@ -69,7 +80,7 @@ }, options) | ||
duration: options.timeout ? options.timeout * 1000 : null, | ||
callback: options.onShow, | ||
callback: options.onRemove, | ||
onClick: options.onClick, | ||
close: options.close, | ||
gravity: 'top', | ||
selector: 'body-user', | ||
selector: options.selector, | ||
position: 'right', | ||
@@ -90,3 +101,3 @@ backgroundColor: '', | ||
export function showError(text: string, options?: ToastOptions): Toast { | ||
return showMessage(text, {...options, type: ToastType.ERROR}) | ||
return showMessage(text, { ...options, type: ToastType.ERROR }) | ||
} | ||
@@ -101,3 +112,3 @@ | ||
export function showWarning(text: string, options?: ToastOptions): Toast { | ||
return showMessage(text, {...options, type: ToastType.WARNING}) | ||
return showMessage(text, { ...options, type: ToastType.WARNING }) | ||
} | ||
@@ -112,3 +123,3 @@ | ||
export function showInfo(text: string, options?: ToastOptions): Toast { | ||
return showMessage(text, {...options, type: ToastType.INFO}) | ||
return showMessage(text, { ...options, type: ToastType.INFO }) | ||
} | ||
@@ -123,3 +134,3 @@ | ||
export function showSuccess(text: string, options?: ToastOptions): Toast { | ||
return showMessage(text, {...options, type: ToastType.SUCCESS}) | ||
return showMessage(text, { ...options, type: ToastType.SUCCESS }) | ||
} |
{ | ||
"name": "@nextcloud/dialogs", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -30,4 +30,4 @@ "main": "dist/index.js", | ||
"@babel/cli": "7.8.4", | ||
"@babel/core": "7.8.4", | ||
"@babel/preset-env": "7.8.4", | ||
"@babel/core": "7.8.6", | ||
"@babel/preset-env": "7.8.6", | ||
"@babel/preset-typescript": "7.8.3", | ||
@@ -38,3 +38,3 @@ "@nextcloud/browserslist-config": "^1.0.0", | ||
"typedoc": "^0.16.7", | ||
"typescript": "3.7.5" | ||
"typescript": "3.8.3" | ||
}, | ||
@@ -41,0 +41,0 @@ "browserslist": [ |
@@ -38,2 +38,2 @@ # @nextcloud/dialogs | ||
A full list of available options can be found in the documentation. | ||
A full list of available options can be found in the [documentation](https://nextcloud.github.io/nextcloud-dialogs/). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
608581
2548