Fix general free entries did not validate with 0 validators

This commit is contained in:
nathan 2022-09-01 08:29:22 -06:00
parent 00b5cd0cd2
commit 2e319319d1

View File

@ -874,7 +874,7 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
return false; return false;
} }
// Make sure not to double-add // Make sure not to double-add
if(!this.select_options.find(o => o.value == text)) if(!this.select_options.find(o => o.value == text) && !this.__select_options.find(o => o.value == text))
{ {
this.__select_options.push(<SelectOption>{ this.__select_options.push(<SelectOption>{
value: text, value: text,
@ -891,7 +891,6 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
else if(!this.multiple && this.value !== text) else if(!this.multiple && this.value !== text)
{ {
this.value = text; this.value = text;
return;
} }
// Once added to options, add to value / tags // Once added to options, add to value / tags
@ -915,7 +914,7 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
let result = validators.filter(v => let result = validators.filter(v =>
v.execute(text, v.param, {node: this}), v.execute(text, v.param, {node: this}),
); );
return result.length == 0; return validators.length > 0 && result.length == 0 || validators.length == 0;
} }
/** /**