element.
*/
export class Et2VfsSelectRow extends Et2Widget(LitElement) implements SearchResultElement
{
static get styles()
{
return [
shoelace,
...super.styles,
styles
];
}
@property({type: Object}) value : FileInfo;
/** Draws the file in a disabled state, preventing selection. */
@property({type: Boolean, reflect: true}) disabled = false;
@state() current = false; // the user has keyed into the file, but hasn't selected it yet (shows a highlight)
@state() selected = false; // the file is selected and has aria-selected="true"
@state() hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging
connectedCallback()
{
super.connectedCallback();
this.setAttribute('role', 'option');
this.setAttribute('aria-selected', 'false');
}
@property()
get label()
{
return this.value?.label || this.value?.name || "";
}
private handleMouseEnter()
{
this.hasHover = true;
this.requestUpdate("hasHover", false);
}
private handleMouseLeave()
{
this.hasHover = false;
this.requestUpdate("hasHover", true);
}
render()
{
return html`
${typeof this.value.icon == "string" ? html`
` :
html`
`
}
${this.value.name}
`;
}
}
customElements.define("et2-vfs-select-row", Et2VfsSelectRow);