fix one left over needed property and added getter&setter for deprecated needed property

This commit is contained in:
ralf 2022-02-28 12:12:04 +02:00
parent 1518c38c72
commit cdb944147f

View File

@ -82,6 +82,26 @@ const Et2InputWidgetMixin = (superclass) =>
}; };
} }
/**
* Compatibility for deprecated name "needed"
*
* @deprecated use required instead
* @param val
*/
set needed(val : boolean)
{
this.required = val;
}
/**
* Compatibility for deprecated name "needed"
*
* @deprecated use required instead
*/
get needed()
{
return this.required;
}
constructor(...args : any[]) constructor(...args : any[])
{ {
super(...args); super(...args);
@ -103,7 +123,7 @@ const Et2InputWidgetMixin = (superclass) =>
{ {
super.updated(changedProperties); super.updated(changedProperties);
// Needed changed, add / remove validator // required changed, add / remove validator
if(changedProperties.has('required')) if(changedProperties.has('required'))
{ {
// Remove class // Remove class
@ -216,7 +236,7 @@ const Et2InputWidgetMixin = (superclass) =>
debugger; debugger;
// Check for required // Check for required
if(this.needed && !this.readonly && !this.disabled && if(this.required && !this.readonly && !this.disabled &&
(this.getValue() == null || this.getValue().valueOf() == '')) (this.getValue() == null || this.getValue().valueOf() == ''))
{ {
messages.push(this.egw().lang('Field must not be empty !!!')); messages.push(this.egw().lang('Field must not be empty !!!'));