dropdown disable state
This commit is contained in:
parent
b28fe14833
commit
7e99f7c98e
|
@ -5,7 +5,7 @@ import { node } from '../../utility/node';
|
||||||
|
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
export const Dropdown = function({
|
export const Dropdown = function ({
|
||||||
title = false,
|
title = false,
|
||||||
text = 'Dropdown',
|
text = 'Dropdown',
|
||||||
menuItem = [],
|
menuItem = [],
|
||||||
|
@ -39,7 +39,8 @@ export const Dropdown = function({
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
|
menuItem: []
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toggle = this.element.toggle.button;
|
this.toggle = this.element.toggle.button;
|
||||||
|
@ -181,6 +182,8 @@ export const Dropdown = function({
|
||||||
classList: ['dropdown-menu-button']
|
classList: ['dropdown-menu-button']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.element.menuItem.push(dropdownMenuButton);
|
||||||
|
|
||||||
dropdownMenuButton.button.addEventListener('click', () => {
|
dropdownMenuButton.button.addEventListener('click', () => {
|
||||||
|
|
||||||
if (item.action) { item.action(); }
|
if (item.action) { item.action(); }
|
||||||
|
@ -200,11 +203,27 @@ export const Dropdown = function({
|
||||||
};
|
};
|
||||||
|
|
||||||
this.disable = () => {
|
this.disable = () => {
|
||||||
|
|
||||||
this.element.toggle.disable();
|
this.element.toggle.disable();
|
||||||
|
|
||||||
|
this.element.menuItem.forEach((item) => {
|
||||||
|
|
||||||
|
item.disable();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.enable = () => {
|
this.enable = () => {
|
||||||
|
|
||||||
this.element.toggle.enable();
|
this.element.toggle.enable();
|
||||||
|
|
||||||
|
this.element.menuItem.forEach((item) => {
|
||||||
|
|
||||||
|
item.enable();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.assemble();
|
this.assemble();
|
||||||
|
|
Loading…
Reference in New Issue