Et2Date: Fix required validation message was always shown after changing a required date

Some missed changes after moving from Lion
This commit is contained in:
nathan 2022-09-20 10:44:28 -06:00
parent 7dd0165cd2
commit e03fea2e9b
2 changed files with 14 additions and 7 deletions

View File

@ -455,7 +455,7 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(ValidateMixin(LitFl
}; };
} }
set_value(value) set value(value)
{ {
if(!value || value == 0 || value == "0") if(!value || value == 0 || value == "0")
{ {
@ -487,13 +487,8 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(ValidateMixin(LitFl
} }
} }
getValue() get value()
{ {
if(this.readonly || this.disabled)
{
return null;
}
// Copied from flatpickr, since Et2InputWidget overwrote flatpickr.getValue() // Copied from flatpickr, since Et2InputWidget overwrote flatpickr.getValue()
if(!this._inputElement) if(!this._inputElement)
{ {

View File

@ -2,6 +2,18 @@ import {Required as LionRequired} from "@lion/form-core";
export class Required extends LionRequired export class Required extends LionRequired
{ {
/**
* Returns a Boolean. True if the test fails
* @param {?} [modelValue]
* @param {?} [param]
* @param {{}} [config]
* @returns {Boolean|Promise<Boolean>}
*/
execute(modelValue : any, param : any, config : {}) : boolean | Promise<boolean>
{
return modelValue == "" || modelValue == undefined || modelValue == null;
}
/** /**
* Give a message about this field being required. Could be customised according to MessageData. * Give a message about this field being required. Could be customised according to MessageData.
* @param {MessageData | undefined} data * @param {MessageData | undefined} data