mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 01:29:05 +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()
|
||||
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 ?
|
||||
this.__value ?? [] :
|
||||
this.__value ?? "";
|
||||
@ -464,7 +473,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
||||
if(missing.length > 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -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)
|
||||
{
|
||||
@ -926,7 +935,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
||||
<sl-select
|
||||
exportparts="prefix, tags, display-input, expand-icon, combobox, listbox, option"
|
||||
label=${this.label}
|
||||
placeholder=${this.placeholder}
|
||||
placeholder=${this.placeholder || (this.multiple && this.emptyLabel ? this.emptyLabel : "")}
|
||||
?multiple=${this.multiple}
|
||||
?disabled=${this.disabled || this.readonly}
|
||||
?clearable=${this.clearable}
|
||||
|
@ -160,7 +160,7 @@ export const Et2WidgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
|
||||
{
|
||||
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 [];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user