actualizacion de la material design cuando un elemento está bloquedo por ACL

This commit is contained in:
Daniel Herrero 2017-11-23 14:53:37 +01:00
parent 7cb64edf04
commit c386b6aaea
1 changed files with 20 additions and 0 deletions

View File

@ -1,6 +1,25 @@
import {module} from '../module';
function vnAcl(aclService, $timeout) {
function getMaterialType(className) {
let type = '';
if (className) {
type = className.replace('mdl-', '').replace('__input', '');
type = type.charAt(0).toUpperCase() + type.slice(1);
}
return type;
}
function udateMaterial(input) {
if (input && input.className) {
let find = input.className.match(/mdl-[\w]+input/g);
if (find.length && find[0]) {
let type = getMaterialType(find[0]);
if (type && input.parentNode[`Material${type}`] && input.parentNode[`Material${type}`].updateClasses_) {
input.parentNode[`Material${type}`].updateClasses_();
}
}
}
}
return {
restrict: 'A',
priority: -1,
@ -18,6 +37,7 @@ function vnAcl(aclService, $timeout) {
if (input) {
$timeout(() => {
input.setAttribute("disabled", "true");
udateMaterial(input);
});
$element[0].querySelectorAll('i, vn-drop-down').forEach(element => {
element.parentNode.removeChild(element);