Merge master to 0.18

This commit is contained in:
Nick O'Leary
2017-12-03 22:31:26 +00:00
61 changed files with 3078 additions and 1013 deletions

View File

@@ -99,7 +99,7 @@
this.uiSelect = this.elementDiv.wrap( "<div>" ).parent();
var attrStyle = this.element.attr('style');
var m;
if ((m = /width\s*:\s*(\d+(%|px))/i.exec(attrStyle)) !== null) {
if ((m = /width\s*:\s*(calc\s*\(.*\)|\d+(%|px))/i.exec(attrStyle)) !== null) {
this.element.css('width','100%');
this.uiSelect.width(m[1]);
this.uiWidth = null;

View File

@@ -1961,12 +1961,12 @@ RED.editor = (function() {
tabs.addTab({
id: 'expression-help',
label: 'Function reference',
label: RED._('expressionEditor.functionReference'),
content: $("#node-input-expression-tab-help")
});
tabs.addTab({
id: 'expression-tests',
label: 'Test',
label: RED._('expressionEditor.test'),
content: $("#node-input-expression-tab-test")
});
testDataEditor = RED.editor.createEditor({

View File

@@ -21,7 +21,7 @@ RED.palette = (function() {
var categoryContainers = {};
function createCategoryContainer(category, label){
function createCategoryContainer(category, label) {
label = (label || category).replace(/_/g, " ");
var catDiv = $('<div id="palette-container-'+category+'" class="palette-category palette-close hide">'+
'<div id="palette-header-'+category+'" class="palette-header"><i class="expanded fa fa-angle-down"></i><span>'+label+'</span></div>'+
@@ -325,14 +325,26 @@ RED.palette = (function() {
}
}
}
function hideNodeType(nt) {
var nodeTypeId = escapeNodeType(nt);
$("#palette_node_"+nodeTypeId).hide();
var paletteNode = $("#palette_node_"+nodeTypeId);
paletteNode.hide();
var categoryNode = paletteNode.closest(".palette-category");
var cl = categoryNode.find(".palette_node");
var c = 0;
for (var i = 0; i < cl.length; i++) {
if ($(cl[i]).css('display') === 'none') { c += 1; }
}
if (c === cl.length) { categoryNode.hide(); }
}
function showNodeType(nt) {
var nodeTypeId = escapeNodeType(nt);
$("#palette_node_"+nodeTypeId).show();
var paletteNode = $("#palette_node_"+nodeTypeId);
var categoryNode = paletteNode.closest(".palette-category");
categoryNode.show();
paletteNode.show();
}
function refreshNodeTypes() {
@@ -396,7 +408,6 @@ RED.palette = (function() {
RED.events.on('registry:node-type-removed', function(nodeType) {
removeNodeType(nodeType);
});
RED.events.on('registry:node-set-enabled', function(nodeSet) {
for (var j=0;j<nodeSet.types.length;j++) {
showNodeType(nodeSet.types[j]);
@@ -427,7 +438,6 @@ RED.palette = (function() {
}
});
$("#palette > .palette-spinner").show();
$("#palette-search input").searchBox({

View File

@@ -255,16 +255,19 @@ RED.typeSearch = (function() {
var commonCount = 0;
var item;
for(i=0;i<common.length;i++) {
item = {
type: common[i],
common: true,
def: RED.nodes.getType(common[i])
};
item.label = getTypeLabel(item.type,item.def);
if (i === common.length-1) {
item.separator = true;
var itemDef = RED.nodes.getType(common[i]);
if (itemDef) {
item = {
type: common[i],
common: true,
def: itemDef
};
item.label = getTypeLabel(item.type,item.def);
if (i === common.length-1) {
item.separator = true;
}
searchResults.editableList('addItem', item);
}
searchResults.editableList('addItem', item);
}
for(i=0;i<Math.min(5,recentlyUsed.length);i++) {
item = {

View File

@@ -171,7 +171,7 @@ RED.utils = (function() {
}
function formatNumber(element,obj,sourceId,path,cycle,initialFormat) {
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path]) || initialFormat || "dec";
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path] && formattedPaths[sourceId][path]['number']) || initialFormat || "dec";
if (cycle) {
if (format === 'dec') {
if ((obj.toString().length===13) && (obj<=2147483647000)) {
@@ -187,10 +187,12 @@ RED.utils = (function() {
format = 'dec';
}
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
formattedPaths[sourceId][path] = format;
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
formattedPaths[sourceId][path]['number'] = format;
} else if (initialFormat !== undefined){
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
formattedPaths[sourceId][path] = format;
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
formattedPaths[sourceId][path]['number'] = format;
}
if (format === 'dec') {
element.text(""+obj);
@@ -204,7 +206,7 @@ RED.utils = (function() {
}
function formatBuffer(element,button,sourceId,path,cycle) {
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path]) || "raw";
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path] && formattedPaths[sourceId][path]['buffer']) || "raw";
if (cycle) {
if (format === 'raw') {
format = 'string';
@@ -212,7 +214,8 @@ RED.utils = (function() {
format = 'raw';
}
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
formattedPaths[sourceId][path] = format;
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
formattedPaths[sourceId][path]['buffer'] = format;
}
if (format === 'raw') {
button.text('raw');