mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure TypedInput Change event is passed type/value properties
Fixes #2883
This commit is contained in:
parent
0be82d964e
commit
5f8804c25c
@ -342,7 +342,7 @@
|
||||
this.input.on('change', function() {
|
||||
that.validate();
|
||||
that.element.val(that.value());
|
||||
that.element.trigger('change',that.propertyType,that.value());
|
||||
that.element.trigger('change',[that.propertyType,that.value()]);
|
||||
});
|
||||
this.input.on('keydown', function(evt) {
|
||||
if (evt.keyCode >= 37 && evt.keyCode <= 40) {
|
||||
@ -606,7 +606,7 @@
|
||||
}
|
||||
if (opt.hasValue) {
|
||||
this.optionValue = o.value;
|
||||
this.input.trigger('change',this.propertyType,this.value());
|
||||
this.input.trigger('change',[this.propertyType,this.value()]);
|
||||
}
|
||||
} else {
|
||||
this.optionSelectLabel.text(o.length+" selected");
|
||||
@ -699,7 +699,7 @@
|
||||
opt.valueLabel.call(this,this.valueLabelContainer,value);
|
||||
}
|
||||
}
|
||||
this.input.trigger('change',this.type(),value);
|
||||
this.input.trigger('change',[this.type(),value]);
|
||||
}
|
||||
},
|
||||
type: function(type) {
|
||||
@ -864,7 +864,7 @@
|
||||
});
|
||||
}
|
||||
this._trigger("typechange",null,this.propertyType);
|
||||
this.input.trigger('change',this.propertyType,this.value());
|
||||
this.input.trigger('change',[this.propertyType,this.value()]);
|
||||
} else {
|
||||
if (this.optionSelectTrigger) {
|
||||
this.optionSelectTrigger.hide();
|
||||
@ -934,7 +934,7 @@
|
||||
}
|
||||
}
|
||||
this._trigger("typechange",null,this.propertyType);
|
||||
this.input.trigger('change',this.propertyType,this.value());
|
||||
this.input.trigger('change',[this.propertyType,this.value()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,14 +356,14 @@ RED.editor = (function() {
|
||||
function attachPropertyChangeHandler(node,definition,property,prefix) {
|
||||
var input = $("#"+prefix+"-"+property);
|
||||
if (definition !== undefined && "format" in definition[property] && definition[property].format !== "" && input[0].nodeName === "DIV") {
|
||||
$("#"+prefix+"-"+property).on('change keyup', function(event,skipValidation) {
|
||||
if (!skipValidation) {
|
||||
$("#"+prefix+"-"+property).on('change keyup', function(event,) {
|
||||
if (!$(this).attr("skipValidation")) {
|
||||
validateNodeEditor(node,prefix);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#"+prefix+"-"+property).on("change", function(event,skipValidation) {
|
||||
if (!skipValidation) {
|
||||
if (!$(this).attr("skipValidation")) {
|
||||
validateNodeEditor(node,prefix);
|
||||
}
|
||||
});
|
||||
@ -476,13 +476,27 @@ RED.editor = (function() {
|
||||
// to prevent full node validation from being triggered each time
|
||||
for (var d in definition.defaults) {
|
||||
if (definition.defaults.hasOwnProperty(d)) {
|
||||
$("#"+prefix+"-"+d).trigger("change",[true]);
|
||||
var el = $("#"+prefix+"-"+d);
|
||||
el.attr("skipValidation", true);
|
||||
if (el.data("noderedTypedInput") !== undefined) {
|
||||
el.trigger("change",[el.typedInput('type'),el.typedInput('value')]);
|
||||
} else {
|
||||
el.trigger("change");
|
||||
}
|
||||
el.removeAttr("skipValidation");
|
||||
}
|
||||
}
|
||||
if (definition.credentials) {
|
||||
for (d in definition.credentials) {
|
||||
if (definition.credentials.hasOwnProperty(d)) {
|
||||
$("#"+prefix+"-"+d).trigger("change",[true]);
|
||||
var el = $("#"+prefix+"-"+d);
|
||||
el.attr("skipValidation", true);
|
||||
if (el.data("noderedTypedInput") !== undefined) {
|
||||
el.trigger("change",[el.typedInput('type'),el.typedInput('value')]);
|
||||
} else {
|
||||
el.trigger("change");
|
||||
}
|
||||
el.removeAttr("skipValidation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user