From 281008fb64daeb77b7620d5f3138e0fda9985eeb Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 7 May 2020 09:59:58 +0200 Subject: [PATCH] Added onOpen callback, to trigger when the modal opens. --- .../bootstrap/modal-manager.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index 3998f2df7f..21a8e0ce21 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -1,4 +1,4 @@ -/** +/** * TODO: Document & prepare typescript definitions * TODO: Refactor & test more */ @@ -49,6 +49,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f var _publicApi = null; var _args = null; + var _onOpenCallbacks = new CallbackList(); var _onCloseCallbacks = new CallbackList(); var _onResultCallbacks = new CallbackList(); @@ -106,6 +107,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f } $firstVisibleInput.focus(); + _onOpenCallbacks.triggerAll(_publicApi); }); var modalClass = abp.modals[options.modalClass]; @@ -147,6 +149,10 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f _$modal.modal('hide'); }; + var _onOpen = function (onOpenCallback) { + _onOpenCallbacks.add(onOpenCallback); + }; + var _onClose = function (onCloseCallback) { _onCloseCallbacks.add(onCloseCallback); }; @@ -188,6 +194,8 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f _onResultCallbacks.triggerAll(_publicApi, arguments); }, + onOpen: _onOpen, + onClose: _onClose, onResult: _onResult @@ -198,4 +206,4 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f }; })(); -})(jQuery); \ No newline at end of file +})(jQuery);