Et2Textbox: Also accept RegExp as validator

Previously only accepted string
This commit is contained in:
nathan 2024-08-06 08:41:11 -06:00 committed by ralf
parent ac3c50adef
commit b8b52d5a72

View File

@ -90,7 +90,7 @@ export class Et2Textbox extends Et2InputWidget(SlInput)
return this.__validator;
}
set validator(value)
set validator(value : string | RegExp)
{
if(typeof value == 'string')
{
@ -106,6 +106,11 @@ export class Et2Textbox extends Et2InputWidget(SlInput)
this.requestUpdate("validator");
}
else if(value instanceof RegExp)
{
this.__validator = value;
this.requestUpdate("validator");
}
}
}