From 11e89e1c0bde8df757fcc2481930a3a1a326b3a2 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Tue, 28 Sep 2021 12:15:43 +0300 Subject: [PATCH] Refactor #1612 --- src/components/tooltip/Tooltip.js | 8 +++----- src/views/tooltip/TooltipDemo.vue | 12 ++++++------ src/views/tooltip/TooltipDoc.vue | 28 +++++++++++++++++++++------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/components/tooltip/Tooltip.js b/src/components/tooltip/Tooltip.js index ac85be43d..e2d3b1049 100755 --- a/src/components/tooltip/Tooltip.js +++ b/src/components/tooltip/Tooltip.js @@ -219,12 +219,10 @@ function alignBottom(el) { } function preAlign(el, position) { - const tipClass = el.$_ptooltipClass; let tooltipElement = getTooltipElement(el); tooltipElement.style.left = -999 + 'px'; tooltipElement.style.top = -999 + 'px'; - tooltipElement.className = 'p-tooltip p-component p-tooltip-' + position; - if (tipClass) tooltipElement.className += ' p-tooltip-' + tipClass; + tooltipElement.className = `p-tooltip p-component p-tooltip-${position} ${el.$_ptooltipClass||''}`; } function isOutOfBounds(el) { @@ -274,7 +272,7 @@ const Tooltip = { else { target.$_ptooltipValue = options.value.value; target.$_ptooltipDisabled = options.value.disabled || false; - target.$_ptooltipClass = options.value.class || false; + target.$_ptooltipClass = options.value.class; } target.$_ptooltipZIndex = options.instance.$primevue && options.instance.$primevue.config && options.instance.$primevue.config.zIndex.tooltip; @@ -305,7 +303,7 @@ const Tooltip = { else { target.$_ptooltipValue = options.value.value; target.$_ptooltipDisabled = options.value.disabled || false; - target.$_ptooltipClass = options.value.class || false; + target.$_ptooltipClass = options.value.class; } } }; diff --git a/src/views/tooltip/TooltipDemo.vue b/src/views/tooltip/TooltipDemo.vue index a1e0c28f6..0acd2931e 100755 --- a/src/views/tooltip/TooltipDemo.vue +++ b/src/views/tooltip/TooltipDemo.vue @@ -33,7 +33,7 @@