mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
Fix some selectbox non-values causing issues
This commit is contained in:
parent
70f379d985
commit
cb484c8f6c
@ -376,6 +376,15 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
@property()
|
@property()
|
||||||
get value()
|
get value()
|
||||||
{
|
{
|
||||||
|
// Handle a bunch of non-values, if it's multiple we want an array
|
||||||
|
if(this.multiple && (this.__value == "null" || this.__value == null || typeof this.__value == "undefined" || !this.emptyLabel && this.__value == ""))
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if(!this.multiple && !this.emptyLabel && this.__value == "")
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return this.multiple ?
|
return this.multiple ?
|
||||||
this.__value ?? [] :
|
this.__value ?? [] :
|
||||||
this.__value ?? "";
|
this.__value ?? "";
|
||||||
@ -464,7 +473,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
if(missing.length > 0)
|
if(missing.length > 0)
|
||||||
{
|
{
|
||||||
debugger;
|
debugger;
|
||||||
console.warn("Invalid option '" + missing.join(", ") + "' removed");
|
console.warn("Invalid option '" + missing.join(", ") + "' removed from " + this.id, this);
|
||||||
value = value.filter(item => missing.indexOf(item) == -1);
|
value = value.filter(item => missing.indexOf(item) == -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,9 +481,9 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an option for the "empty label" option, used if there's no value
|
* Additional customisations from the XET node
|
||||||
*
|
*
|
||||||
* @returns {TemplateResult}
|
* @param {Element} _node
|
||||||
*/
|
*/
|
||||||
loadFromXML(_node : Element)
|
loadFromXML(_node : Element)
|
||||||
{
|
{
|
||||||
@ -926,7 +935,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
<sl-select
|
<sl-select
|
||||||
exportparts="prefix, tags, display-input, expand-icon, combobox, listbox, option"
|
exportparts="prefix, tags, display-input, expand-icon, combobox, listbox, option"
|
||||||
label=${this.label}
|
label=${this.label}
|
||||||
placeholder=${this.placeholder}
|
placeholder=${this.placeholder || (this.multiple && this.emptyLabel ? this.emptyLabel : "")}
|
||||||
?multiple=${this.multiple}
|
?multiple=${this.multiple}
|
||||||
?disabled=${this.disabled || this.readonly}
|
?disabled=${this.disabled || this.readonly}
|
||||||
?clearable=${this.clearable}
|
?clearable=${this.clearable}
|
||||||
|
@ -160,7 +160,7 @@ export const Et2WidgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
|
|||||||
{
|
{
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
if(this.value == "null" || typeof this.value == "undefined" || !this.emptyLabel && this.value == "")
|
if(this.value == "null" || this.value == null || typeof this.value == "undefined" || !this.emptyLabel && this.value == "")
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user