Add support of propty validation msg 4 typeField

This commit is contained in:
GogoVega 2023-11-27 10:55:27 +01:00
parent 5b5b06cc06
commit 26a4235028
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -237,7 +237,13 @@ RED.editor = (function() {
if (defaults[property].hasOwnProperty("format") && defaults[property].format !== "" && input[0].nodeName === "DIV") {
value = input.text();
}
var valid = validateNodeProperty(node, defaults, property,value);
const isTypeField =
input.attr("type") === "hidden" &&
input.css("display") === "none" &&
input.attr("class") !== "red-ui-typedInput" &&
input.closest("div").find("input").length >= 2;
input = isTypeField ? input.closest("div").find("input[class='red-ui-typedInput']") : input;
var valid = validateNodeProperty(node, defaults, property, value);
if (((typeof valid) === "string") || !valid) {
input.addClass("input-error");
input.next(".red-ui-typedInput-container").addClass("input-error");
@ -245,9 +251,10 @@ RED.editor = (function() {
var tooltip = input.data("tooltip");
if (tooltip) {
tooltip.setContent(valid);
}
else {
tooltip = RED.popover.tooltip(input, valid);
} else {
const typedInput = input.next(".red-ui-typedInput-container").find(".red-ui-typedInput-input-wrap");
const target = typedInput.length > 0 ? typedInput : input;
tooltip = RED.popover.tooltip(target, valid);
input.data("tooltip", tooltip);
}
}