react-jsonschema-form
Advanced tools
Comparing version 0.41.1 to 0.41.2
@@ -28,6 +28,6 @@ "use strict"; | ||
function ArrayFieldTitle(_ref) { | ||
var TitleField = _ref.TitleField; | ||
var idSchema = _ref.idSchema; | ||
var title = _ref.title; | ||
var required = _ref.required; | ||
var TitleField = _ref.TitleField, | ||
idSchema = _ref.idSchema, | ||
title = _ref.title, | ||
required = _ref.required; | ||
@@ -43,5 +43,5 @@ if (!title) { | ||
function ArrayFieldDescription(_ref2) { | ||
var DescriptionField = _ref2.DescriptionField; | ||
var idSchema = _ref2.idSchema; | ||
var description = _ref2.description; | ||
var DescriptionField = _ref2.DescriptionField, | ||
idSchema = _ref2.idSchema, | ||
description = _ref2.description; | ||
@@ -57,9 +57,8 @@ if (!description) { | ||
function IconBtn(props) { | ||
var _props$type = props.type; | ||
var type = _props$type === undefined ? "default" : _props$type; | ||
var icon = props.icon; | ||
var className = props.className; | ||
var _props$type = props.type, | ||
type = _props$type === undefined ? "default" : _props$type, | ||
icon = props.icon, | ||
className = props.className, | ||
otherProps = _objectWithoutProperties(props, ["type", "icon", "className"]); | ||
var otherProps = _objectWithoutProperties(props, ["type", "icon", "className"]); | ||
return _react2.default.createElement( | ||
@@ -78,3 +77,3 @@ "button", | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ArrayField).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (ArrayField.__proto__ || Object.getPrototypeOf(ArrayField)).call(this, props)); | ||
@@ -84,5 +83,5 @@ _this.onAddClick = function (event) { | ||
var items = _this.state.items; | ||
var _this$props = _this.props; | ||
var schema = _this$props.schema; | ||
var registry = _this$props.registry; | ||
var _this$props = _this.props, | ||
schema = _this$props.schema, | ||
registry = _this$props.registry; | ||
var definitions = registry.definitions; | ||
@@ -178,3 +177,3 @@ | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? { validate: false } : arguments[1]; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { validate: false }; | ||
@@ -188,5 +187,5 @@ (0, _utils.setState)(this, state, function () { | ||
value: function render() { | ||
var _props = this.props; | ||
var schema = _props.schema; | ||
var uiSchema = _props.uiSchema; | ||
var _props = this.props, | ||
schema = _props.schema, | ||
uiSchema = _props.uiSchema; | ||
@@ -209,29 +208,27 @@ if ((0, _utils.isFilesArray)(schema, uiSchema)) { | ||
var _props2 = this.props; | ||
var schema = _props2.schema; | ||
var uiSchema = _props2.uiSchema; | ||
var errorSchema = _props2.errorSchema; | ||
var idSchema = _props2.idSchema; | ||
var name = _props2.name; | ||
var required = _props2.required; | ||
var disabled = _props2.disabled; | ||
var readonly = _props2.readonly; | ||
var autofocus = _props2.autofocus; | ||
var _props2 = this.props, | ||
schema = _props2.schema, | ||
uiSchema = _props2.uiSchema, | ||
errorSchema = _props2.errorSchema, | ||
idSchema = _props2.idSchema, | ||
name = _props2.name, | ||
required = _props2.required, | ||
disabled = _props2.disabled, | ||
readonly = _props2.readonly, | ||
autofocus = _props2.autofocus; | ||
var title = schema.title === undefined ? name : schema.title; | ||
var items = this.state.items; | ||
var _props$registry = this.props.registry; | ||
var definitions = _props$registry.definitions; | ||
var fields = _props$registry.fields; | ||
var TitleField = fields.TitleField; | ||
var DescriptionField = fields.DescriptionField; | ||
var _props$registry = this.props.registry, | ||
definitions = _props$registry.definitions, | ||
fields = _props$registry.fields; | ||
var TitleField = fields.TitleField, | ||
DescriptionField = fields.DescriptionField; | ||
var itemsSchema = (0, _utils.retrieveSchema)(schema.items, definitions); | ||
var _getUiOptions = (0, _utils.getUiOptions)(uiSchema); | ||
var _getUiOptions = (0, _utils.getUiOptions)(uiSchema), | ||
_getUiOptions$addable = _getUiOptions.addable, | ||
addable = _getUiOptions$addable === undefined ? true : _getUiOptions$addable; | ||
var _getUiOptions$addable = _getUiOptions.addable; | ||
var addable = _getUiOptions$addable === undefined ? true : _getUiOptions$addable; | ||
return _react2.default.createElement( | ||
@@ -278,13 +275,13 @@ "fieldset", | ||
value: function renderMultiSelect() { | ||
var _props3 = this.props; | ||
var schema = _props3.schema; | ||
var idSchema = _props3.idSchema; | ||
var uiSchema = _props3.uiSchema; | ||
var disabled = _props3.disabled; | ||
var readonly = _props3.readonly; | ||
var autofocus = _props3.autofocus; | ||
var _props3 = this.props, | ||
schema = _props3.schema, | ||
idSchema = _props3.idSchema, | ||
uiSchema = _props3.uiSchema, | ||
disabled = _props3.disabled, | ||
readonly = _props3.readonly, | ||
autofocus = _props3.autofocus; | ||
var items = this.state.items; | ||
var _props$registry2 = this.props.registry; | ||
var widgets = _props$registry2.widgets; | ||
var definitions = _props$registry2.definitions; | ||
var _props$registry2 = this.props.registry, | ||
widgets = _props$registry2.widgets, | ||
definitions = _props$registry2.definitions; | ||
@@ -294,9 +291,7 @@ var itemsSchema = (0, _utils.retrieveSchema)(schema.items, definitions); | ||
var _getUiOptions$enumOpt = _extends({}, (0, _utils.getUiOptions)(uiSchema), { enumOptions: enumOptions }); | ||
var _getUiOptions$enumOpt = _extends({}, (0, _utils.getUiOptions)(uiSchema), { enumOptions: enumOptions }), | ||
_getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget, | ||
widget = _getUiOptions$enumOpt2 === undefined ? "select" : _getUiOptions$enumOpt2, | ||
options = _objectWithoutProperties(_getUiOptions$enumOpt, ["widget"]); | ||
var _getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget; | ||
var widget = _getUiOptions$enumOpt2 === undefined ? "select" : _getUiOptions$enumOpt2; | ||
var options = _objectWithoutProperties(_getUiOptions$enumOpt, ["widget"]); | ||
var Widget = (0, _utils.getWidget)(schema, widget, widgets); | ||
@@ -317,10 +312,10 @@ return _react2.default.createElement(Widget, { | ||
value: function renderFiles() { | ||
var _props4 = this.props; | ||
var schema = _props4.schema; | ||
var uiSchema = _props4.uiSchema; | ||
var idSchema = _props4.idSchema; | ||
var name = _props4.name; | ||
var disabled = _props4.disabled; | ||
var readonly = _props4.readonly; | ||
var autofocus = _props4.autofocus; | ||
var _props4 = this.props, | ||
schema = _props4.schema, | ||
uiSchema = _props4.uiSchema, | ||
idSchema = _props4.idSchema, | ||
name = _props4.name, | ||
disabled = _props4.disabled, | ||
readonly = _props4.readonly, | ||
autofocus = _props4.autofocus; | ||
@@ -331,9 +326,7 @@ var title = schema.title || name; | ||
var _getUiOptions2 = (0, _utils.getUiOptions)(uiSchema); | ||
var _getUiOptions2 = (0, _utils.getUiOptions)(uiSchema), | ||
_getUiOptions2$widget = _getUiOptions2.widget, | ||
widget = _getUiOptions2$widget === undefined ? "files" : _getUiOptions2$widget, | ||
options = _objectWithoutProperties(_getUiOptions2, ["widget"]); | ||
var _getUiOptions2$widget = _getUiOptions2.widget; | ||
var widget = _getUiOptions2$widget === undefined ? "files" : _getUiOptions2$widget; | ||
var options = _objectWithoutProperties(_getUiOptions2, ["widget"]); | ||
var Widget = (0, _utils.getWidget)(schema, widget, widgets); | ||
@@ -357,18 +350,18 @@ return _react2.default.createElement(Widget, { | ||
var _props5 = this.props; | ||
var schema = _props5.schema; | ||
var uiSchema = _props5.uiSchema; | ||
var errorSchema = _props5.errorSchema; | ||
var idSchema = _props5.idSchema; | ||
var name = _props5.name; | ||
var required = _props5.required; | ||
var disabled = _props5.disabled; | ||
var readonly = _props5.readonly; | ||
var autofocus = _props5.autofocus; | ||
var _props5 = this.props, | ||
schema = _props5.schema, | ||
uiSchema = _props5.uiSchema, | ||
errorSchema = _props5.errorSchema, | ||
idSchema = _props5.idSchema, | ||
name = _props5.name, | ||
required = _props5.required, | ||
disabled = _props5.disabled, | ||
readonly = _props5.readonly, | ||
autofocus = _props5.autofocus; | ||
var title = schema.title || name; | ||
var items = this.state.items; | ||
var _props$registry3 = this.props.registry; | ||
var definitions = _props$registry3.definitions; | ||
var fields = _props$registry3.fields; | ||
var _props$registry3 = this.props.registry, | ||
definitions = _props$registry3.definitions, | ||
fields = _props$registry3.fields; | ||
var TitleField = fields.TitleField; | ||
@@ -381,7 +374,6 @@ | ||
var _getUiOptions3 = (0, _utils.getUiOptions)(uiSchema); | ||
var _getUiOptions3 = (0, _utils.getUiOptions)(uiSchema), | ||
_getUiOptions3$addabl = _getUiOptions3.addable, | ||
addable = _getUiOptions3$addabl === undefined ? true : _getUiOptions3$addabl; | ||
var _getUiOptions3$addabl = _getUiOptions3.addable; | ||
var addable = _getUiOptions3$addabl === undefined ? true : _getUiOptions3$addabl; | ||
var canAdd = addable && additionalSchema; | ||
@@ -441,20 +433,20 @@ | ||
value: function renderArrayFieldItem(_ref3) { | ||
var index = _ref3.index; | ||
var _ref3$canRemove = _ref3.canRemove; | ||
var canRemove = _ref3$canRemove === undefined ? true : _ref3$canRemove; | ||
var _ref3$canMoveUp = _ref3.canMoveUp; | ||
var canMoveUp = _ref3$canMoveUp === undefined ? true : _ref3$canMoveUp; | ||
var _ref3$canMoveDown = _ref3.canMoveDown; | ||
var canMoveDown = _ref3$canMoveDown === undefined ? true : _ref3$canMoveDown; | ||
var itemSchema = _ref3.itemSchema; | ||
var itemData = _ref3.itemData; | ||
var itemUiSchema = _ref3.itemUiSchema; | ||
var itemIdSchema = _ref3.itemIdSchema; | ||
var itemErrorSchema = _ref3.itemErrorSchema; | ||
var autofocus = _ref3.autofocus; | ||
var index = _ref3.index, | ||
_ref3$canRemove = _ref3.canRemove, | ||
canRemove = _ref3$canRemove === undefined ? true : _ref3$canRemove, | ||
_ref3$canMoveUp = _ref3.canMoveUp, | ||
canMoveUp = _ref3$canMoveUp === undefined ? true : _ref3$canMoveUp, | ||
_ref3$canMoveDown = _ref3.canMoveDown, | ||
canMoveDown = _ref3$canMoveDown === undefined ? true : _ref3$canMoveDown, | ||
itemSchema = _ref3.itemSchema, | ||
itemData = _ref3.itemData, | ||
itemUiSchema = _ref3.itemUiSchema, | ||
itemIdSchema = _ref3.itemIdSchema, | ||
itemErrorSchema = _ref3.itemErrorSchema, | ||
autofocus = _ref3.autofocus; | ||
var SchemaField = this.props.registry.fields.SchemaField; | ||
var _props6 = this.props; | ||
var disabled = _props6.disabled; | ||
var readonly = _props6.readonly; | ||
var uiSchema = _props6.uiSchema; | ||
var _props6 = this.props, | ||
disabled = _props6.disabled, | ||
readonly = _props6.readonly, | ||
uiSchema = _props6.uiSchema; | ||
@@ -464,7 +456,6 @@ var _orderable$removable$ = _extends({ | ||
removable: true | ||
}, uiSchema["ui:options"]); | ||
}, uiSchema["ui:options"]), | ||
orderable = _orderable$removable$.orderable, | ||
removable = _orderable$removable$.removable; | ||
var orderable = _orderable$removable$.orderable; | ||
var removable = _orderable$removable$.removable; | ||
var has = { | ||
@@ -548,4 +539,4 @@ moveUp: orderable && canMoveUp, | ||
function AddButton(_ref4) { | ||
var onClick = _ref4.onClick; | ||
var disabled = _ref4.disabled; | ||
var onClick = _ref4.onClick, | ||
disabled = _ref4.disabled; | ||
@@ -559,3 +550,3 @@ return _react2.default.createElement( | ||
_react2.default.createElement(IconBtn, { type: "info", icon: "plus", className: "btn-add col-xs-12", | ||
tabIndex: "-1", onClick: onClick, | ||
tabIndex: "0", onClick: onClick, | ||
disabled: disabled }) | ||
@@ -562,0 +553,0 @@ ) |
@@ -20,24 +20,22 @@ "use strict"; | ||
function BooleanField(props) { | ||
var schema = props.schema; | ||
var name = props.name; | ||
var uiSchema = props.uiSchema; | ||
var idSchema = props.idSchema; | ||
var formData = props.formData; | ||
var registry = props.registry; | ||
var required = props.required; | ||
var disabled = props.disabled; | ||
var readonly = props.readonly; | ||
var autofocus = props.autofocus; | ||
var onChange = props.onChange; | ||
var schema = props.schema, | ||
name = props.name, | ||
uiSchema = props.uiSchema, | ||
idSchema = props.idSchema, | ||
formData = props.formData, | ||
registry = props.registry, | ||
required = props.required, | ||
disabled = props.disabled, | ||
readonly = props.readonly, | ||
autofocus = props.autofocus, | ||
onChange = props.onChange; | ||
var title = schema.title; | ||
var widgets = registry.widgets; | ||
var formContext = registry.formContext; | ||
var widgets = registry.widgets, | ||
formContext = registry.formContext; | ||
var _getUiOptions = (0, _utils.getUiOptions)(uiSchema); | ||
var _getUiOptions = (0, _utils.getUiOptions)(uiSchema), | ||
_getUiOptions$widget = _getUiOptions.widget, | ||
widget = _getUiOptions$widget === undefined ? "checkbox" : _getUiOptions$widget, | ||
options = _objectWithoutProperties(_getUiOptions, ["widget"]); | ||
var _getUiOptions$widget = _getUiOptions.widget; | ||
var widget = _getUiOptions$widget === undefined ? "checkbox" : _getUiOptions$widget; | ||
var options = _objectWithoutProperties(_getUiOptions, ["widget"]); | ||
var Widget = (0, _utils.getWidget)(schema, widget, widgets); | ||
@@ -44,0 +42,0 @@ var enumOptions = (0, _utils.optionsList)({ |
@@ -14,4 +14,4 @@ "use strict"; | ||
function DescriptionField(props) { | ||
var id = props.id; | ||
var description = props.description; | ||
var id = props.id, | ||
description = props.description; | ||
@@ -18,0 +18,0 @@ if (!description) { |
@@ -45,3 +45,3 @@ "use strict"; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ObjectField).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (ObjectField.__proto__ || Object.getPrototypeOf(ObjectField)).call(this, props)); | ||
@@ -76,5 +76,5 @@ _this.onPropertyChange = function (name) { | ||
value: function getStateFromProps(props) { | ||
var schema = props.schema; | ||
var formData = props.formData; | ||
var registry = props.registry; | ||
var schema = props.schema, | ||
formData = props.formData, | ||
registry = props.registry; | ||
@@ -99,3 +99,3 @@ return (0, _utils.getDefaultFormState)(schema, formData, registry.definitions) || {}; | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? { validate: false } : arguments[1]; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { validate: false }; | ||
@@ -111,17 +111,17 @@ (0, _utils.setState)(this, state, function () { | ||
var _props = this.props; | ||
var uiSchema = _props.uiSchema; | ||
var errorSchema = _props.errorSchema; | ||
var idSchema = _props.idSchema; | ||
var name = _props.name; | ||
var required = _props.required; | ||
var disabled = _props.disabled; | ||
var readonly = _props.readonly; | ||
var _props$registry = this.props.registry; | ||
var definitions = _props$registry.definitions; | ||
var fields = _props$registry.fields; | ||
var formContext = _props$registry.formContext; | ||
var SchemaField = fields.SchemaField; | ||
var TitleField = fields.TitleField; | ||
var DescriptionField = fields.DescriptionField; | ||
var _props = this.props, | ||
uiSchema = _props.uiSchema, | ||
errorSchema = _props.errorSchema, | ||
idSchema = _props.idSchema, | ||
name = _props.name, | ||
required = _props.required, | ||
disabled = _props.disabled, | ||
readonly = _props.readonly; | ||
var _props$registry = this.props.registry, | ||
definitions = _props$registry.definitions, | ||
fields = _props$registry.fields, | ||
formContext = _props$registry.formContext; | ||
var SchemaField = fields.SchemaField, | ||
TitleField = fields.TitleField, | ||
DescriptionField = fields.DescriptionField; | ||
@@ -128,0 +128,0 @@ var schema = (0, _utils.retrieveSchema)(this.props.schema, definitions); |
@@ -46,5 +46,5 @@ "use strict"; | ||
function Label(props) { | ||
var label = props.label; | ||
var required = props.required; | ||
var id = props.id; | ||
var label = props.label, | ||
required = props.required, | ||
id = props.id; | ||
@@ -84,4 +84,4 @@ if (!label) { | ||
function ErrorList(props) { | ||
var _props$errors = props.errors; | ||
var errors = _props$errors === undefined ? [] : _props$errors; | ||
var _props$errors = props.errors, | ||
errors = _props$errors === undefined ? [] : _props$errors; | ||
@@ -110,12 +110,12 @@ if (errors.length === 0) { | ||
function DefaultTemplate(props) { | ||
var id = props.id; | ||
var classNames = props.classNames; | ||
var label = props.label; | ||
var children = props.children; | ||
var errors = props.errors; | ||
var help = props.help; | ||
var description = props.description; | ||
var hidden = props.hidden; | ||
var required = props.required; | ||
var displayLabel = props.displayLabel; | ||
var id = props.id, | ||
classNames = props.classNames, | ||
label = props.label, | ||
children = props.children, | ||
errors = props.errors, | ||
help = props.help, | ||
description = props.description, | ||
hidden = props.hidden, | ||
required = props.required, | ||
displayLabel = props.displayLabel; | ||
@@ -166,13 +166,13 @@ if (hidden) { | ||
function SchemaField(props) { | ||
var uiSchema = props.uiSchema; | ||
var errorSchema = props.errorSchema; | ||
var idSchema = props.idSchema; | ||
var name = props.name; | ||
var required = props.required; | ||
var registry = props.registry; | ||
var definitions = registry.definitions; | ||
var fields = registry.fields; | ||
var formContext = registry.formContext; | ||
var _registry$FieldTempla = registry.FieldTemplate; | ||
var FieldTemplate = _registry$FieldTempla === undefined ? DefaultTemplate : _registry$FieldTempla; | ||
var uiSchema = props.uiSchema, | ||
errorSchema = props.errorSchema, | ||
idSchema = props.idSchema, | ||
name = props.name, | ||
required = props.required, | ||
registry = props.registry; | ||
var definitions = registry.definitions, | ||
fields = registry.fields, | ||
formContext = registry.formContext, | ||
_registry$FieldTempla = registry.FieldTemplate, | ||
FieldTemplate = _registry$FieldTempla === undefined ? DefaultTemplate : _registry$FieldTempla; | ||
@@ -206,6 +206,5 @@ var schema = (0, _utils.retrieveSchema)(props.schema, definitions); | ||
var __errors = errorSchema.__errors; | ||
var __errors = errorSchema.__errors, | ||
fieldErrorSchema = _objectWithoutProperties(errorSchema, ["__errors"]); | ||
var fieldErrorSchema = _objectWithoutProperties(errorSchema, ["__errors"]); | ||
var field = _react2.default.createElement(FieldComponent, _extends({}, props, { | ||
@@ -212,0 +211,0 @@ schema: schema, |
@@ -20,17 +20,17 @@ "use strict"; | ||
function StringField(props) { | ||
var schema = props.schema; | ||
var name = props.name; | ||
var uiSchema = props.uiSchema; | ||
var idSchema = props.idSchema; | ||
var formData = props.formData; | ||
var required = props.required; | ||
var disabled = props.disabled; | ||
var readonly = props.readonly; | ||
var autofocus = props.autofocus; | ||
var registry = props.registry; | ||
var onChange = props.onChange; | ||
var title = schema.title; | ||
var format = schema.format; | ||
var widgets = registry.widgets; | ||
var formContext = registry.formContext; | ||
var schema = props.schema, | ||
name = props.name, | ||
uiSchema = props.uiSchema, | ||
idSchema = props.idSchema, | ||
formData = props.formData, | ||
required = props.required, | ||
disabled = props.disabled, | ||
readonly = props.readonly, | ||
autofocus = props.autofocus, | ||
registry = props.registry, | ||
onChange = props.onChange; | ||
var title = schema.title, | ||
format = schema.format; | ||
var widgets = registry.widgets, | ||
formContext = registry.formContext; | ||
@@ -40,11 +40,9 @@ var enumOptions = Array.isArray(schema.enum) && (0, _utils.optionsList)(schema); | ||
var _getUiOptions = (0, _utils.getUiOptions)(uiSchema); | ||
var _getUiOptions = (0, _utils.getUiOptions)(uiSchema), | ||
_getUiOptions$widget = _getUiOptions.widget, | ||
widget = _getUiOptions$widget === undefined ? defaultWidget : _getUiOptions$widget, | ||
_getUiOptions$placeho = _getUiOptions.placeholder, | ||
placeholder = _getUiOptions$placeho === undefined ? "" : _getUiOptions$placeho, | ||
options = _objectWithoutProperties(_getUiOptions, ["widget", "placeholder"]); | ||
var _getUiOptions$widget = _getUiOptions.widget; | ||
var widget = _getUiOptions$widget === undefined ? defaultWidget : _getUiOptions$widget; | ||
var _getUiOptions$placeho = _getUiOptions.placeholder; | ||
var placeholder = _getUiOptions$placeho === undefined ? "" : _getUiOptions$placeho; | ||
var options = _objectWithoutProperties(_getUiOptions, ["widget", "placeholder"]); | ||
var Widget = (0, _utils.getWidget)(schema, widget, widgets); | ||
@@ -51,0 +49,0 @@ |
@@ -16,5 +16,5 @@ "use strict"; | ||
function TitleField(props) { | ||
var id = props.id; | ||
var title = props.title; | ||
var required = props.required; | ||
var id = props.id, | ||
title = props.title, | ||
required = props.required; | ||
@@ -21,0 +21,0 @@ var legend = required ? title + REQUIRED_FIELD_SYMBOL : title; |
@@ -7,3 +7,3 @@ "use strict"; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -42,6 +42,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Form).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (Form.__proto__ || Object.getPrototypeOf(Form)).call(this, props)); | ||
_this.onChange = function (formData) { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? { validate: false } : arguments[1]; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { validate: false }; | ||
@@ -51,7 +51,6 @@ var mustValidate = !_this.props.noValidate && (_this.props.liveValidate || options.validate); | ||
if (mustValidate) { | ||
var _this$validate = _this.validate(formData); | ||
var _this$validate = _this.validate(formData), | ||
errors = _this$validate.errors, | ||
errorSchema = _this$validate.errorSchema; | ||
var errors = _this$validate.errors; | ||
var errorSchema = _this$validate.errorSchema; | ||
state = _extends({}, state, { errors: errors, errorSchema: errorSchema }); | ||
@@ -72,7 +71,6 @@ } | ||
var _ret = function () { | ||
var _this$validate2 = _this.validate(_this.state.formData); | ||
var _this$validate2 = _this.validate(_this.state.formData), | ||
errors = _this$validate2.errors, | ||
errorSchema = _this$validate2.errorSchema; | ||
var errors = _this$validate2.errors; | ||
var errorSchema = _this$validate2.errorSchema; | ||
if (Object.keys(errors).length > 0) { | ||
@@ -126,7 +124,6 @@ (0, _utils.setState)(_this, { errors: errors, errorSchema: errorSchema }, function () { | ||
errorSchema: state.errorSchema || {} | ||
}; | ||
}, | ||
errors = _ref.errors, | ||
errorSchema = _ref.errorSchema; | ||
var errors = _ref.errors; | ||
var errorSchema = _ref.errorSchema; | ||
var idSchema = (0, _utils.toIdSchema)(schema, uiSchema["ui:rootFieldId"], definitions); | ||
@@ -159,5 +156,5 @@ return { | ||
value: function renderErrors() { | ||
var _state = this.state; | ||
var status = _state.status; | ||
var errors = _state.errors; | ||
var _state = this.state, | ||
status = _state.status, | ||
errors = _state.errors; | ||
var showErrorList = this.props.showErrorList; | ||
@@ -176,8 +173,6 @@ | ||
// the "fields" registry one. | ||
var _getDefaultRegistry = (0, _utils.getDefaultRegistry)(), | ||
fields = _getDefaultRegistry.fields, | ||
widgets = _getDefaultRegistry.widgets; | ||
var _getDefaultRegistry = (0, _utils.getDefaultRegistry)(); | ||
var fields = _getDefaultRegistry.fields; | ||
var widgets = _getDefaultRegistry.widgets; | ||
return { | ||
@@ -194,20 +189,20 @@ fields: _extends({}, fields, this.props.fields), | ||
value: function render() { | ||
var _props = this.props; | ||
var children = _props.children; | ||
var safeRenderCompletion = _props.safeRenderCompletion; | ||
var id = _props.id; | ||
var className = _props.className; | ||
var name = _props.name; | ||
var method = _props.method; | ||
var target = _props.target; | ||
var action = _props.action; | ||
var autocomplete = _props.autocomplete; | ||
var enctype = _props.enctype; | ||
var acceptcharset = _props.acceptcharset; | ||
var _state2 = this.state; | ||
var schema = _state2.schema; | ||
var uiSchema = _state2.uiSchema; | ||
var formData = _state2.formData; | ||
var errorSchema = _state2.errorSchema; | ||
var idSchema = _state2.idSchema; | ||
var _props = this.props, | ||
children = _props.children, | ||
safeRenderCompletion = _props.safeRenderCompletion, | ||
id = _props.id, | ||
className = _props.className, | ||
name = _props.name, | ||
method = _props.method, | ||
target = _props.target, | ||
action = _props.action, | ||
autocomplete = _props.autocomplete, | ||
enctype = _props.enctype, | ||
acceptcharset = _props.acceptcharset; | ||
var _state2 = this.state, | ||
schema = _state2.schema, | ||
uiSchema = _state2.uiSchema, | ||
formData = _state2.formData, | ||
errorSchema = _state2.errorSchema, | ||
idSchema = _state2.idSchema; | ||
@@ -214,0 +209,0 @@ var registry = this.getRegistry(); |
@@ -42,11 +42,11 @@ "use strict"; | ||
function DateElement(props) { | ||
var type = props.type; | ||
var range = props.range; | ||
var value = props.value; | ||
var select = props.select; | ||
var rootId = props.rootId; | ||
var disabled = props.disabled; | ||
var readonly = props.readonly; | ||
var autofocus = props.autofocus; | ||
var registry = props.registry; | ||
var type = props.type, | ||
range = props.range, | ||
value = props.value, | ||
select = props.select, | ||
rootId = props.rootId, | ||
disabled = props.disabled, | ||
readonly = props.readonly, | ||
autofocus = props.autofocus, | ||
registry = props.registry; | ||
@@ -76,3 +76,3 @@ var id = rootId + "_" + type; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AltDateWidget).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (AltDateWidget.__proto__ || Object.getPrototypeOf(AltDateWidget)).call(this, props)); | ||
@@ -90,7 +90,7 @@ _this.onChange = function (property, value) { | ||
event.preventDefault(); | ||
var _this$props = _this.props; | ||
var time = _this$props.time; | ||
var disabled = _this$props.disabled; | ||
var readonly = _this$props.readonly; | ||
var onChange = _this$props.onChange; | ||
var _this$props = _this.props, | ||
time = _this$props.time, | ||
disabled = _this$props.disabled, | ||
readonly = _this$props.readonly, | ||
onChange = _this$props.onChange; | ||
@@ -108,7 +108,7 @@ if (disabled || readonly) { | ||
event.preventDefault(); | ||
var _this$props2 = _this.props; | ||
var time = _this$props2.time; | ||
var disabled = _this$props2.disabled; | ||
var readonly = _this$props2.readonly; | ||
var onChange = _this$props2.onChange; | ||
var _this$props2 = _this.props, | ||
time = _this$props2.time, | ||
disabled = _this$props2.disabled, | ||
readonly = _this$props2.readonly, | ||
onChange = _this$props2.onChange; | ||
@@ -142,8 +142,8 @@ if (disabled || readonly) { | ||
var _props = this.props; | ||
var id = _props.id; | ||
var disabled = _props.disabled; | ||
var readonly = _props.readonly; | ||
var autofocus = _props.autofocus; | ||
var registry = _props.registry; | ||
var _props = this.props, | ||
id = _props.id, | ||
disabled = _props.disabled, | ||
readonly = _props.readonly, | ||
autofocus = _props.autofocus, | ||
registry = _props.registry; | ||
@@ -193,9 +193,9 @@ return _react2.default.createElement( | ||
var time = this.props.time; | ||
var _state = this.state; | ||
var year = _state.year; | ||
var month = _state.month; | ||
var day = _state.day; | ||
var hour = _state.hour; | ||
var minute = _state.minute; | ||
var second = _state.second; | ||
var _state = this.state, | ||
year = _state.year, | ||
month = _state.month, | ||
day = _state.day, | ||
hour = _state.hour, | ||
minute = _state.minute, | ||
second = _state.second; | ||
@@ -202,0 +202,0 @@ var data = [{ type: "year", range: [1900, 2020], value: year }, { type: "month", range: [1, 12], value: month }, { type: "day", range: [1, 31], value: day }]; |
@@ -20,16 +20,12 @@ "use strict"; | ||
// exclude the "options" and "schema" ones here. | ||
var value = props.value; | ||
var readonly = props.readonly; | ||
var autofocus = props.autofocus; | ||
var _onChange = props.onChange; | ||
var options = props.options; | ||
var // eslint-disable-line | ||
schema = props.schema; | ||
var // eslint-disable-line | ||
formContext = props.formContext; | ||
var // eslint-disable-line | ||
registry = props.registry; | ||
var value = props.value, | ||
readonly = props.readonly, | ||
autofocus = props.autofocus, | ||
_onChange = props.onChange, | ||
options = props.options, | ||
schema = props.schema, | ||
formContext = props.formContext, | ||
registry = props.registry, | ||
inputProps = _objectWithoutProperties(props, ["value", "readonly", "autofocus", "onChange", "options", "schema", "formContext", "registry"]); | ||
var inputProps = _objectWithoutProperties(props, ["value", "readonly", "autofocus", "onChange", "options", "schema", "formContext", "registry"]); | ||
return _react2.default.createElement("input", _extends({}, inputProps, { | ||
@@ -36,0 +32,0 @@ className: "form-control", |
@@ -30,10 +30,10 @@ "use strict"; | ||
function CheckboxesWidget(props) { | ||
var id = props.id; | ||
var disabled = props.disabled; | ||
var options = props.options; | ||
var value = props.value; | ||
var autofocus = props.autofocus; | ||
var _onChange = props.onChange; | ||
var enumOptions = options.enumOptions; | ||
var inline = options.inline; | ||
var id = props.id, | ||
disabled = props.disabled, | ||
options = props.options, | ||
value = props.value, | ||
autofocus = props.autofocus, | ||
_onChange = props.onChange; | ||
var enumOptions = options.enumOptions, | ||
inline = options.inline; | ||
@@ -45,29 +45,35 @@ return _react2.default.createElement( | ||
var checked = value.indexOf(option.value) !== -1; | ||
return _react2.default.createElement( | ||
var disabledCls = disabled ? "disabled" : ""; | ||
var checkbox = _react2.default.createElement( | ||
"span", | ||
null, | ||
_react2.default.createElement("input", { type: "checkbox", | ||
id: id + "_" + index, | ||
checked: checked, | ||
disabled: disabled, | ||
autoFocus: autofocus && index === 0, | ||
onChange: function onChange(event) { | ||
var all = enumOptions.map(function (_ref) { | ||
var value = _ref.value; | ||
return value; | ||
}); | ||
if (event.target.checked) { | ||
_onChange(selectValue(option.value, value, all)); | ||
} else { | ||
_onChange(deselectValue(option.value, value)); | ||
} | ||
} }), | ||
option.label | ||
); | ||
return inline ? _react2.default.createElement( | ||
"label", | ||
{ key: index, className: "checkbox-inline " + disabledCls }, | ||
checkbox | ||
) : _react2.default.createElement( | ||
"div", | ||
{ key: index, className: "checkbox" + (inline ? "-inline" : "") }, | ||
{ key: index, className: "checkbox " + disabledCls }, | ||
_react2.default.createElement( | ||
"label", | ||
null, | ||
_react2.default.createElement("input", { type: "checkbox", | ||
id: id + "_" + index, | ||
checked: checked, | ||
disabled: disabled, | ||
autoFocus: autofocus && index === 0, | ||
onChange: function onChange(event) { | ||
var all = enumOptions.map(function (_ref) { | ||
var value = _ref.value; | ||
return value; | ||
}); | ||
if (event.target.checked) { | ||
_onChange(selectValue(option.value, value, all)); | ||
} else { | ||
_onChange(deselectValue(option.value, value)); | ||
} | ||
} }), | ||
_react2.default.createElement( | ||
"strong", | ||
null, | ||
option.label | ||
) | ||
checkbox | ||
) | ||
@@ -96,2 +102,3 @@ ); | ||
required: _react.PropTypes.bool, | ||
disabled: _react.PropTypes.bool, | ||
multiple: _react.PropTypes.bool, | ||
@@ -98,0 +105,0 @@ autofocus: _react.PropTypes.bool, |
@@ -14,10 +14,10 @@ "use strict"; | ||
function CheckboxWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var disabled = _ref.disabled; | ||
var label = _ref.label; | ||
var autofocus = _ref.autofocus; | ||
var _onChange = _ref.onChange; | ||
var schema = _ref.schema, | ||
id = _ref.id, | ||
value = _ref.value, | ||
required = _ref.required, | ||
disabled = _ref.disabled, | ||
label = _ref.label, | ||
autofocus = _ref.autofocus, | ||
_onChange = _ref.onChange; | ||
@@ -24,0 +24,0 @@ return _react2.default.createElement( |
@@ -30,4 +30,4 @@ "use strict"; | ||
function DateTimeWidget(props) { | ||
var value = props.value; | ||
var _onChange = props.onChange; | ||
var value = props.value, | ||
_onChange = props.onChange; | ||
@@ -34,0 +34,0 @@ return _react2.default.createElement(_BaseInput2.default, _extends({ |
@@ -28,5 +28,5 @@ "use strict"; | ||
function processFile(file) { | ||
var name = file.name; | ||
var size = file.size; | ||
var type = file.type; | ||
var name = file.name, | ||
size = file.size, | ||
type = file.type; | ||
@@ -61,5 +61,5 @@ return new Promise(function (resolve, reject) { | ||
filesInfo.map(function (fileInfo, key) { | ||
var name = fileInfo.name; | ||
var size = fileInfo.size; | ||
var type = fileInfo.type; | ||
var name = fileInfo.name, | ||
size = fileInfo.size, | ||
type = fileInfo.type; | ||
@@ -88,7 +88,6 @@ return _react2.default.createElement( | ||
}).map(function (dataURL) { | ||
var _dataURItoBlob = (0, _utils.dataURItoBlob)(dataURL); | ||
var _dataURItoBlob = (0, _utils.dataURItoBlob)(dataURL), | ||
blob = _dataURItoBlob.blob, | ||
name = _dataURItoBlob.name; | ||
var blob = _dataURItoBlob.blob; | ||
var name = _dataURItoBlob.name; | ||
return { | ||
@@ -108,3 +107,3 @@ name: name, | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(FileWidget).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (FileWidget.__proto__ || Object.getPrototypeOf(FileWidget)).call(this, props)); | ||
@@ -116,5 +115,5 @@ _this.defaultProps = { | ||
_this.onChange = function (event) { | ||
var _this$props = _this.props; | ||
var multiple = _this$props.multiple; | ||
var onChange = _this$props.onChange; | ||
var _this$props = _this.props, | ||
multiple = _this$props.multiple, | ||
onChange = _this$props.onChange; | ||
@@ -155,8 +154,8 @@ processFiles(event.target.files).then(function (filesInfo) { | ||
var _props = this.props; | ||
var multiple = _props.multiple; | ||
var id = _props.id; | ||
var readonly = _props.readonly; | ||
var disabled = _props.disabled; | ||
var autofocus = _props.autofocus; | ||
var _props = this.props, | ||
multiple = _props.multiple, | ||
id = _props.id, | ||
readonly = _props.readonly, | ||
disabled = _props.disabled, | ||
autofocus = _props.autofocus; | ||
var filesInfo = this.state.filesInfo; | ||
@@ -163,0 +162,0 @@ |
@@ -14,4 +14,4 @@ "use strict"; | ||
function HiddenWidget(_ref) { | ||
var id = _ref.id; | ||
var value = _ref.value; | ||
var id = _ref.id, | ||
value = _ref.value; | ||
@@ -18,0 +18,0 @@ return _react2.default.createElement("input", { type: "hidden", id: id, value: typeof value === "undefined" ? "" : value }); |
@@ -14,14 +14,16 @@ "use strict"; | ||
function RadioWidget(_ref) { | ||
var schema = _ref.schema; | ||
var options = _ref.options; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var disabled = _ref.disabled; | ||
var autofocus = _ref.autofocus; | ||
var _onChange = _ref.onChange; | ||
var schema = _ref.schema, | ||
options = _ref.options, | ||
value = _ref.value, | ||
required = _ref.required, | ||
disabled = _ref.disabled, | ||
autofocus = _ref.autofocus, | ||
_onChange = _ref.onChange; | ||
// Generating a unique field name to identify this set of radio buttons | ||
var name = Math.random().toString(); | ||
var enumOptions = options.enumOptions; | ||
var inline = options.inline; | ||
var enumOptions = options.enumOptions, | ||
inline = options.inline; | ||
// checked={checked} has been moved above name={name}, As mentioned in #349; | ||
// this is a temporary fix for radio button rendering bug in React, facebook/react#7630. | ||
@@ -33,18 +35,29 @@ return _react2.default.createElement( | ||
var checked = option.value === value; | ||
return _react2.default.createElement( | ||
var disabledCls = disabled ? "disabled" : ""; | ||
var radio = _react2.default.createElement( | ||
"span", | ||
null, | ||
_react2.default.createElement("input", { type: "radio", | ||
checked: checked, | ||
name: name, | ||
value: option.value, | ||
disabled: disabled, | ||
autoFocus: autofocus && i === 0, | ||
onChange: function onChange(_) { | ||
return _onChange(option.value); | ||
} }), | ||
option.label | ||
); | ||
return inline ? _react2.default.createElement( | ||
"label", | ||
{ key: i, className: "radio-inline " + disabledCls }, | ||
radio | ||
) : _react2.default.createElement( | ||
"div", | ||
{ key: i, className: "radio" + (inline ? "-inline" : "") + " " + (disabled ? "disabled" : "") }, | ||
{ key: i, className: "radio " + disabledCls }, | ||
_react2.default.createElement( | ||
"label", | ||
null, | ||
_react2.default.createElement("input", { type: "radio", | ||
name: name, | ||
value: option.value, | ||
checked: checked, | ||
disabled: disabled, | ||
autoFocus: autofocus && i === 0, | ||
onChange: function onChange(_) { | ||
return _onChange(option.value); | ||
} }), | ||
option.label | ||
radio | ||
) | ||
@@ -51,0 +64,0 @@ ); |
@@ -22,4 +22,4 @@ "use strict"; | ||
function RangeWidget(props) { | ||
var schema = props.schema; | ||
var value = props.value; | ||
var schema = props.schema, | ||
value = props.value; | ||
@@ -26,0 +26,0 @@ return _react2.default.createElement( |
@@ -20,4 +20,4 @@ "use strict"; | ||
function processValue(_ref, value) { | ||
var type = _ref.type; | ||
var items = _ref.items; | ||
var type = _ref.type, | ||
items = _ref.items; | ||
@@ -35,12 +35,12 @@ if (type === "array" && items && ["number", "integer"].includes(items.type)) { | ||
function SelectWidget(_ref2) { | ||
var schema = _ref2.schema; | ||
var id = _ref2.id; | ||
var options = _ref2.options; | ||
var value = _ref2.value; | ||
var required = _ref2.required; | ||
var disabled = _ref2.disabled; | ||
var readonly = _ref2.readonly; | ||
var multiple = _ref2.multiple; | ||
var autofocus = _ref2.autofocus; | ||
var _onChange = _ref2.onChange; | ||
var schema = _ref2.schema, | ||
id = _ref2.id, | ||
options = _ref2.options, | ||
value = _ref2.value, | ||
required = _ref2.required, | ||
disabled = _ref2.disabled, | ||
readonly = _ref2.readonly, | ||
multiple = _ref2.multiple, | ||
autofocus = _ref2.autofocus, | ||
_onChange = _ref2.onChange; | ||
var enumOptions = options.enumOptions; | ||
@@ -73,4 +73,4 @@ | ||
enumOptions.map(function (_ref3, i) { | ||
var value = _ref3.value; | ||
var label = _ref3.label; | ||
var value = _ref3.value, | ||
label = _ref3.label; | ||
@@ -77,0 +77,0 @@ return _react2.default.createElement( |
@@ -14,11 +14,11 @@ "use strict"; | ||
function TextareaWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var disabled = _ref.disabled; | ||
var readonly = _ref.readonly; | ||
var autofocus = _ref.autofocus; | ||
var _onChange = _ref.onChange; | ||
var schema = _ref.schema, | ||
id = _ref.id, | ||
placeholder = _ref.placeholder, | ||
value = _ref.value, | ||
required = _ref.required, | ||
disabled = _ref.disabled, | ||
readonly = _ref.readonly, | ||
autofocus = _ref.autofocus, | ||
_onChange = _ref.onChange; | ||
@@ -25,0 +25,0 @@ return _react2.default.createElement("textarea", { |
@@ -7,3 +7,3 @@ "use strict"; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -102,20 +102,11 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var defaultRegistry = { | ||
fields: require("./components/fields").default, | ||
widgets: require("./components/widgets").default, | ||
definitions: {}, | ||
formContext: {} | ||
}; | ||
function getDefaultRegistry() { | ||
var load = function load(prefix, arr) { | ||
return arr.reduce(function (obj, comp) { | ||
obj[comp] = require("./components/" + prefix + "/" + comp).default; | ||
return obj; | ||
}, {}); | ||
}; | ||
var fields = load("fields", ["SchemaField", "ArrayField", "BooleanField", "ObjectField", "StringField", "NumberField", "TitleField", "DescriptionField"]); | ||
var widgets = load("widgets", ["PasswordWidget", "RadioWidget", "UpDownWidget", "RangeWidget", "SelectWidget", "TextWidget", "DateWidget", "DateTimeWidget", "AltDateWidget", "AltDateTimeWidget", "EmailWidget", "URLWidget", "TextareaWidget", "HiddenWidget", "ColorWidget", "FileWidget", "CheckboxWidget", "CheckboxesWidget"]); | ||
return { | ||
fields: fields, | ||
widgets: widgets, | ||
definitions: {}, | ||
formContext: {} | ||
}; | ||
return defaultRegistry; | ||
} | ||
@@ -128,3 +119,3 @@ | ||
function getWidget(schema, widget) { | ||
var registeredWidgets = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var registeredWidgets = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var type = schema.type; | ||
@@ -139,7 +130,6 @@ | ||
Widget.MergedWidget = function (_ref) { | ||
var _ref$options = _ref.options; | ||
var options = _ref$options === undefined ? {} : _ref$options; | ||
var _ref$options = _ref.options, | ||
options = _ref$options === undefined ? {} : _ref$options, | ||
props = _objectWithoutProperties(_ref, ["options"]); | ||
var props = _objectWithoutProperties(_ref, ["options"]); | ||
return _react2.default.createElement(Widget, _extends({ options: _extends({}, defaultOptions, options) }, props)); | ||
@@ -178,3 +168,3 @@ }; | ||
function computeDefaults(schema, parentDefaults) { | ||
var definitions = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var definitions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -219,3 +209,3 @@ // Compute the defaults recursively: give highest priority to deepest nodes. | ||
function getDefaultFormState(_schema, formData) { | ||
var definitions = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var definitions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -261,3 +251,3 @@ if (!isObject(_schema)) { | ||
function mergeObjects(obj1, obj2) { | ||
var concatArrays = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; | ||
var concatArrays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
@@ -376,3 +366,3 @@ // Recursively merge deeply nested objects. | ||
function findSchemaDefinition($ref) { | ||
var definitions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var definitions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -389,3 +379,3 @@ // Extract and use the referenced definition if we have it. | ||
function retrieveSchema(schema) { | ||
var definitions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var definitions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -399,5 +389,5 @@ // No $ref attribute found, returning the original schema. | ||
// Drop the $ref property of the source schema. | ||
var $ref = schema.$ref; | ||
var localSchema = _objectWithoutProperties(schema, ["$ref"]); // eslint-disable-line no-unused-vars | ||
var $ref = schema.$ref, | ||
localSchema = _objectWithoutProperties(schema, ["$ref"]); // eslint-disable-line no-unused-vars | ||
// Update referenced schema definition with local schema properties. | ||
@@ -414,4 +404,4 @@ | ||
function deepEquals(a, b) { | ||
var ca = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2]; | ||
var cb = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; | ||
var ca = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
var cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
@@ -489,4 +479,4 @@ // Partially extracted from node-deeper and adapted to exclude comparison | ||
function shouldRender(comp, nextProps, nextState) { | ||
var props = comp.props; | ||
var state = comp.state; | ||
var props = comp.props, | ||
state = comp.state; | ||
@@ -519,3 +509,3 @@ return !deepEquals(props, nextProps) || !deepEquals(state, nextState); | ||
function parseDateString(dateString) { | ||
var includeTime = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; | ||
var includeTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
@@ -547,12 +537,12 @@ if (!dateString) { | ||
function toDateString(_ref2) { | ||
var year = _ref2.year; | ||
var month = _ref2.month; | ||
var day = _ref2.day; | ||
var _ref2$hour = _ref2.hour; | ||
var hour = _ref2$hour === undefined ? 0 : _ref2$hour; | ||
var _ref2$minute = _ref2.minute; | ||
var minute = _ref2$minute === undefined ? 0 : _ref2$minute; | ||
var _ref2$second = _ref2.second; | ||
var second = _ref2$second === undefined ? 0 : _ref2$second; | ||
var time = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; | ||
var year = _ref2.year, | ||
month = _ref2.month, | ||
day = _ref2.day, | ||
_ref2$hour = _ref2.hour, | ||
hour = _ref2$hour === undefined ? 0 : _ref2$hour, | ||
_ref2$minute = _ref2.minute, | ||
minute = _ref2$minute === undefined ? 0 : _ref2$minute, | ||
_ref2$second = _ref2.second, | ||
second = _ref2$second === undefined ? 0 : _ref2$second; | ||
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
@@ -559,0 +549,0 @@ var utcTime = Date.UTC(year, month - 1, day, hour, minute, second); |
@@ -12,2 +12,6 @@ "use strict"; | ||
var _lodash = require("lodash.topath"); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _jsonschema = require("jsonschema"); | ||
@@ -17,24 +21,6 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var RE_ERROR_ARRAY_PATH = /\[\d+]/g; | ||
function errorPropertyToPath(property) { | ||
// Parse array indices, eg. "instance.level1.level2[2].level3" | ||
// => ["instance", "level1", "level2", 2, "level3"] | ||
return property.split(".").reduce(function (path, node) { | ||
var match = node.match(RE_ERROR_ARRAY_PATH); | ||
if (match) { | ||
var nodeName = node.slice(0, node.indexOf("[")); | ||
var indices = match.map(function (str) { | ||
return parseInt(str.slice(1, -1), 10); | ||
}); | ||
path = path.concat(nodeName, indices); | ||
} else { | ||
path.push(node); | ||
} | ||
return path; | ||
}, []); | ||
} | ||
function toErrorSchema(errors) { | ||
@@ -60,6 +46,6 @@ // Transforms a jsonschema validation errors list: | ||
return errors.reduce(function (errorSchema, error) { | ||
var property = error.property; | ||
var message = error.message; | ||
var property = error.property, | ||
message = error.message; | ||
var path = errorPropertyToPath(property); | ||
var path = (0, _lodash2.default)(property); | ||
var parent = errorSchema; | ||
@@ -107,3 +93,3 @@ var _iteratorNormalCompletion = true; | ||
function toErrorList(errorSchema) { | ||
var fieldName = arguments.length <= 1 || arguments[1] === undefined ? "root" : arguments[1]; | ||
var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "root"; | ||
@@ -162,6 +148,5 @@ // XXX: We should transform fieldName as a full field path string. | ||
function validateFormData(formData, schema, customValidate) { | ||
var _jsonValidate = (0, _jsonschema.validate)(formData, schema); | ||
var _jsonValidate = (0, _jsonschema.validate)(formData, schema), | ||
errors = _jsonValidate.errors; | ||
var errors = _jsonValidate.errors; | ||
var errorSchema = toErrorSchema(errors); | ||
@@ -168,0 +153,0 @@ |
{ | ||
"name": "react-jsonschema-form", | ||
"version": "0.41.1", | ||
"version": "0.41.2", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -33,25 +33,26 @@ "scripts": { | ||
"jsonschema": "^1.0.2", | ||
"setimmediate": "^1.0.4" | ||
"lodash.topath": "^4.5.2", | ||
"setimmediate": "^1.0.5" | ||
}, | ||
"devDependencies": { | ||
"atob": "^2.0.3", | ||
"babel-cli": "^6.6.5", | ||
"babel-core": "^6.7.4", | ||
"babel-eslint": "^6.0.2", | ||
"babel-loader": "^6.2.4", | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.18.2", | ||
"babel-eslint": "^6.1.2", | ||
"babel-loader": "^6.2.7", | ||
"babel-plugin-react-transform": "^2.0.2", | ||
"babel-plugin-transform-class-properties": "^6.6.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.6.5", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-react": "^6.5.0", | ||
"babel-register": "^6.14.0", | ||
"babel-plugin-transform-class-properties": "^6.18.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.16.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-react": "^6.16.0", | ||
"babel-register": "^6.18.0", | ||
"codemirror": "^5.20.2", | ||
"eslint": "^2.13.1", | ||
"chai": "^3.3.0", | ||
"codemirror": "^5.13.2", | ||
"cross-env": "^2.0.1", | ||
"css-loader": "^0.23.1", | ||
"eslint": "^2.9.0", | ||
"eslint-plugin-react": "^4.2.3", | ||
"estraverse": "^4.2.0", | ||
"estraverse-fb": "^1.3.1", | ||
"express": "^4.13.3", | ||
"express": "^4.14.0", | ||
"extract-text-webpack-plugin": "^1.0.1", | ||
@@ -63,15 +64,15 @@ "gh-pages": "^0.11.0", | ||
"react": "^15.0.0", | ||
"react-addons-test-utils": "^15.0.1", | ||
"react-addons-test-utils": "^15.3.2", | ||
"react-codemirror": "^0.2.3", | ||
"react-dom": "^15.0.0", | ||
"react-dom": "^15.3.2", | ||
"react-transform-catch-errors": "^1.0.0", | ||
"react-transform-hmr": "^1.0.1", | ||
"redbox-react": "^1.2.3", | ||
"rimraf": "^2.4.4", | ||
"sinon": "^1.17.2", | ||
"redbox-react": "^1.3.3", | ||
"rimraf": "^2.5.4", | ||
"sinon": "^1.17.6", | ||
"style-loader": "^0.13.1", | ||
"toctoc": "^0.2.3", | ||
"webpack": "^1.10.5", | ||
"webpack-dev-middleware": "^1.6.1", | ||
"webpack-hot-middleware": "^2.6.0" | ||
"webpack": "^1.13.3", | ||
"webpack-dev-middleware": "^1.8.4", | ||
"webpack-hot-middleware": "^2.13.2" | ||
}, | ||
@@ -78,0 +79,0 @@ "directories": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
880312
38
3608
29
4
2
+ Addedlodash.topath@^4.5.2
+ Addedlodash.topath@4.5.2(transitive)
Updatedsetimmediate@^1.0.5