Et2Select: Allow dropdown option list to be wider than the field

This commit is contained in:
nathan 2022-06-14 15:14:17 -06:00
parent 3f3e7559f1
commit 67b9102a69

View File

@ -96,6 +96,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2InvokerMixin(Et2WidgetWithS
{
super();
this._triggerChange = this._triggerChange.bind(this);
this._doResize = this._doResize.bind(this);
}
connectedCallback()
@ -106,6 +107,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2InvokerMixin(Et2WidgetWithS
{
this.addEventListener("sl-clear", this._triggerChange)
this.addEventListener("sl-change", this._triggerChange);
this.addEventListener("sl-after-show", this._doResize)
});
}
@ -115,6 +117,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2InvokerMixin(Et2WidgetWithS
this.removeEventListener("sl-clear", this._triggerChange)
this.removeEventListener("sl-change", this._triggerChange);
this.removeEventListener("sl-after-show", this._doResize);
}
firstUpdated(changedProperties?)
@ -136,6 +139,18 @@ export class Et2Select extends Et2WithSearchMixin(Et2InvokerMixin(Et2WidgetWithS
this.dispatchEvent(new Event("change"));
}
/**
* Change the menu sizing to allow the menu to be wider than the field width, but no smaller
*
* @param e
* @private
*/
private _doResize(e)
{
this.menu.style.minWidth = this.menu.style.width;
this.menu.style.width = "";
}
/**
* Get the node where we're putting the selection options
*