UNPKG

react-schema-based-json-editor

Version:
20 lines (19 loc) 880 B
import { __extends } from "tslib"; import * as React from 'react'; var Optional = /** @class */ (function (_super) { __extends(Optional, _super); function Optional() { return _super !== null && _super.apply(this, arguments) || this; } Optional.prototype.render = function () { if (!this.props.required && (this.props.value === undefined || !this.props.isReadOnly)) { return (React.createElement("div", { className: this.props.theme.checkbox }, React.createElement("label", null, React.createElement("input", { type: 'checkbox', onChange: this.props.toggleOptional, checked: this.props.value === undefined, disabled: this.props.isReadOnly }), this.props.locale.info.notExists))); } return null; }; return Optional; }(React.Component)); export { Optional };