From 6e119d9ac263aa9442ed7ecd9782086e53414ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Wed, 4 Aug 2021 12:17:15 +0300 Subject: [PATCH] Fixed #1404 - value and disabled props for Tooltip --- src/components/tooltip/Tooltip.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/tooltip/Tooltip.js b/src/components/tooltip/Tooltip.js index 1870c341b..5eabdf6cb 100755 --- a/src/components/tooltip/Tooltip.js +++ b/src/components/tooltip/Tooltip.js @@ -63,7 +63,7 @@ function onClick(event) { } function show(el) { - if (!el.$_ptooltipValue) { + if (el.$_ptooltipDisabled) { return; } @@ -245,7 +245,15 @@ const Tooltip = { beforeMount(el, options) { let target = getTarget(el); target.$_ptooltipModifiers = options.modifiers; - target.$_ptooltipValue = options.value; + if (typeof options.value === 'string') { + target.$_ptooltipValue = options.value; + target.$_ptooltipDisabled = false; + } + else { + target.$_ptooltipValue = options.value.value; + target.$_ptooltipDisabled = options.value.disabled || false; + } + target.$_ptooltipZIndex = options.instance.$primevue && options.instance.$primevue.config && options.instance.$primevue.config.zIndex.tooltip; bindEvents(target); }, @@ -264,7 +272,15 @@ const Tooltip = { updated(el, options) { let target = getTarget(el); target.$_ptooltipModifiers = options.modifiers; - target.$_ptooltipValue = options.value; + + if (typeof options.value === 'string') { + target.$_ptooltipValue = options.value; + target.$_ptooltipDisabled = false; + } + else { + target.$_ptooltipValue = options.value.value; + target.$_ptooltipDisabled = options.value.disabled; + } }, };