react-jsonschema-form
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -84,4 +84,3 @@ "use strict"; | ||
if (!title) { | ||
// See #312: Ensure compatibility with old versions of React. | ||
return _react2.default.createElement("div", null); | ||
return null; | ||
} | ||
@@ -98,4 +97,3 @@ var id = idSchema.$id + "__title"; | ||
if (!description) { | ||
// See #312: Ensure compatibility with old versions of React. | ||
return _react2.default.createElement("div", null); | ||
return null; | ||
} | ||
@@ -102,0 +100,0 @@ var id = idSchema.$id + "__description"; |
@@ -22,4 +22,3 @@ "use strict"; | ||
if (!description) { | ||
// See #312: Ensure compatibility with old versions of React. | ||
return _react2.default.createElement("div", null); | ||
return null; | ||
} | ||
@@ -26,0 +25,0 @@ if (typeof description === "string") { |
@@ -109,4 +109,3 @@ "use strict"; | ||
if (!label) { | ||
// See #312: Ensure compatibility with old versions of React. | ||
return _react2.default.createElement("div", null); | ||
return null; | ||
} | ||
@@ -145,4 +144,3 @@ return _react2.default.createElement( | ||
if (!help) { | ||
// See #312: Ensure compatibility with old versions of React. | ||
return _react2.default.createElement("div", null); | ||
return null; | ||
} | ||
@@ -168,3 +166,3 @@ if (typeof help === "string") { | ||
if (errors.length === 0) { | ||
return _react2.default.createElement("div", null); | ||
return null; | ||
} | ||
@@ -338,6 +336,4 @@ | ||
var autofocus = Boolean(props.autofocus || uiSchema["ui:autofocus"]); | ||
if ((0, _keys2.default)(schema).length === 0) { | ||
// See #312: Ensure compatibility with old versions of React. | ||
return _react2.default.createElement("div", null); | ||
return null; | ||
} | ||
@@ -344,0 +340,0 @@ |
@@ -172,4 +172,11 @@ "use strict"; | ||
if (!type && schema.enum) { | ||
type = "string"; | ||
return "string"; | ||
} | ||
if (type instanceof Array && type.length === 2 && type.includes("null")) { | ||
return type.find(function (type) { | ||
return type !== "null"; | ||
}); | ||
} | ||
return type; | ||
@@ -319,2 +326,5 @@ } | ||
function isObject(thing) { | ||
if (thing instanceof File) { | ||
return false; | ||
} | ||
return (typeof thing === "undefined" ? "undefined" : (0, _typeof3.default)(thing)) === "object" && thing !== null && !Array.isArray(thing); | ||
@@ -383,3 +393,2 @@ } | ||
var propertyHash = arrayToHash(properties); | ||
var orderHash = arrayToHash(order); | ||
var extraneous = order.filter(function (prop) { | ||
@@ -389,8 +398,13 @@ return prop !== "*" && !propertyHash[prop]; | ||
if (extraneous.length) { | ||
throw new Error("uiSchema order list contains extraneous " + errorPropList(extraneous)); | ||
console.warn("uiSchema order list contains extraneous " + errorPropList(extraneous)); | ||
} | ||
var orderFiltered = order.filter(function (prop) { | ||
return prop === "*" || propertyHash[prop]; | ||
}); | ||
var orderHash = arrayToHash(orderFiltered); | ||
var rest = properties.filter(function (prop) { | ||
return !orderHash[prop]; | ||
}); | ||
var restIndex = order.indexOf("*"); | ||
var restIndex = orderFiltered.indexOf("*"); | ||
if (restIndex === -1) { | ||
@@ -400,9 +414,9 @@ if (rest.length) { | ||
} | ||
return order; | ||
return orderFiltered; | ||
} | ||
if (restIndex !== order.lastIndexOf("*")) { | ||
if (restIndex !== orderFiltered.lastIndexOf("*")) { | ||
throw new Error("uiSchema order list contains more than one wildcard item"); | ||
} | ||
var complete = [].concat((0, _toConsumableArray3.default)(order)); | ||
var complete = [].concat((0, _toConsumableArray3.default)(orderFiltered)); | ||
complete.splice.apply(complete, [restIndex, 1].concat((0, _toConsumableArray3.default)(rest))); | ||
@@ -409,0 +423,0 @@ return complete; |
@@ -205,3 +205,4 @@ "use strict"; | ||
message = e.message, | ||
params = e.params; | ||
params = e.params, | ||
schemaPath = e.schemaPath; | ||
@@ -216,3 +217,4 @@ var property = "" + dataPath; | ||
params: params, // specific to ajv | ||
stack: (property + " " + message).trim() | ||
stack: (property + " " + message).trim(), | ||
schemaPath: schemaPath | ||
}; | ||
@@ -219,0 +221,0 @@ }); |
{ | ||
"name": "react-jsonschema-form", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
5789
1282244