mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
@@ -40,9 +40,22 @@ RED.validators = {
|
||||
return opt ? RED._("validator.errors.invalid-regexp") : false;
|
||||
};
|
||||
},
|
||||
typedInput: function(ptypeName,isConfig,mopt) {
|
||||
typedInput: function(ptypeName, isConfig, mopt) {
|
||||
let options = ptypeName
|
||||
if (typeof ptypeName === 'string' ) {
|
||||
options = {}
|
||||
options.typeField = ptypeName
|
||||
options.isConfig = isConfig
|
||||
options.allowBlank = false
|
||||
}
|
||||
return function(v, opt) {
|
||||
var ptype = $("#node-"+(isConfig?"config-":"")+"input-"+ptypeName).val() || this[ptypeName];
|
||||
let ptype = options.type
|
||||
if (!ptype && options.typeField) {
|
||||
ptype = $("#node-"+(options.isConfig?"config-":"")+"input-"+options.typeField).val() || this[options.typeField];
|
||||
}
|
||||
if (options.allowBlank && v === '') {
|
||||
return true
|
||||
}
|
||||
const result = RED.utils.validateTypedProperty(v, ptype, opt)
|
||||
if (result === true || opt) {
|
||||
// Valid, or opt provided - return result as-is
|
||||
|
Reference in New Issue
Block a user