From 20c82b6d723277e39ddb03e4e15443627f7b8d4b Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 13 Jan 2022 15:28:52 -0700 Subject: [PATCH] Starting on selectboxes with static options. Not entirely sure this is the way to go, but at least we don't have to 1. copy the options 2. inherit the whole editable object for a readonly --- api/js/etemplate/Et2Select/Et2Select.ts | 253 +++++++++------- .../etemplate/Et2Select/Et2SelectReadonly.ts | 56 +++- api/js/etemplate/Et2Select/StaticOptions.ts | 282 ++++++++++++++++++ api/js/etemplate/et2_core_widget.ts | 16 +- 4 files changed, 476 insertions(+), 131 deletions(-) create mode 100644 api/js/etemplate/Et2Select/StaticOptions.ts diff --git a/api/js/etemplate/Et2Select/Et2Select.ts b/api/js/etemplate/Et2Select/Et2Select.ts index 7fb127d825..838d5234ba 100644 --- a/api/js/etemplate/Et2Select/Et2Select.ts +++ b/api/js/etemplate/Et2Select/Et2Select.ts @@ -13,6 +13,7 @@ import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget"; import {et2_readAttrWithDefault} from "../et2_core_xml"; import {css, html, render, repeat, TemplateResult} from "@lion/core"; import {cssImage} from "../Et2Widget/Et2Widget"; +import {StaticOptions} from "./StaticOptions"; export interface SelectOption { @@ -23,51 +24,21 @@ export interface SelectOption } /** + * Base class for things that do selectbox type behaviour, to avoid putting too much or copying into read-only + * selectboxes, also for common handling of properties for more special selectboxes. + * * LionSelect (and any other LionField) use slots to wrap a real DOM node. ET2 doesn't expect this, * so we have to create the input node (via slots()) and respect that it is _external_ to the Web Component. * This complicates things like adding the options, since we can't just override _inputGroupInputTemplate() * and include them when rendering - the parent expects to find the