From ea6fe16dd67a838c51112a76105f0565a57ffd7f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 5 Mar 2024 21:56:42 +0300 Subject: [PATCH] Delayed rendering for button hints --- apps/common/main/lib/component/Button.js | 75 +++++++++++++++++------- 1 file changed, 55 insertions(+), 20 deletions(-) diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index bee39ad5d3..88f69376da 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -261,6 +261,7 @@ define([ options : { id : null, hint : false, + delayRenderHint : true, enableToggle : false, allowDepress : true, toggleGroup : null, @@ -352,6 +353,7 @@ define([ me.style = me.options.style; me.rendered = false; me.stopPropagation = me.options.stopPropagation; + me.delayRenderHint = me.options.delayRenderHint; // if ( /(? 0) { var onModalClose = function(dlg) { @@ -811,38 +856,28 @@ define([ if (tip) { if (tip.dontShow===undefined) tip.dontShow = true; - tip.hide(); } + if (me.btnMenuEl) { + tip = me.btnMenuEl.data('bs.tooltip'); + if (tip) { + if (tip.dontShow===undefined) + tip.dontShow = true; + tip.hide(); + } + } Common.NotificationCenter.off({'modal:close': onModalClose}); }; Common.NotificationCenter.on({'modal:close': onModalClose}); } + this._isTooltipInited = true; } - - this.btnEl.tooltip({ - html: !!isHtml, - title : (typeof hint == 'string') ? hint : hint[0], - placement : this.options.hintAnchor||'cursor', - zIndex : tipZIndex - }); - this.btnMenuEl && this.btnMenuEl.tooltip({ - html: !!isHtml, - title : hint[1], - placement : this.options.hintAnchor||'cursor', - zIndex : tipZIndex - }); }, updateHint: function(hint, isHtml) { this.options.hint = hint; if (!this.rendered) return; - if (this.btnEl && this.btnEl.data('bs.tooltip')) - this.btnEl.removeData('bs.tooltip'); - if (this.btnMenuEl && this.btnMenuEl.data('bs.tooltip')) - this.btnMenuEl.removeData('bs.tooltip'); - this.createHint(hint, isHtml); if (this.disabled || !Common.Utils.isGecko) {