@aurelia-mdc-web/list
Version:
Wrapper for Material Components Web List
40 lines • 1.36 kB
JavaScript
import { __decorate, __metadata } from "tslib";
import { customAttribute } from 'aurelia-framework';
/**
* Optional, marks the trailing control element
* @selector [mdc-list-item-trailing]
*/
let MdcListItemTrailing = class MdcListItemTrailing {
constructor(root) {
this.root = root;
}
attached() {
let value = this.value;
if (!value) {
if (this.root.classList.contains('mdc-checkbox')) {
value = 'checkbox';
}
else if (this.root.classList.contains('mdc-radio')) {
value = 'radio';
}
else if (this.root.classList.contains('mdc-switch')) {
value = 'switch';
}
else if (this.root.classList.contains('mdc-icon-button')) {
value = undefined;
}
else if (this.root.classList.contains('material-icons')) {
value = 'icon';
}
}
if (value !== undefined) {
this.root.parentElement?.parentElement?.classList.add(`mdc-list-item--with-trailing-${value}`);
}
}
};
MdcListItemTrailing = __decorate([
customAttribute('mdc-list-item-trailing'),
__metadata("design:paramtypes", [Element])
], MdcListItemTrailing);
export { MdcListItemTrailing };
//# sourceMappingURL=mdc-list-item-trailing.js.map