@aurelia-mdc-web/list
Version:
Wrapper for Material Components Web List
38 lines • 1.29 kB
JavaScript
import { __decorate, __metadata } from "tslib";
import { customAttribute } from 'aurelia-framework';
/**
* Optional, marks the leading control or media element
* @selector [mdc-list-item-leading]
*/
let MdcListItemLeading = class MdcListItemLeading {
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('material-icons')) {
value = 'icon';
}
else if (this.root.tagName === 'IMG') {
value = 'image';
}
}
this.root.parentElement?.parentElement?.classList.add(`mdc-list-item--with-leading-${value}`);
}
};
MdcListItemLeading = __decorate([
customAttribute('mdc-list-item-leading'),
__metadata("design:paramtypes", [Element])
], MdcListItemLeading);
export { MdcListItemLeading };
//# sourceMappingURL=mdc-list-item-leading.js.map