mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
c37ea90206
commit
f7a6a333e1
@ -32,6 +32,21 @@
|
||||
return v;
|
||||
}
|
||||
}
|
||||
var contextLabel = function(container,value) {
|
||||
var that = this;
|
||||
container.css("pointer-events","none");
|
||||
container.css("flex-grow",0);
|
||||
container.css("position",'relative');
|
||||
container.css("overflow",'visible');
|
||||
$('<div></div>').text(value).css({
|
||||
position: "absolute",
|
||||
bottom:"-2px",
|
||||
right: "5px",
|
||||
"font-size": "0.7em",
|
||||
opacity: 0.3
|
||||
}).appendTo(container);
|
||||
this.elementDiv.show();
|
||||
}
|
||||
var mapDeprecatedIcon = function(icon) {
|
||||
if (/^red\/images\/typedInput\/.+\.png$/.test(icon)) {
|
||||
icon = icon.replace(/.png$/,".svg");
|
||||
@ -44,13 +59,15 @@
|
||||
options:[],
|
||||
validate:RED.utils.validatePropertyExpression,
|
||||
parse: contextParse,
|
||||
export: contextExport
|
||||
export: contextExport,
|
||||
valueLabel: contextLabel
|
||||
},
|
||||
global: {value:"global",label:"global.",hasValue:true,
|
||||
options:[],
|
||||
validate:RED.utils.validatePropertyExpression,
|
||||
parse: contextParse,
|
||||
export: contextExport
|
||||
export: contextExport,
|
||||
valueLabel: contextLabel
|
||||
},
|
||||
str: {value:"str",label:"string",icon:"red/images/typedInput/az.svg"},
|
||||
num: {value:"num",label:"number",icon:"red/images/typedInput/09.svg",validate:/^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/},
|
||||
@ -592,13 +609,21 @@
|
||||
_updateOptionSelectLabel: function(o) {
|
||||
var opt = this.typeMap[this.propertyType];
|
||||
this.optionSelectLabel.empty();
|
||||
if (opt.hasValue) {
|
||||
this.valueLabelContainer.empty();
|
||||
this.valueLabelContainer.show();
|
||||
} else {
|
||||
this.valueLabelContainer.hide();
|
||||
}
|
||||
if (this.typeMap[this.propertyType].valueLabel) {
|
||||
if (opt.multiple) {
|
||||
this.typeMap[this.propertyType].valueLabel.call(this,this.optionSelectLabel,o);
|
||||
this.typeMap[this.propertyType].valueLabel.call(this,opt.hasValue?this.valueLabelContainer:this.optionSelectLabel,o);
|
||||
} else {
|
||||
this.typeMap[this.propertyType].valueLabel.call(this,this.optionSelectLabel,o.value);
|
||||
this.typeMap[this.propertyType].valueLabel.call(this,opt.hasValue?this.valueLabelContainer:this.optionSelectLabel,o.value);
|
||||
}
|
||||
} else if (!opt.multiple) {
|
||||
}
|
||||
if (!this.typeMap[this.propertyType].valueLabel || opt.hasValue) {
|
||||
if (!opt.multiple) {
|
||||
if (o.icon) {
|
||||
if (o.icon.indexOf("<") === 0) {
|
||||
$(o.icon).prependTo(this.optionSelectLabel);
|
||||
@ -621,6 +646,7 @@
|
||||
} else {
|
||||
this.optionSelectLabel.text(o.length+" selected");
|
||||
}
|
||||
}
|
||||
},
|
||||
_destroy: function() {
|
||||
if (this.optionMenu) {
|
||||
@ -893,6 +919,7 @@
|
||||
// Reset any CSS the custom label may have set
|
||||
this.valueLabelContainer.css("pointer-events","");
|
||||
this.valueLabelContainer.css("flex-grow",1);
|
||||
this.valueLabelContainer.css("overflow","hidden");
|
||||
this.valueLabelContainer.show();
|
||||
this.valueLabelContainer.empty();
|
||||
this.elementDiv.hide();
|
||||
|
Loading…
Reference in New Issue
Block a user