diff --git a/lib/utils/apply-tooltip.js b/lib/utils/apply-tooltip.js index 7a874392..00d4194c 100644 --- a/lib/utils/apply-tooltip.js +++ b/lib/utils/apply-tooltip.js @@ -6,23 +6,44 @@ module.exports = function ({ source, tooltip, icon = true }) { .addChildTag('q-icon') .addAttribute('name', 'info') .addAttribute('size', 'sm') - .addAttribute('class', 'q-ml-sm text-dark') + .addAttribute('class', 'q-ml-sm text-dark cursor-pointer') } - applyTooltipTo - .addChildTag('q-tooltip') - .addAttribute('v-if', '$q.platform.is.desktop') - .addAttribute('class', 'bg-white text-dark shadow-4') - .addAttribute('style', 'font-size: 16px; white-space: pre-wrap;') - .addAttribute('max-width', '400px') - .content(tooltip) + let tooltipText = '' + let persistent = false - applyTooltipTo - .addChildTag('q-popup-proxy') - .addAttribute('v-if', '$q.platform.is.mobile') - .addChildTag('div') - .addAttribute('class', 'bg-white text-dark shadow-4 q-pa-sm') - .addAttribute('style', 'font-size: 16px; white-space: pre-wrap;') - .addAttribute('max-width', '400px') - .content(tooltip) + if (typeof tooltip === 'string') { + tooltipText = tooltip + } else if (typeof tooltip === 'object') { + tooltipText = tooltip.text + persistent = tooltip.persistent === true + } + + if (persistent) { + applyTooltipTo + .addChildTag('q-popup-proxy') + .addAttribute('breakpoint', 4320) + .addChildTag('div') + .addAttribute('class', 'bg-white text-dark shadow-4 q-pa-sm') + .addAttribute('style', 'font-size: 16px; white-space: pre-wrap;') + .addAttribute('max-width', '400px') + .content(tooltipText) + } else { + applyTooltipTo + .addChildTag('q-tooltip') + .addAttribute('v-if', '$q.platform.is.desktop') + .addAttribute('class', 'bg-white text-dark shadow-4') + .addAttribute('style', 'font-size: 16px; white-space: pre-wrap;') + .addAttribute('max-width', '400px') + .content(tooltipText) + + applyTooltipTo + .addChildTag('q-popup-proxy') + .addAttribute('v-if', '$q.platform.is.mobile') + .addChildTag('div') + .addAttribute('class', 'bg-white text-dark shadow-4 q-pa-sm') + .addAttribute('style', 'font-size: 16px; white-space: pre-wrap;') + .addAttribute('max-width', '400px') + .content(tooltipText) + } }