UNPKG

@microsoft/sp-dialog

Version:

SharePoint Framework support for displaying dialog boxes

45 lines 1.93 kB
import DialogManager from './DialogManager'; /** * A static class for showing stock dialogs such as an alert or prompt. * * @public */ var Dialog = /** @class */ (function () { function Dialog() { } /** * Alerts a message to the user with a user-friendly interface. Calling this method sends a request to application * to show the alert dialog. * * @remarks * There might be a delay until the dialog is approved and shown by the application, for * example, if there is another dialog currently being shown. The returned promise resolves when the dialog is * successfully shown and closed. The promise rejects if the application rejects the request for any reason. * * @param message - The message to alert */ Dialog.alert = function (message, options) { var dialogManager = DialogManager.instance; return dialogManager ? dialogManager.alert(message, options) : Promise.resolve(undefined); }; /** * Prompts the user for a string value with a user-friendly interface. Calling this method sends a request to * application to show the dialog. * * @remarks * There might be a delay until the dialog is approved and shown by the application, * for example, if there is another dialog currently being shown. The returned promise resolves when the dialog is * successfully shown and closed. The promise rejects if the application rejects the request for any reason. * * @returns The input string or undefined if the dialog was canceled * * @param message - The message for prompt dialog */ Dialog.prompt = function (message, options) { var dialogManager = DialogManager.instance; return dialogManager ? dialogManager.prompt(message, options) : Promise.resolve(undefined); }; return Dialog; }()); export default Dialog; //# sourceMappingURL=Dialog.js.map