json-editor
Advanced tools
Comparing version
{ | ||
"name": "json-editor", | ||
"version": "0.7.18", | ||
"version": "0.7.19", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Jeremy Dorn <jeremy@jeremydorn.com>" |
@@ -19,3 +19,3 @@ Contributing | ||
If you fix a bug or add a cool feature, plase submit a pull request! | ||
If you fix a bug or add a cool feature, please submit a pull request! | ||
@@ -22,0 +22,0 @@ |
113
Gruntfile.js
@@ -5,57 +5,62 @@ 'use strict'; | ||
grunt.initConfig({ | ||
concat: { | ||
dist: { | ||
src: [ | ||
// License & version info, start the containing closure | ||
'src/intro.js', | ||
// Simple inheritance | ||
'src/class.js', | ||
// IE9 polyfills | ||
'src/ie9.js', | ||
// Utils like extend, each, and trigger | ||
'src/utilities.js', | ||
// The main JSONEditor class | ||
'src/core.js', | ||
concat_sourcemap: { | ||
options: { | ||
sourcesContent: true | ||
}, | ||
target: { | ||
files: { | ||
'dist/jsoneditor.js': [ | ||
// License & version info, start the containing closure | ||
'src/intro.js', | ||
// Simple inheritance | ||
'src/class.js', | ||
// IE9 polyfills | ||
'src/ie9.js', | ||
// Utils like extend, each, and trigger | ||
'src/utilities.js', | ||
// The main JSONEditor class | ||
'src/core.js', | ||
// JSON Schema validator | ||
'src/validator.js', | ||
// All the editors | ||
'src/editor.js', | ||
'src/editors/null.js', | ||
'src/editors/string.js', | ||
'src/editors/number.js', | ||
'src/editors/integer.js', | ||
'src/editors/object.js', | ||
'src/editors/array.js', | ||
'src/editors/table.js', | ||
'src/editors/multiple.js', | ||
'src/editors/enum.js', | ||
'src/editors/select.js', | ||
'src/editors/multiselect.js', | ||
'src/editors/base64.js', | ||
'src/editors/upload.js', | ||
'src/editors/checkbox.js', | ||
// JSON Schema validator | ||
'src/validator.js', | ||
// All the editors | ||
'src/editor.js', | ||
'src/editors/null.js', | ||
'src/editors/string.js', | ||
'src/editors/number.js', | ||
'src/editors/integer.js', | ||
'src/editors/object.js', | ||
'src/editors/array.js', | ||
'src/editors/table.js', | ||
'src/editors/multiple.js', | ||
'src/editors/enum.js', | ||
'src/editors/select.js', | ||
'src/editors/multiselect.js', | ||
'src/editors/base64.js', | ||
'src/editors/upload.js', | ||
'src/editors/checkbox.js', | ||
// All the themes and iconlibs | ||
'src/theme.js', | ||
'src/themes/*.js', | ||
'src/iconlib.js', | ||
'src/iconlibs/*.js', | ||
// All the themes and iconlibs | ||
'src/theme.js', | ||
'src/themes/*.js', | ||
'src/iconlib.js', | ||
'src/iconlibs/*.js', | ||
// The JS templating engines | ||
'src/templates/*.js', | ||
// The JS templating engines | ||
'src/templates/*.js', | ||
// Set the defaults | ||
'src/defaults.js', | ||
// Wrapper for $.fn style initialization | ||
'src/jquery.js', | ||
// End the closure | ||
'src/outro.js' | ||
], | ||
dest: 'dist/jsoneditor.js' | ||
// Set the defaults | ||
'src/defaults.js', | ||
// Wrapper for $.fn style initialization | ||
'src/jquery.js', | ||
// End the closure | ||
'src/outro.js' | ||
], | ||
} | ||
} | ||
@@ -65,3 +70,3 @@ }, | ||
dist: { | ||
src: '<%= concat.dist.dest %>', | ||
src: 'dist/jsoneditor.js', | ||
dest: 'dist/jsoneditor.min.js' | ||
@@ -132,10 +137,10 @@ }, | ||
// These plugins provide necessary tasks. | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-concat-sourcemap'); | ||
// Default task. | ||
grunt.registerTask('default', ['jshint:beforeconcat','concat','jshint:afterconcat','uglify']); | ||
grunt.registerTask('default', ['jshint:beforeconcat','concat_sourcemap','jshint:afterconcat','uglify']); | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "JSON Schema based editor", | ||
"version": "0.7.18", | ||
"version": "0.7.19", | ||
"main": "dist/jsoneditor.js", | ||
@@ -31,7 +31,7 @@ "author": { | ||
"devDependencies": { | ||
"grunt-contrib-concat": "~0.3.0", | ||
"grunt": "~0.4.2", | ||
"grunt-concat-sourcemap": "^0.4.3", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-uglify": "~0.2.0", | ||
"grunt-contrib-watch": "~0.5.3", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt": "~0.4.2" | ||
"grunt-contrib-watch": "~0.5.3" | ||
}, | ||
@@ -38,0 +38,0 @@ "scripts": { |
@@ -149,3 +149,2 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({ | ||
else this.theme.setGridColumnSize(editor.container,rows[i].editors[j].width); | ||
editor.container.className += ' container-' + key; | ||
row.appendChild(editor.container); | ||
@@ -166,3 +165,2 @@ } | ||
else self.theme.setGridColumnSize(editor.container,12); | ||
editor.container.className += ' container-' + key; | ||
row.appendChild(editor.container); | ||
@@ -522,3 +520,5 @@ }); | ||
insertPropertyControlUsingPropertyOrder: function (property, control, container) { | ||
var propertyOrder = this.schema.properties[property].propertyOrder; | ||
var propertyOrder; | ||
if (this.schema.properties[property]) | ||
propertyOrder = this.schema.properties[property].propertyOrder; | ||
if (typeof propertyOrder !== "number") propertyOrder = 1000; | ||
@@ -546,3 +546,7 @@ control.propertyOrder = propertyOrder; | ||
labelText = this.schema.properties[key].title ? this.schema.properties[key].title : key; | ||
if (this.schema.properties[key] && this.schema.properties[key].title) | ||
labelText = this.schema.properties[key].title; | ||
else | ||
labelText = key; | ||
label = self.theme.getCheckboxLabel(labelText); | ||
@@ -549,0 +553,0 @@ |
@@ -1,6 +0,6 @@ | ||
/*! JSON Editor v0.7.18 - JSON Schema -> HTML Editor | ||
/*! JSON Editor v0.7.19 - JSON Schema -> HTML Editor | ||
* By Jeremy Dorn - https://github.com/jdorn/json-editor/ | ||
* Released under the MIT license | ||
* | ||
* Date: 2015-05-09 | ||
* Date: 2015-06-08 | ||
*/ | ||
@@ -7,0 +7,0 @@ |
JSONEditor.defaults.templates["default"] = function() { | ||
var expandVars = function(vars) { | ||
var expanded = {}; | ||
$each(vars, function(i,el) { | ||
if(typeof el === "object" && el !== null) { | ||
var tmp = {}; | ||
$each(el, function(j,item) { | ||
tmp[i+'.'+j] = item; | ||
}); | ||
$extend(expanded,expandVars(tmp)); | ||
} | ||
else { | ||
expanded[i] = el; | ||
} | ||
}); | ||
return expanded; | ||
}; | ||
return { | ||
compile: function(template) { | ||
return function (vars) { | ||
var expanded = expandVars(vars); | ||
var matches = template.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g); | ||
var l = matches.length; | ||
// Shortcut if the template contains no variables | ||
if(!l) return function() { return template; }; | ||
// Pre-compute the search/replace functions | ||
// This drastically speeds up template execution | ||
var replacements = []; | ||
var get_replacement = function(i) { | ||
var p = matches[i].replace(/[{}\s]+/g,'').split('.'); | ||
var n = p.length; | ||
var func; | ||
if(n > 1) { | ||
var cur; | ||
func = function(vars) { | ||
cur = vars; | ||
for(i=0; i<n; i++) { | ||
cur = cur[p[i]]; | ||
if(!cur) break; | ||
} | ||
return cur; | ||
}; | ||
} | ||
else { | ||
p = p[0]; | ||
func = function(vars) { | ||
return vars[p]; | ||
}; | ||
} | ||
replacements.push({ | ||
s: matches[i], | ||
r: func | ||
}); | ||
}; | ||
for(var i=0; i<l; i++) { | ||
get_replacement(i); | ||
} | ||
// The compiled function | ||
return function(vars) { | ||
var ret = template+""; | ||
// Only supports basic {{var}} macro replacement | ||
$each(expanded,function(key,value) { | ||
ret = ret.replace(new RegExp('{{\\s*'+key+'\\s*}}','g'),value); | ||
}); | ||
var r; | ||
for(i=0; i<l; i++) { | ||
r = replacements[i]; | ||
ret = ret.replace(r.s, r.r(vars)); | ||
} | ||
return ret; | ||
@@ -30,0 +54,0 @@ }; |
@@ -71,3 +71,3 @@ /** | ||
var i; | ||
if(typeof obj.length === 'number') { | ||
if(!obj.hasOwnProperty('length') && typeof obj.length === 'number') { | ||
for(i=0; i<obj.length; i++) { | ||
@@ -74,0 +74,0 @@ if(callback(i,obj[i])===false) return; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
961586
38.87%71
1.43%13670
0.38%