react-jsonschema-form
Advanced tools
Comparing version 0.28.1 to 0.29.0
@@ -140,2 +140,4 @@ "use strict"; | ||
var required = _props.required; | ||
var disabled = _props.disabled; | ||
var readonly = _props.readonly; | ||
@@ -178,3 +180,4 @@ var title = schema.title || name; | ||
), | ||
_react2.default.createElement(AddButton, { onClick: this.onAddClick }) | ||
_react2.default.createElement(AddButton, { | ||
onClick: this.onAddClick, disabled: disabled || readonly }) | ||
); | ||
@@ -189,2 +192,4 @@ } | ||
var name = _props2.name; | ||
var disabled = _props2.disabled; | ||
var readonly = _props2.readonly; | ||
@@ -203,3 +208,5 @@ var title = schema.title || name; | ||
title: title, | ||
value: items | ||
value: items, | ||
disabled: disabled, | ||
readonly: readonly | ||
}); | ||
@@ -219,2 +226,4 @@ } | ||
var required = _props3.required; | ||
var disabled = _props3.disabled; | ||
var readonly = _props3.readonly; | ||
@@ -270,3 +279,5 @@ var title = schema.title || name; | ||
), | ||
additionalSchema ? _react2.default.createElement(AddButton, { onClick: this.onAddClick }) : null | ||
additionalSchema ? _react2.default.createElement(AddButton, { | ||
onClick: this.onAddClick, | ||
disabled: disabled || readonly }) : null | ||
); | ||
@@ -286,2 +297,5 @@ } | ||
var SchemaField = this.props.registry.fields.SchemaField; | ||
var _props4 = this.props; | ||
var disabled = _props4.disabled; | ||
var readonly = _props4.readonly; | ||
@@ -302,3 +316,5 @@ return _react2.default.createElement( | ||
onChange: this.onChangeForIndex(index), | ||
registry: this.props.registry }) | ||
registry: this.props.registry, | ||
disabled: this.props.disabled, | ||
readonly: this.props.readonly }) | ||
), | ||
@@ -312,2 +328,3 @@ removable ? _react2.default.createElement( | ||
tabIndex: "-1", | ||
disabled: disabled || readonly, | ||
onClick: this.onDropIndexClick(index) }, | ||
@@ -334,3 +351,6 @@ "Delete" | ||
idSchema: {}, | ||
registry: (0, _utils.getDefaultRegistry)() | ||
registry: (0, _utils.getDefaultRegistry)(), | ||
required: false, | ||
disabled: false, | ||
readonly: false | ||
}; | ||
@@ -341,2 +361,3 @@ | ||
var onClick = _ref2.onClick; | ||
var disabled = _ref2.disabled; | ||
@@ -352,3 +373,4 @@ return _react2.default.createElement( | ||
{ type: "button", className: "btn btn-info col-xs-12", | ||
tabIndex: "-1", onClick: onClick }, | ||
tabIndex: "-1", onClick: onClick, | ||
disabled: disabled }, | ||
"Add" | ||
@@ -368,2 +390,5 @@ ) | ||
formData: _react.PropTypes.array, | ||
required: _react.PropTypes.bool, | ||
disabled: _react.PropTypes.bool, | ||
readonly: _react.PropTypes.bool, | ||
registry: _react.PropTypes.shape({ | ||
@@ -370,0 +395,0 @@ widgets: _react.PropTypes.objectOf(_react.PropTypes.func).isRequired, |
@@ -36,2 +36,4 @@ "use strict"; | ||
var required = props.required; | ||
var disabled = props.disabled; | ||
var readonly = props.readonly; | ||
var onChange = props.onChange; | ||
@@ -50,3 +52,5 @@ var title = schema.title; | ||
value: (0, _utils.defaultFieldValue)(formData, schema), | ||
required: required | ||
required: required, | ||
disabled: disabled, | ||
readonly: readonly | ||
}; | ||
@@ -68,2 +72,4 @@ if (widget) { | ||
required: _react.PropTypes.bool, | ||
disabled: _react.PropTypes.bool, | ||
readonly: _react.PropTypes.bool, | ||
registry: _react.PropTypes.shape({ | ||
@@ -79,5 +85,7 @@ widgets: _react.PropTypes.objectOf(_react.PropTypes.func).isRequired, | ||
uiSchema: {}, | ||
registry: (0, _utils.getDefaultRegistry)() | ||
registry: (0, _utils.getDefaultRegistry)(), | ||
disabled: false, | ||
readonly: false | ||
}; | ||
exports.default = BooleanField; |
@@ -88,2 +88,4 @@ "use strict"; | ||
var required = _props.required; | ||
var disabled = _props.disabled; | ||
var readonly = _props.readonly; | ||
var _props$registry = this.props.registry; | ||
@@ -144,3 +146,5 @@ var definitions = _props$registry.definitions; | ||
onChange: _this3.onPropertyChange(name), | ||
registry: _this3.props.registry }); | ||
registry: _this3.props.registry, | ||
disabled: disabled, | ||
readonly: readonly }); | ||
}) | ||
@@ -158,3 +162,6 @@ ); | ||
idSchema: {}, | ||
registry: (0, _utils.getDefaultRegistry)() | ||
registry: (0, _utils.getDefaultRegistry)(), | ||
required: false, | ||
disabled: false, | ||
readonly: false | ||
}; | ||
@@ -172,2 +179,4 @@ | ||
required: _react.PropTypes.bool, | ||
disabled: _react.PropTypes.bool, | ||
readonly: _react.PropTypes.bool, | ||
registry: _react.PropTypes.shape({ | ||
@@ -174,0 +183,0 @@ widgets: _react.PropTypes.objectOf(_react.PropTypes.func).isRequired, |
@@ -161,2 +161,4 @@ "use strict"; | ||
var FieldComponent = getFieldComponent(schema, uiSchema, fields); | ||
var disabled = Boolean(props.disabled || uiSchema["ui:disabled"]); | ||
var readonly = Boolean(props.readonly || uiSchema["ui:readonly"]); | ||
@@ -190,3 +192,6 @@ if (Object.keys(schema).length === 0) { | ||
classNames: uiSchema.classNames }, | ||
_react2.default.createElement(FieldComponent, _extends({}, props, { schema: schema })) | ||
_react2.default.createElement(FieldComponent, _extends({}, props, { | ||
schema: schema, | ||
disabled: disabled, | ||
readonly: readonly })) | ||
); | ||
@@ -199,3 +204,5 @@ } | ||
idSchema: {}, | ||
registry: (0, _utils.getDefaultRegistry)() | ||
registry: (0, _utils.getDefaultRegistry)(), | ||
disabled: false, | ||
readonly: false | ||
}; | ||
@@ -202,0 +209,0 @@ |
@@ -33,2 +33,4 @@ "use strict"; | ||
var required = props.required; | ||
var disabled = props.disabled; | ||
var readonly = props.readonly; | ||
var onChange = props.onChange; | ||
@@ -47,3 +49,5 @@ var title = schema.title; | ||
value: (0, _utils.defaultFieldValue)(formData, schema), | ||
required: required | ||
required: required, | ||
disabled: disabled, | ||
readonly: readonly | ||
}; | ||
@@ -75,3 +79,5 @@ if (Array.isArray(schema.enum)) { | ||
}), | ||
required: _react.PropTypes.bool | ||
required: _react.PropTypes.bool, | ||
disabled: _react.PropTypes.bool, | ||
readonly: _react.PropTypes.bool | ||
}; | ||
@@ -82,5 +88,7 @@ } | ||
uiSchema: {}, | ||
registry: (0, _utils.getDefaultRegistry)() | ||
registry: (0, _utils.getDefaultRegistry)(), | ||
disabled: false, | ||
readonly: false | ||
}; | ||
exports.default = StringField; |
@@ -39,3 +39,3 @@ "use strict"; | ||
function valid(state) { | ||
function readyForChange(state) { | ||
return Object.keys(state).every(function (key) { | ||
@@ -46,8 +46,10 @@ return state[key] !== -1; | ||
function DateElement(_ref) { | ||
var type = _ref.type; | ||
var range = _ref.range; | ||
var value = _ref.value; | ||
var select = _ref.select; | ||
var rootId = _ref.rootId; | ||
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; | ||
@@ -61,2 +63,4 @@ var id = rootId + "_" + type; | ||
value: value, | ||
disabled: disabled, | ||
readonly: readonly, | ||
onChange: function onChange(value) { | ||
@@ -78,4 +82,4 @@ return select(type, value); | ||
// Only propagate to parent state if we have a complete date{time} | ||
if (valid(_this.state)) { | ||
_this.props.onChange((0, _utils.toDateString)(_this.state)); | ||
if (readyForChange(_this.state)) { | ||
_this.props.onChange((0, _utils.toDateString)(_this.state, _this.props.time)); | ||
} | ||
@@ -89,7 +93,12 @@ }); | ||
var time = _this$props.time; | ||
var disabled = _this$props.disabled; | ||
var readonly = _this$props.readonly; | ||
var onChange = _this$props.onChange; | ||
if (disabled || readonly) { | ||
return; | ||
} | ||
var nowDateObj = (0, _utils.parseDateString)(new Date().toJSON(), time); | ||
_this.setState(nowDateObj, function () { | ||
return onChange((0, _utils.toDateString)(_this.state)); | ||
return onChange((0, _utils.toDateString)(_this.state, time)); | ||
}); | ||
@@ -102,4 +111,9 @@ }; | ||
var time = _this$props2.time; | ||
var disabled = _this$props2.disabled; | ||
var readonly = _this$props2.readonly; | ||
var onChange = _this$props2.onChange; | ||
if (disabled || readonly) { | ||
return; | ||
} | ||
_this.setState((0, _utils.parseDateString)("", time), function () { | ||
@@ -129,3 +143,6 @@ return onChange(undefined); | ||
var id = this.props.id; | ||
var _props = this.props; | ||
var id = _props.id; | ||
var disabled = _props.disabled; | ||
var readonly = _props.readonly; | ||
@@ -135,7 +152,12 @@ return _react2.default.createElement( | ||
{ className: "list-inline" }, | ||
this.dateElementProps.map(function (props, i) { | ||
this.dateElementProps.map(function (elemProps, i) { | ||
return _react2.default.createElement( | ||
"li", | ||
{ key: i }, | ||
_react2.default.createElement(DateElement, _extends({ rootId: id, select: _this2.onChange }, props)) | ||
_react2.default.createElement(DateElement, _extends({ | ||
rootId: id, | ||
select: _this2.onChange | ||
}, elemProps, { | ||
disabled: disabled, | ||
readonly: readonly })) | ||
); | ||
@@ -189,3 +211,5 @@ }), | ||
AltDateWidget.defaultProps = { | ||
time: false | ||
time: false, | ||
disabled: false, | ||
readonly: false | ||
}; | ||
@@ -201,2 +225,4 @@ | ||
required: _react.PropTypes.bool, | ||
disabled: _react.PropTypes.bool, | ||
readonly: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func, | ||
@@ -203,0 +229,0 @@ time: _react.PropTypes.bool |
@@ -18,2 +18,3 @@ "use strict"; | ||
var required = _ref.required; | ||
var disabled = _ref.disabled; | ||
var placeholder = _ref.placeholder; | ||
@@ -25,3 +26,3 @@ var _onChange = _ref.onChange; | ||
"div", | ||
{ className: "checkbox" }, | ||
{ className: "checkbox " + (disabled ? "disabled" : "") }, | ||
_react2.default.createElement( | ||
@@ -35,2 +36,3 @@ "label", | ||
required: required, | ||
disabled: disabled, | ||
onChange: function onChange(event) { | ||
@@ -37,0 +39,0 @@ return _onChange(event.target.checked); |
@@ -7,2 +7,4 @@ "use strict"; | ||
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 _react = require("react"); | ||
@@ -12,21 +14,10 @@ | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function ColorWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
return _react2.default.createElement("input", { type: "color", | ||
id: id, | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
placeholder: placeholder, | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(event.target.value); | ||
} }); | ||
function ColorWidget(props) { | ||
return _react2.default.createElement(_BaseInput2.default, _extends({ type: "color" }, props)); | ||
} | ||
@@ -36,7 +27,3 @@ | ||
ColorWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
value: _react2.default.PropTypes.string, | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.string | ||
}; | ||
@@ -43,0 +30,0 @@ } |
@@ -7,2 +7,4 @@ "use strict"; | ||
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 _react = require("react"); | ||
@@ -12,2 +14,6 @@ | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -25,17 +31,14 @@ | ||
function DateTimeWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
function DateTimeWidget(props) { | ||
var value = props.value; | ||
var _onChange = props.onChange; | ||
return _react2.default.createElement("input", { type: "datetime-local", | ||
id: id, | ||
className: "form-control", | ||
return _react2.default.createElement(_BaseInput2.default, _extends({ | ||
type: "datetime-local" | ||
}, props, { | ||
value: fromJSONDate(value), | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(toJSONDate(event.target.value)); | ||
} }); | ||
onChange: function onChange(value) { | ||
return _onChange(toJSONDate(value)); | ||
} | ||
})); | ||
} | ||
@@ -45,8 +48,3 @@ | ||
DateTimeWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react.PropTypes.string, | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.string | ||
}; | ||
@@ -53,0 +51,0 @@ } |
@@ -7,2 +7,4 @@ "use strict"; | ||
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 _react = require("react"); | ||
@@ -12,29 +14,10 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _BaseInput = require("./BaseInput"); | ||
function fromJSONDate(jsonDate) { | ||
return jsonDate ? jsonDate.slice(0, 10) : ""; | ||
} | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function toJSONDate(dateString) { | ||
if (dateString) { | ||
return new Date(dateString).toJSON(); | ||
} | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function DateWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
return _react2.default.createElement("input", { type: "date", | ||
id: id, | ||
className: "form-control", | ||
value: fromJSONDate(value), | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(toJSONDate(event.target.value)); | ||
} }); | ||
function DateWidget(props) { | ||
return _react2.default.createElement(_BaseInput2.default, _extends({ type: "date" }, props)); | ||
} | ||
@@ -44,8 +27,3 @@ | ||
DateWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react.PropTypes.string, | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.string | ||
}; | ||
@@ -52,0 +30,0 @@ } |
@@ -7,2 +7,4 @@ "use strict"; | ||
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 _react = require("react"); | ||
@@ -12,21 +14,10 @@ | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function EmailWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
return _react2.default.createElement("input", { type: "email", | ||
id: id, | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
placeholder: placeholder, | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(event.target.value); | ||
} }); | ||
function EmailWidget(props) { | ||
return _react2.default.createElement(_BaseInput2.default, _extends({ type: "email" }, props)); | ||
} | ||
@@ -36,8 +27,3 @@ | ||
EmailWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react2.default.PropTypes.string, | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.string | ||
}; | ||
@@ -44,0 +30,0 @@ } |
@@ -7,2 +7,4 @@ "use strict"; | ||
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 _react = require("react"); | ||
@@ -12,21 +14,10 @@ | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function PasswordWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
return _react2.default.createElement("input", { type: "password", | ||
id: id, | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
placeholder: placeholder, | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(event.target.value); | ||
} }); | ||
function PasswordWidget(props) { | ||
return _react2.default.createElement(_BaseInput2.default, _extends({ type: "password" }, props)); | ||
} | ||
@@ -36,8 +27,3 @@ | ||
PasswordWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]), | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.string | ||
}; | ||
@@ -44,0 +30,0 @@ } |
@@ -19,2 +19,3 @@ "use strict"; | ||
var required = _ref.required; | ||
var disabled = _ref.disabled; | ||
var _onChange = _ref.onChange; | ||
@@ -31,3 +32,3 @@ | ||
"div", | ||
{ key: i, className: "radio" }, | ||
{ key: i, className: "radio " + (disabled ? "disabled" : "") }, | ||
_react2.default.createElement( | ||
@@ -40,2 +41,3 @@ "label", | ||
checked: checked, | ||
disabled: disabled, | ||
placeholder: placeholder, | ||
@@ -42,0 +44,0 @@ onChange: function onChange(_) { |
@@ -13,2 +13,6 @@ "use strict"; | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -30,9 +34,5 @@ | ||
function RangeWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
function RangeWidget(props) { | ||
var schema = props.schema; | ||
var value = props.value; | ||
@@ -42,11 +42,5 @@ return _react2.default.createElement( | ||
{ className: "field-range-wrapper" }, | ||
_react2.default.createElement("input", _extends({ type: "range", | ||
id: id, | ||
value: value, | ||
placeholder: placeholder, | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(event.target.value); | ||
} | ||
}, rangeSpec(schema))), | ||
_react2.default.createElement(_BaseInput2.default, _extends({ | ||
type: "range" | ||
}, props, rangeSpec(schema))), | ||
_react2.default.createElement( | ||
@@ -62,8 +56,3 @@ "span", | ||
RangeWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]), | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]) | ||
}; | ||
@@ -70,0 +59,0 @@ } |
@@ -35,2 +35,4 @@ "use strict"; | ||
var required = _ref.required; | ||
var disabled = _ref.disabled; | ||
var readonly = _ref.readonly; | ||
var multiple = _ref.multiple; | ||
@@ -47,2 +49,5 @@ var _onChange = _ref.onChange; | ||
value: value, | ||
required: required, | ||
disabled: disabled, | ||
readOnly: readonly, | ||
onChange: function onChange(event) { | ||
@@ -49,0 +54,0 @@ var newValue = void 0; |
@@ -19,2 +19,4 @@ "use strict"; | ||
var required = _ref.required; | ||
var disabled = _ref.disabled; | ||
var readonly = _ref.readonly; | ||
var _onChange = _ref.onChange; | ||
@@ -28,2 +30,4 @@ | ||
required: required, | ||
disabled: disabled, | ||
readOnly: readonly, | ||
onChange: function onChange(event) { | ||
@@ -30,0 +34,0 @@ return _onChange(event.target.value); |
@@ -11,21 +11,10 @@ "use strict"; | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function TextWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
return _react2.default.createElement("input", { type: "text", | ||
id: id, | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
placeholder: placeholder, | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(event.target.value); | ||
} }); | ||
function TextWidget(props) { | ||
return _react2.default.createElement(_BaseInput2.default, props); | ||
} | ||
@@ -35,8 +24,3 @@ | ||
TextWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]), | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]) | ||
}; | ||
@@ -43,0 +27,0 @@ } |
@@ -13,2 +13,6 @@ "use strict"; | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -30,20 +34,4 @@ | ||
function UpDownWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
return _react2.default.createElement("input", _extends({ type: "number", | ||
id: id, | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
placeholder: placeholder, | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(event.target.value); | ||
} | ||
}, rangeSpec(schema))); | ||
function UpDownWidget(props) { | ||
return _react2.default.createElement(_BaseInput2.default, _extends({ type: "number" }, props, rangeSpec(props.schema))); | ||
} | ||
@@ -53,8 +41,3 @@ | ||
UpDownWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]), | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]) | ||
}; | ||
@@ -61,0 +44,0 @@ } |
@@ -7,2 +7,4 @@ "use strict"; | ||
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 _react = require("react"); | ||
@@ -12,21 +14,10 @@ | ||
var _BaseInput = require("./BaseInput"); | ||
var _BaseInput2 = _interopRequireDefault(_BaseInput); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function URLWidget(_ref) { | ||
var schema = _ref.schema; | ||
var id = _ref.id; | ||
var placeholder = _ref.placeholder; | ||
var value = _ref.value; | ||
var required = _ref.required; | ||
var _onChange = _ref.onChange; | ||
return _react2.default.createElement("input", { type: "url", | ||
id: id, | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
placeholder: placeholder, | ||
required: required, | ||
onChange: function onChange(event) { | ||
return _onChange(event.target.value); | ||
} }); | ||
function URLWidget(props) { | ||
return _react2.default.createElement(_BaseInput2.default, _extends({ type: "url" }, props)); | ||
} | ||
@@ -36,8 +27,3 @@ | ||
URLWidget.propTypes = { | ||
schema: _react.PropTypes.object.isRequired, | ||
id: _react.PropTypes.string.isRequired, | ||
placeholder: _react.PropTypes.string, | ||
value: _react2.default.PropTypes.string, | ||
required: _react.PropTypes.bool, | ||
onChange: _react.PropTypes.func | ||
value: _react.PropTypes.string | ||
}; | ||
@@ -44,0 +30,0 @@ } |
@@ -7,2 +7,4 @@ "use strict"; | ||
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 _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; }; | ||
@@ -100,2 +102,4 @@ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var RE_ERROR_ARRAY_PATH = /\[\d+]/g; | ||
@@ -135,2 +139,3 @@ | ||
"date-time": _DateTimeWidget2.default, | ||
"date": _DateWidget2.default, | ||
"email": _EmailWidget2.default, | ||
@@ -339,3 +344,11 @@ "hostname": _TextWidget2.default, | ||
// Retrieve the referenced schema definition. | ||
return findSchemaDefinition(schema.$ref, definitions); | ||
var $refSchema = findSchemaDefinition(schema.$ref, definitions); | ||
// Drop the $ref property of the source schema. | ||
var $ref = schema.$ref; | ||
var localSchema = _objectWithoutProperties(schema, ["$ref"]); // eslint-disable-line no-unused-vars | ||
// Update referenced schema definition with local schema properties. | ||
return _extends({}, $refSchema, localSchema); | ||
} | ||
@@ -484,5 +497,7 @@ | ||
var second = _ref$second === undefined ? 0 : _ref$second; | ||
var time = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; | ||
var utcTime = Date.UTC(year, month - 1, day, hour, minute, second); | ||
return new Date(utcTime).toJSON(); | ||
var datetime = new Date(utcTime).toJSON(); | ||
return time ? datetime : datetime.slice(0, 10); | ||
} | ||
@@ -489,0 +504,0 @@ |
{ | ||
"name": "react-jsonschema-form", | ||
"version": "0.28.1", | ||
"version": "0.29.0", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -48,3 +48,3 @@ "scripts": { | ||
"css-loader": "^0.23.1", | ||
"eslint": "^2.6.0", | ||
"eslint": "^2.9.0", | ||
"eslint-plugin-react": "^4.2.3", | ||
@@ -51,0 +51,0 @@ "estraverse": "^4.2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2574
643758
1
0
26