mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:05:16 +01:00
implement multiple attribute for et2-select reflecting it to selectbox
fixing TypeError set_multiple is not a function
This commit is contained in:
parent
0099b094b9
commit
9285b87a92
@ -89,6 +89,29 @@ export class Et2Select extends Et2WidgetWithSelect
|
||||
return this._inputNode;
|
||||
}
|
||||
|
||||
static get properties()
|
||||
{
|
||||
return {
|
||||
...super.properties,
|
||||
/**
|
||||
* Toggle between single and multiple selection
|
||||
*/
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
reflect: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
set_multiple(multi)
|
||||
{
|
||||
if (typeof multi !== 'boolean')
|
||||
{
|
||||
multi = multi && !(multi === 'false' || multi === '0');
|
||||
}
|
||||
this.multiple = multi;
|
||||
}
|
||||
|
||||
/** @param {import('@lion/core').PropertyValues } changedProperties */
|
||||
updated(changedProperties : PropertyValues)
|
||||
{
|
||||
@ -106,6 +129,12 @@ export class Et2Select extends Et2WidgetWithSelect
|
||||
// Re-set value, the option for it may have just shown up
|
||||
this._inputNode.value = this.modelValue || "";
|
||||
}
|
||||
|
||||
// propagate multiple to selectbox
|
||||
if (changedProperties.has('multiple'))
|
||||
{
|
||||
this._inputNode.multiple = this.multiple;
|
||||
}
|
||||
}
|
||||
|
||||
_emptyLabelTemplate() : TemplateResult
|
||||
|
Loading…
Reference in New Issue
Block a user