From 01b81c03a2245da2e8f0c51dbfeb896c58d022d8 Mon Sep 17 00:00:00 2001 From: prudho Date: Sat, 17 Sep 2022 09:18:39 +0200 Subject: [PATCH] feat(flyout): support short notation $. This PR adds jquery short notation support ($.) to flyout which is made dynamically out of js properties and thus are not bound to an existing dom node. Previously you always had to select body (which still works) when no existing domnode template exists. Infact the body selector was completely ignored. --- src/definitions/modules/flyout.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/definitions/modules/flyout.js b/src/definitions/modules/flyout.js index 56a01d308a..b8ca1001fa 100644 --- a/src/definitions/modules/flyout.js +++ b/src/definitions/modules/flyout.js @@ -23,7 +23,7 @@ window = (typeof window != 'undefined' && window.Math == Math) : Function('return this')() ; -$.fn.flyout = function(parameters) { +$.flyout = $.fn.flyout = function(parameters) { var $allModules = $(this), $window = $(window), @@ -75,8 +75,10 @@ $.fn.flyout = function(parameters) { $pusher = $context.children(selector.pusher), $style, + isFlyoutComponent = $module.hasClass('flyout'), + element = this, - instance = $module.hasClass(namespace) ? $module.data(moduleNamespace) : undefined, + instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined, ignoreRepeatedEvents = false, isBody = $context[0] === $body[0], @@ -97,7 +99,7 @@ $.fn.flyout = function(parameters) { initialize: function() { module.debug('Initializing flyout', parameters); - if(!$module.hasClass(namespace)) { + if(!isFlyoutComponent) { module.create.flyout(); if(!$.isFunction(settings.onHidden)) { settings.onHidden = function () { @@ -105,6 +107,9 @@ $.fn.flyout = function(parameters) { $module.remove(); }; } + if(!settings.autoShow) { + settings.autoShow = true; + } } $module.addClass(settings.class); if (settings.title !== '') { @@ -422,13 +427,6 @@ $.fn.flyout = function(parameters) { $flyouts = $context.children(selector.flyout); }, - repaint: function() { - module.verbose('Forcing repaint event'); - element.style.display = 'none'; - element.scrollTop = element.scrollTop; - element.style.display = ''; - }, - setup: { cache: function() { module.cache = { @@ -591,7 +589,6 @@ $.fn.flyout = function(parameters) { : function(){} ; module.set.overlay(); - module.repaint(); if(settings.returnScroll) { currentScroll = (isBody ? $window : $context).scrollTop(); }