mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3263 from node-red/ti-fix
Avoid redundant initialisation of TypedInput type
This commit is contained in:
commit
a091b82ba9
@ -556,7 +556,7 @@
|
|||||||
this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"></button>').appendTo(this.uiSelect);
|
this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"></button>').appendTo(this.uiSelect);
|
||||||
this.optionExpandButtonIcon = $('<i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i>').appendTo(this.optionExpandButton);
|
this.optionExpandButtonIcon = $('<i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i>').appendTo(this.optionExpandButton);
|
||||||
|
|
||||||
this.type(this.options.default||this.typeList[0].value);
|
this.type(this.typeField.val() || this.options.default||this.typeList[0].value);
|
||||||
this.typeChanged = !!this.options.default;
|
this.typeChanged = !!this.options.default;
|
||||||
}catch(err) {
|
}catch(err) {
|
||||||
console.log(err.stack);
|
console.log(err.stack);
|
||||||
@ -805,6 +805,7 @@
|
|||||||
var that = this;
|
var that = this;
|
||||||
var currentType = this.type();
|
var currentType = this.type();
|
||||||
this.typeMap = {};
|
this.typeMap = {};
|
||||||
|
var firstCall = (this.typeList === undefined);
|
||||||
this.typeList = types.map(function(opt) {
|
this.typeList = types.map(function(opt) {
|
||||||
var result;
|
var result;
|
||||||
if (typeof opt === 'string') {
|
if (typeof opt === 'string') {
|
||||||
@ -829,11 +830,15 @@
|
|||||||
}
|
}
|
||||||
this.menu = this._createMenu(this.typeList,{},function(v) { that.type(v) });
|
this.menu = this._createMenu(this.typeList,{},function(v) { that.type(v) });
|
||||||
if (currentType && !this.typeMap.hasOwnProperty(currentType)) {
|
if (currentType && !this.typeMap.hasOwnProperty(currentType)) {
|
||||||
|
if (!firstCall) {
|
||||||
this.type(this.typeList[0].value);
|
this.type(this.typeList[0].value);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.propertyType = null;
|
this.propertyType = null;
|
||||||
|
if (!firstCall) {
|
||||||
this.type(currentType);
|
this.type(currentType);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (this.typeList.length === 1 && !this.typeList[0].icon && (!this.typeList[0].label || this.typeList[0].showLabel === false)) {
|
if (this.typeList.length === 1 && !this.typeList[0].icon && (!this.typeList[0].label || this.typeList[0].showLabel === false)) {
|
||||||
this.selectTrigger.hide()
|
this.selectTrigger.hide()
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user