Add the [int] setting type for settings that are a list of integers.

The RegExpValidator (more of a restrictor than a validator) requires the
text to start with a '[' and then have a sequence of integers separated by
commas. A trailing ']' is accepted.
This commit is contained in:
Mark Burton 2017-01-27 15:54:19 +00:00
parent d288619ebf
commit db3cf0c0fb
4 changed files with 8 additions and 2 deletions

View file

@ -98,9 +98,9 @@ SettingItem
selectByMouse: true;
maximumLength: (definition.type == "str") ? 20 : 10;
maximumLength: (definition.type == "[int]") ? 20 : 10;
validator: RegExpValidator { regExp: (definition.type == "str") ? /^.{0,20}$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } // definition.type property from parent loader used to disallow fractional number entry
validator: RegExpValidator { regExp: (definition.type == "[int]") ? /^\[(\s*-?[0-9]+\s*,)*(\s*-?[0-9]+)\s*\]$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } // definition.type property from parent loader used to disallow fractional number entry
Binding
{