` 元素都添加一个唯一的 key
this.key = uniqueId();
this.rippleRef = createRef();
this.hasSlotController = new HasSlotController(this, '[default]', '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 hasDefaultSlot = this.hasSlotController.test('[default]');
const className = cc({
container: true,
'has-label': hasDefaultSlot,
'has-active-icon': this.activeIcon || this.hasSlotController.test('active-icon'),
initial: this.isInitial,
});
return html `${this.href
? this.renderAnchor({
part: 'container',
className,
content: this.renderInner(hasDefaultSlot),
})
: html `${this.renderInner(hasDefaultSlot)}
`}`;
}
renderInner(hasDefaultSlot) {
return html `${this.activeIcon
? html ``
: nothingTemplate}${this.icon
? html ``
: nothingTemplate}
${hasDefaultSlot
? html ``
: nothing}`;
}
};
NavigationRailItem.styles = [
componentStyle,
navigationRailItemStyle,
];
__decorate([
property({ reflect: true })
], NavigationRailItem.prototype, "icon", void 0);
__decorate([
property({ reflect: true, attribute: 'active-icon' })
], NavigationRailItem.prototype, "activeIcon", void 0);
__decorate([
property({ reflect: true })
], NavigationRailItem.prototype, "value", void 0);
__decorate([
property({
type: Boolean,
reflect: true,
converter: booleanConverter,
})
], NavigationRailItem.prototype, "active", void 0);
__decorate([
state()
], NavigationRailItem.prototype, "isInitial", void 0);
__decorate([
state()
], NavigationRailItem.prototype, "placement", void 0);
__decorate([
state()
], NavigationRailItem.prototype, "disabled", void 0);
NavigationRailItem = __decorate([
customElement('mdui-navigation-rail-item')
], NavigationRailItem);
export { NavigationRailItem };