62 lines
1.2 KiB
JavaScript
62 lines
1.2 KiB
JavaScript
/**
|
|
@license
|
|
Copyright (c) 2024 trading_peter
|
|
This program is available under Apache License Version 2.0
|
|
*/
|
|
|
|
import '@tp/tp-icon/tp-icon.js';
|
|
import { LitElement, html, css } from 'lit';
|
|
|
|
class TpPopupMenuItem extends LitElement {
|
|
static get styles() {
|
|
return [
|
|
css`
|
|
:host {
|
|
display: block;
|
|
cursor: pointer;
|
|
}
|
|
|
|
:host([disabled]) {
|
|
cursor: default;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.wrap {
|
|
display: grid;
|
|
grid-template-columns: auto 1fr;
|
|
grid-column-gap: 10px;
|
|
align-items: center;
|
|
padding: 6px 12px;
|
|
color: var(--tp-popup-menu-item-color, #000);
|
|
background: var(--tp-popup-menu-item-bg, transparent);
|
|
}
|
|
`
|
|
];
|
|
}
|
|
|
|
render() {
|
|
const { icon } = this;
|
|
|
|
return html`
|
|
<div class="wrap" ?noicon=${!icon}>
|
|
${icon ? html`
|
|
<tp-icon .icon=${icon}></tp-icon>
|
|
` : null}
|
|
<div class="label">
|
|
<slot></slot>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
static get properties() {
|
|
return {
|
|
icon: { type: Object },
|
|
};
|
|
}
|
|
|
|
|
|
}
|
|
|
|
window.customElements.define('tp-popup-menu-item', TpPopupMenuItem);
|