Skip to content

Commit

Permalink
Fix package.json conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Nov 24, 2016
2 parents de64fc8 + 659c326 commit f2797a4
Show file tree
Hide file tree
Showing 23 changed files with 4,989 additions and 76 deletions.
10 changes: 9 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ module.exports = function(grunt) {
"public/vendor/vendor.css": [
// TODO: resolve relative resource paths in
// bootstrap/FA/jquery
],
"public/vendor/jsonata/jsonata.js": [
"node_modules/jsonata/jsonata.js",
"editor/vendor/jsonata/formatter.js"
]
}
}
Expand All @@ -160,7 +164,11 @@ module.exports = function(grunt) {
build: {
files: {
'public/red/red.min.js': 'public/red/red.js',
'public/red/main.min.js': 'public/red/main.js'
'public/red/main.min.js': 'public/red/main.js',
'public/vendor/jsonata/jsonata.min.js': 'public/vendor/jsonata/jsonata.js',
'public/vendor/ace/mode-jsonata.js': 'editor/vendor/jsonata/mode-jsonata.js',
'public/vendor/ace/worker-jsonata.js': 'editor/vendor/jsonata/worker-jsonata.js',
'public/vendor/ace/snippets/jsonata.js': 'editor/vendor/jsonata/snippets-jsonata.js'
}
}
},
Expand Down
Binary file added editor/images/typedInput/expr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion editor/js/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RED.i18n = (function() {
dynamicLoad: false,
load:'current',
ns: {
namespaces: ["editor","node-red"],
namespaces: ["editor","node-red","jsonata"],
defaultNs: "editor"
},
fallbackLng: ['en-US'],
Expand Down
42 changes: 38 additions & 4 deletions editor/js/ui/common/typedInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
}
return true;
}

var allOptions = {
msg: {value:"msg",label:"msg.",validate:validateExpression},
flow: {value:"flow",label:"flow.",validate:validateExpression},
Expand All @@ -94,7 +95,22 @@
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.png",options:["true","false"]},
json: {value:"json",label:"JSON",icon:"red/images/typedInput/json.png", validate: function(v) { try{JSON.parse(v);return true;}catch(e){return false;}}},
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.png"},
date: {value:"date",label:"timestamp",hasValue:false}
date: {value:"date",label:"timestamp",hasValue:false},
jsonata: {
value: "jsonata",
label: "expression",
icon: "red/images/typedInput/expr.png",
validate: function(v) { try{jsonata(v);return true;}catch(e){return false;}},
expand:function() {
var that = this;
RED.editor.editExpression({
value: this.value().replace(/\t/g,"\n"),
complete: function(v) {
that.value(v.replace(/\n/g,"\t"));
}
})
}
}
};
var nlsd = false;

Expand Down Expand Up @@ -188,7 +204,7 @@
that.uiSelect.addClass('red-ui-typedInput-focus');
});


this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"><i class="fa fa-ellipsis-h"></i></button>').appendTo(this.uiSelect);


this.type(this.options.default||this.typeList[0].value);
Expand Down Expand Up @@ -322,11 +338,16 @@
this.uiSelect.width(this.uiWidth);
}
if (this.typeMap[this.propertyType] && this.typeMap[this.propertyType].hasValue === false) {
this.selectTrigger.css('width',"100%");
this.selectTrigger.addClass("red-ui-typedInput-full-width");
} else {
this.selectTrigger.width('auto');
this.selectTrigger.removeClass("red-ui-typedInput-full-width");
var labelWidth = this._getLabelWidth(this.selectTrigger);
this.elementDiv.css('left',labelWidth+"px");
if (this.optionExpandButton.is(":visible")) {
this.elementDiv.css('right',"22px");
} else {
this.elementDiv.css('right','0');
}
if (this.optionSelectTrigger) {
this.optionSelectTrigger.css({'left':(labelWidth)+"px",'width':'calc( 100% - '+labelWidth+'px )'});
}
Expand Down Expand Up @@ -396,6 +417,9 @@
this.selectLabel.text(opt.label);
}
if (opt.options) {
if (this.optionExpandButton) {
this.optionExpandButton.hide();
}
if (this.optionSelectTrigger) {
this.optionSelectTrigger.show();
this.elementDiv.hide();
Expand Down Expand Up @@ -429,6 +453,16 @@
}
this.elementDiv.show();
}
if (opt.expand && typeof opt.expand === 'function') {
this.optionExpandButton.show();
this.optionExpandButton.off('click');
this.optionExpandButton.on('click',function(evt) {
evt.preventDefault();
opt.expand.call(that);
})
} else {
this.optionExpandButton.hide();
}
this.element.trigger('change',this.propertyType,this.value());
}
if (image) {
Expand Down
Loading

0 comments on commit f2797a4

Please sign in to comment.