1
0
mirror of https://github.com/tabler/tabler.git synced 2026-07-14 01:24:19 +04:00

Fix CountUp, dropdown viewport boundary, and input mask lazy option (#2684)

This commit is contained in:
Paweł Kuna
2026-07-07 23:46:05 +02:00
committed by GitHub
parent 218b0c5f15
commit b1d49e9762
6 changed files with 24 additions and 5 deletions
@@ -0,0 +1,5 @@
---
"@tabler/core": patch
---
Fixed CountUp to parse formatted number targets and avoid double-start when `enableScrollSpy` is enabled.
@@ -0,0 +1,5 @@
---
"@tabler/core": patch
---
Fixed dropdown `data-bs-boundary="viewport"` to use `document.documentElement` instead of the first `.btn` element.
+5
View File
@@ -0,0 +1,5 @@
---
"@tabler/core": patch
---
Fixed input mask `lazy` option to read `data-mask-visible` via `dataset.maskVisible`.
+7 -3
View File
@@ -15,11 +15,15 @@ if (countupElements.length) {
// ignore invalid JSON
}
const value = parseInt(element.innerHTML, 10)
// Strip thousands separators, currency symbols and other non-numeric characters
// so formatted targets like "1,234", "1 234" or "$99.5" parse correctly.
const value = parseFloat((element.textContent ?? '').replace(/[^0-9.-]/g, ''))
if (window.countUp && window.countUp.CountUp) {
if (!Number.isNaN(value) && window.countUp && window.countUp.CountUp) {
const countUp = new window.countUp.CountUp(element, value, options)
if (!countUp.error) {
// When scrollSpy is enabled CountUp starts the animation itself once the
// element scrolls into view, so only start manually when it's disabled.
if (!countUp.error && !options.enableScrollSpy) {
countUp.start()
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ Core dropdowns
const dropdownTriggerList: HTMLElement[] = [].slice.call(document.querySelectorAll<HTMLElement>('[data-bs-toggle="dropdown"]'))
dropdownTriggerList.map(function (dropdownTriggerEl: HTMLElement) {
const options = {
boundary: dropdownTriggerEl.getAttribute('data-bs-boundary') === 'viewport' ? document.querySelector('.btn') : 'clippingParents',
boundary: dropdownTriggerEl.getAttribute('data-bs-boundary') === 'viewport' ? document.documentElement : 'clippingParents',
}
return new Dropdown(dropdownTriggerEl, options)
})
+1 -1
View File
@@ -5,6 +5,6 @@ maskElementList.map(function (maskEl: HTMLElement) {
window.IMask &&
new window.IMask(maskEl, {
mask: maskEl.dataset.mask,
lazy: maskEl.dataset['mask-visible'] === 'true',
lazy: maskEl.dataset.maskVisible !== 'true',
})
})