UNPKG

@microsoft/sp-dialog

Version:

SharePoint Framework support for displaying dialog boxes

45 lines 1.58 kB
import AlertDialog from './AlertDialog'; import PromptDialog from './PromptDialog'; /** * {@inheritDoc ISecondaryDialogProvider} */ var SecondaryDialogProvider = /** @class */ (function () { /** * Creates a SecondaryDialogProvider. * @param primaryManager - Dialog manager. * @param ownerRequestId - Request id of the owner. * * @internal */ function SecondaryDialogProvider(primaryManager, ownerRequestId) { this._ownerRequestId = ownerRequestId; this._primaryManager = primaryManager; } /** * {@inheritDoc ISecondaryDialogProvider.alert} */ SecondaryDialogProvider.prototype.alert = function (message, options) { var dialog = new AlertDialog(message); return this.show(dialog, options); }; /** * {@inheritDoc ISecondaryDialogProvider.prompt} */ SecondaryDialogProvider.prototype.prompt = function (message, options) { var _this = this; var promise = new Promise(function (resolve) { var dialog = new PromptDialog(message, resolve, options ? options.defaultValue : undefined); void _this.show(dialog, options); }); return promise; }; /** * {@inheritDoc ISecondaryDialogProvider.prompt} */ SecondaryDialogProvider.prototype.show = function (dialog, options) { return this._primaryManager._showSecondary(dialog, this._ownerRequestId, options); }; return SecondaryDialogProvider; }()); export default SecondaryDialogProvider; //# sourceMappingURL=SecondaryDialogProvider.js.map