Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-bsonschema-form

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-bsonschema-form - npm Package Compare versions

Comparing version 0.41.8 to 0.41.9

82

lib/components/fields/ObjectIdField.js

@@ -9,4 +9,2 @@ "use strict";

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = require("react");

@@ -16,70 +14,28 @@

var _StringField = require("./StringField");
var _StringField2 = _interopRequireDefault(_StringField);
var _bson = require("bson");
var _bson2 = _interopRequireDefault(_bson);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function ObjectIdField(props) {
var StringField = props.registry.fields.StringField;
var formData = props.formData;
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var formDataStr = formData && (formData._str || formData.toString());
return _react2.default.createElement(StringField, _extends({}, props, { formData: formDataStr }));
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function createObjectID() {
var bsonObjectID = _bson2.default.ObjectID();
if (window.Meteor) {
return new window.Meteor.Collection.ObjectID(bsonObjectID.toString());
} else {
return bsonObjectID;
}
if (process.env.NODE_ENV !== "production") {
ObjectIdField.propTypes = {
schema: _react.PropTypes.object.isRequired,
uiSchema: _react.PropTypes.object,
idSchema: _react.PropTypes.object,
onChange: _react.PropTypes.func.isRequired,
formData: _react.PropTypes.object,
required: _react.PropTypes.bool,
formContext: _react.PropTypes.object.isRequired
};
}
var ObjectIdField = function (_React$Component) {
_inherits(ObjectIdField, _React$Component);
ObjectIdField.defaultProps = {
uiSchema: {}
};
function ObjectIdField() {
_classCallCheck(this, ObjectIdField);
return _possibleConstructorReturn(this, (ObjectIdField.__proto__ || Object.getPrototypeOf(ObjectIdField)).apply(this, arguments));
}
_createClass(ObjectIdField, [{
key: "updateObjectID",
value: function updateObjectID(formData) {
if (!formData) {
this.props.onChange(createObjectID());
}
}
}, {
key: "componentWillMount",
value: function componentWillMount() {
this.updateObjectID(this.props.formData);
}
}, {
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {
this.updateObjectID(nextProps.formData);
}
}, {
key: "render",
value: function render() {
var formData = this.props.formData;
var formDataStr = formData && (formData._str || formData.toString());
return _react2.default.createElement(_StringField2.default, _extends({}, this.props, {
formData: formData,
readonly: true
}));
}
}]);
return ObjectIdField;
}(_react2.default.Component);
exports.default = ObjectIdField;
{
"name": "react-bsonschema-form",
"version": "0.41.8",
"version": "0.41.9",
"description": "A simple React component capable of building HTML forms out of a JSON schema.",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc