2022-06-22 23:47:28 +02:00
|
|
|
/**
|
|
|
|
* EGroupware eTemplate2 - Select Country WebComponent
|
|
|
|
*
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package api
|
|
|
|
* @link https://www.egroupware.org
|
|
|
|
* @author Nathan Gray
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import {Et2Select} from "./Et2Select";
|
2022-07-15 20:56:24 +02:00
|
|
|
import {Et2StaticSelectMixin, StaticOptions} from "./StaticOptions";
|
2022-06-22 23:47:28 +02:00
|
|
|
import {egw} from "../../jsapi/egw_global";
|
2022-07-15 20:56:24 +02:00
|
|
|
import {SelectOption} from "./FindSelectOptions";
|
2022-06-22 23:47:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Customised Select widget for countries
|
|
|
|
* This widget uses CSS from api/templates/default/css/flags.css to set flags
|
|
|
|
*/
|
2022-06-23 07:19:47 +02:00
|
|
|
egw(window).includeCSS("api/templates/default/css/flags.css")
|
2022-06-22 23:47:28 +02:00
|
|
|
|
2022-07-15 20:56:24 +02:00
|
|
|
export class Et2SelectCountry extends Et2StaticSelectMixin(Et2Select)
|
2022-06-22 23:47:28 +02:00
|
|
|
{
|
|
|
|
static get properties()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
...super.properties,
|
|
|
|
/* Reflect the value so we can use CSS selectors */
|
|
|
|
value: {type: String, reflect: true}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.search = true;
|
|
|
|
|
|
|
|
(<Promise<SelectOption[]>>so.country(this, {}, true)).then(options =>
|
|
|
|
{
|
2022-07-15 20:56:24 +02:00
|
|
|
this.static_options = options
|
|
|
|
this.requestUpdate("select_options");
|
2022-06-22 23:47:28 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use a single StaticOptions, since it should have no state
|
|
|
|
* @type {StaticOptions}
|
|
|
|
*/
|
|
|
|
const so = new StaticOptions();
|
|
|
|
|
|
|
|
customElements.define("et2-select-country", Et2SelectCountry);
|