Et2Textbox: Also accept RegExp as validator

Previously only accepted string
This commit is contained in:
nathan 2024-08-06 08:41:11 -06:00
parent e583de2bce
commit 7d07539f10

View File

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