@microsoft/sp-dialog
Version:
SharePoint Framework support for displaying dialog boxes
48 lines • 2.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var DialogManager_1 = tslib_1.__importDefault(require("./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_1.default.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_1.default.instance;
return dialogManager ? dialogManager.prompt(message, options) : Promise.resolve(undefined);
};
return Dialog;
}());
exports.default = Dialog;
//# sourceMappingURL=Dialog.js.map