diff --git a/api/js/etemplate/Et2Select/Et2Select.ts b/api/js/etemplate/Et2Select/Et2Select.ts index 7c69e1929b..0ac613b534 100644 --- a/api/js/etemplate/Et2Select/Et2Select.ts +++ b/api/js/etemplate/Et2Select/Et2Select.ts @@ -9,7 +9,7 @@ import {css, html, PropertyValues, TemplateResult} from "@lion/core"; -import {Et2StaticSelectMixin, StaticOptions} from "./StaticOptions"; +import {Et2StaticSelectMixin, StaticOptions as so} from "./StaticOptions"; import {Et2widgetWithSelectMixin} from "./Et2WidgetWithSelectMixin"; import {SelectOption} from "./FindSelectOptions"; import {SlMenuItem, SlSelect} from "@shoelace-style/shoelace"; @@ -725,12 +725,6 @@ if(typeof customElements.get("lion-validation-feedback") === "undefined") { customElements.define("lion-validation-feedback", LionValidationFeedback); } -/** - * Use a single StaticOptions, since it should have no state - * @type {StaticOptions} - */ -const so = new StaticOptions(); - export class Et2SelectApp extends Et2StaticSelectMixin(Et2Select) { diff --git a/api/js/etemplate/Et2Select/Et2SelectCategory.ts b/api/js/etemplate/Et2Select/Et2SelectCategory.ts index 6fcf4c07d7..12ba26265a 100644 --- a/api/js/etemplate/Et2Select/Et2SelectCategory.ts +++ b/api/js/etemplate/Et2Select/Et2SelectCategory.ts @@ -10,7 +10,7 @@ import {css, PropertyValues} from "@lion/core"; import {Et2Select} from "./Et2Select"; -import {Et2StaticSelectMixin, StaticOptions} from "./StaticOptions"; +import {Et2StaticSelectMixin, StaticOptions as so} from "./StaticOptions"; import {cleanSelectOptions} from "./FindSelectOptions"; /** @@ -172,10 +172,4 @@ export class Et2SelectCategory extends Et2StaticSelectMixin(Et2Select) } } -/** - * Use a single StaticOptions, since it should have no state - * @type {StaticOptions} - */ -const so = new StaticOptions(); - customElements.define("et2-select-cat", Et2SelectCategory); \ No newline at end of file diff --git a/api/js/etemplate/Et2Select/Et2SelectCountry.ts b/api/js/etemplate/Et2Select/Et2SelectCountry.ts index 51e84b877d..1cd7d3aaa9 100644 --- a/api/js/etemplate/Et2Select/Et2SelectCountry.ts +++ b/api/js/etemplate/Et2Select/Et2SelectCountry.ts @@ -9,7 +9,7 @@ import {Et2Select} from "./Et2Select"; -import {Et2StaticSelectMixin, StaticOptions} from "./StaticOptions"; +import {Et2StaticSelectMixin, StaticOptions as so} from "./StaticOptions"; import {egw} from "../../jsapi/egw_global"; import {SelectOption} from "./FindSelectOptions"; @@ -56,10 +56,4 @@ export class Et2SelectCountry extends Et2StaticSelectMixin(Et2Select) } } -/** - * Use a single StaticOptions, since it should have no state - * @type {StaticOptions} - */ -const so = new StaticOptions(); - customElements.define("et2-select-country", Et2SelectCountry); \ No newline at end of file diff --git a/api/js/etemplate/Et2Select/Et2SelectReadonly.ts b/api/js/etemplate/Et2Select/Et2SelectReadonly.ts index 5dc67ec9b2..d82df1c58b 100644 --- a/api/js/etemplate/Et2Select/Et2SelectReadonly.ts +++ b/api/js/etemplate/Et2Select/Et2SelectReadonly.ts @@ -11,12 +11,10 @@ import {css, html, LitElement, repeat, TemplateResult} from "@lion/core"; import {et2_IDetachedDOM} from "../et2_core_interfaces"; import {Et2Widget} from "../Et2Widget/Et2Widget"; -import {StaticOptions} from "./StaticOptions"; +import {StaticOptions as so} from "./StaticOptions"; import {find_select_options, SelectOption} from "./FindSelectOptions"; import {SelectAccountMixin} from "./SelectAccountMixin"; -const so = new StaticOptions(); - /** * This is a stripped-down read-only widget used in nextmatch * (and other read-only usages) diff --git a/api/js/etemplate/Et2Select/StaticOptions.ts b/api/js/etemplate/Et2Select/StaticOptions.ts index 29be39845d..60ab060d42 100644 --- a/api/js/etemplate/Et2Select/StaticOptions.ts +++ b/api/js/etemplate/Et2Select/StaticOptions.ts @@ -103,7 +103,7 @@ export const Et2StaticSelectMixin = > * @param {boolean} return_promise true: always return a promise * @returns {Object[]|Promise} Array of options, or empty and they'll get filled in later, or Promise */ -export class StaticOptions +export const StaticOptions = new class StaticOptionsType { cached_server_side(widget : Et2SelectWidgets, type : string, options_string, return_promise? : boolean) : SelectOption[]|Promise {