You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/ui/packages/consul-ui/app/modifiers/disabled.js

18 lines
487 B

import { modifier } from 'ember-modifier';
export default modifier(function enabled($element, [bool = true], hash) {
if (['input', 'textarea', 'select', 'button'].includes($element.nodeName.toLowerCase())) {
if (bool) {
$element.disabled = bool;
} else {
$element.dataset.disabled = false;
}
return;
}
for (const $el of $element.querySelectorAll('input,textarea')) {
if ($el.dataset.disabled !== 'false') {
$el.disabled = bool;
}
}
});