Fix validation messages after Shoelace update

- some messages (textbox) were out of position
- Selectboxes did not show validation message
- Selectbox considered false a valid value for required, even if that wasn't an option
This commit is contained in:
nathan 2023-11-16 13:13:36 -07:00
parent 3cf4cbab9a
commit 2e2c3fb0b6
3 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,9 @@ import {LionValidationFeedback, Validator} from "@lion/form-core";
import {et2_csvSplit} from "../et2_core_common";
import {dedupeMixin} from "@lion/core";
// LionValidationFeedback needs to be registered manually
window.customElements.define('lion-validation-feedback', LionValidationFeedback);
/**
* This mixin will allow any LitElement to become an Et2InputWidget
*
@ -87,7 +90,7 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
width: 100%;
}
.form-field__feedback {
.form-control__help-text {
position: relative;
}
`

View File

@ -327,7 +327,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
}
// emptyLabel is fine
if(!(this.value) && this.value !== '0' && (this.emptyLabel || this.placeholder))
if((this.value == '' || this.value == []) && (this.emptyLabel || this.placeholder))
{
return;
}
@ -856,6 +856,9 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
${this._optionsTemplate()}
${this._extraTemplate()}
<slot></slot>
<div slot="help-text">
<slot name="feedback"></slot>
</div>
</sl-select>
`;
}

View File

@ -2130,6 +2130,8 @@ div.message.floating, lion-validation-feedback[type] {
lion-validation-feedback[type] {
top: initial;
margin-top: calc(-0.2 * var(--sl-input-height-medium));
width: fit-content;
white-space: nowrap;
}
.message.validation_error, lion-validation-feedback[type="error"] {