` 元素都添加一个唯一的 key
this.key = uniqueId();
this.rippleRef = createRef();
this.hasSlotController = new HasSlotController(this, 'active-icon');
}
get rippleElement() {
return this.rippleRef.value;
}
get rippleDisabled() {
return this.disabled;
}
get focusElement() {
return this.href ? this.renderRoot?.querySelector('._a') : this;
}
get focusDisabled() {
return this.disabled;
}
render() {
const labelVisibilityClassName = cc({
'label-visibility-selected': this.labelVisibility === 'selected',
'label-visibility-labeled': this.labelVisibility === 'labeled',
'label-visibility-unlabeled': this.labelVisibility === 'unlabeled',
initial: this.isInitial,
});
const className = cc([
{
container: true,
'has-active-icon': this.activeIcon || this.hasSlotController.test('active-icon'),
},
labelVisibilityClassName,
]);
return html `${this.href
? this.renderAnchor({
part: 'container',
className,
content: this.renderInner(),
})
: html `${this.renderInner()}
`}`;
}
renderInner() {
return html `${this.activeIcon
? html ``
: nothingTemplate}${this.icon
? html ``
: nothingTemplate}
`;
}
};
NavigationBarItem.styles = [
componentStyle,
navigationBarItemStyle,
];
__decorate([
property({ reflect: true })
], NavigationBarItem.prototype, "icon", void 0);
__decorate([
property({ reflect: true, attribute: 'active-icon' })
], NavigationBarItem.prototype, "activeIcon", void 0);
__decorate([
property({ reflect: true })
], NavigationBarItem.prototype, "value", void 0);
__decorate([
state()
], NavigationBarItem.prototype, "labelVisibility", void 0);
__decorate([
state()
], NavigationBarItem.prototype, "isInitial", void 0);
__decorate([
property({
type: Boolean,
reflect: true,
converter: booleanConverter,
})
], NavigationBarItem.prototype, "active", void 0);
__decorate([
state()
], NavigationBarItem.prototype, "disabled", void 0);
NavigationBarItem = __decorate([
customElement('mdui-navigation-bar-item')
], NavigationBarItem);
export { NavigationBarItem };