mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 01:43:47 +01:00
5ef349f057
Add class method to search through select options
48 lines
909 B
TypeScript
48 lines
909 B
TypeScript
import {Et2Select} from "../Et2Select";
|
|
import {Et2StaticSelectMixin, StaticOptions as so} from "../StaticOptions";
|
|
import {cleanSelectOptions, SelectOption} from "../FindSelectOptions";
|
|
|
|
export class Et2SelectState extends Et2StaticSelectMixin(Et2Select)
|
|
{
|
|
/**
|
|
* Two-letter ISO country code
|
|
*/
|
|
protected __countryCode;
|
|
|
|
static get properties()
|
|
{
|
|
return {
|
|
...super.properties,
|
|
countryCode: String,
|
|
}
|
|
}
|
|
|
|
constructor()
|
|
{
|
|
super();
|
|
|
|
this.countryCode = 'DE';
|
|
}
|
|
|
|
get countryCode()
|
|
{
|
|
return this.__countryCode;
|
|
}
|
|
|
|
set countryCode(code : string)
|
|
{
|
|
this.__countryCode = code;
|
|
this.fetchComplete = so.state(this, {country_code: code}).then((options : SelectOption[]) =>
|
|
{
|
|
this._static_options = cleanSelectOptions(options);
|
|
this.requestUpdate();
|
|
});
|
|
}
|
|
|
|
set_country_code(code)
|
|
{
|
|
this.countryCode = code;
|
|
}
|
|
}
|
|
|
|
customElements.define("et2-select-state", Et2SelectState); |