Bug fixes

This commit is contained in:
sairaj mote 2023-04-13 00:32:10 +05:30
parent f5bebc4c13
commit 855bca9e4d

View File

@ -721,7 +721,7 @@ function showChildElement(id, index, options = {}) {
}) })
} }
function buttonLoader(id, show) { function buttonLoader(id, show) {
const button = typeof id === 'string' ? getRef(id) : id; const button = typeof id === 'string' ? document.getElementById(id) : id;
button.disabled = show; button.disabled = show;
const animOptions = { const animOptions = {
duration: 200, duration: 200,
@ -729,6 +729,7 @@ function buttonLoader(id, show) {
easing: 'ease' easing: 'ease'
} }
if (show) { if (show) {
button.parentNode.append(createElement('sm-spinner'))
button.animate([ button.animate([
{ {
clipPath: 'circle(100%)', clipPath: 'circle(100%)',
@ -736,13 +737,9 @@ function buttonLoader(id, show) {
{ {
clipPath: 'circle(0)', clipPath: 'circle(0)',
}, },
], animOptions).onfinish = e => { ], animOptions)
e.target.commitStyles()
e.target.cancel()
}
button.parentNode.append(createElement('sm-spinner'))
} else { } else {
button.style = '' button.getAnimations().forEach(anim => anim.cancel())
const potentialTarget = button.parentNode.querySelector('sm-spinner') const potentialTarget = button.parentNode.querySelector('sm-spinner')
if (potentialTarget) potentialTarget.remove(); if (potentialTarget) potentialTarget.remove();
} }