You've already forked react-forms
Translation support
This commit is contained in:
72
dist/index.es.js
vendored
72
dist/index.es.js
vendored
@@ -91,6 +91,37 @@ var FormConsumer = function (_Component) {
|
||||
return FormConsumer;
|
||||
}(Component);
|
||||
|
||||
var FormTranslationContext = React.createContext({
|
||||
renderText: function renderText(text) {
|
||||
return text;
|
||||
}
|
||||
});
|
||||
|
||||
var FormTranslationConsumer = function (_Component) {
|
||||
inherits(FormTranslationConsumer, _Component);
|
||||
|
||||
function FormTranslationConsumer() {
|
||||
classCallCheck(this, FormTranslationConsumer);
|
||||
return possibleConstructorReturn(this, (FormTranslationConsumer.__proto__ || Object.getPrototypeOf(FormTranslationConsumer)).apply(this, arguments));
|
||||
}
|
||||
|
||||
createClass(FormTranslationConsumer, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return React.createElement(
|
||||
FormTranslationContext.Consumer,
|
||||
null,
|
||||
function (props) {
|
||||
return _this2.props.children(props);
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return FormTranslationConsumer;
|
||||
}(Component);
|
||||
|
||||
var FormItemError = function (_Component) {
|
||||
inherits(FormItemError, _Component);
|
||||
|
||||
@@ -100,7 +131,7 @@ var FormItemError = function (_Component) {
|
||||
}
|
||||
|
||||
createClass(FormItemError, [{
|
||||
key: "render",
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
@@ -117,12 +148,12 @@ var FormItemError = function (_Component) {
|
||||
);
|
||||
}
|
||||
}, {
|
||||
key: "renderError",
|
||||
key: 'renderError',
|
||||
value: function renderError(data, translator) {
|
||||
return React.createElement(
|
||||
"p",
|
||||
{ className: "text-danger" },
|
||||
translator.handleText(data.errors[this.props.name].error)
|
||||
'p',
|
||||
{ className: 'text-danger' },
|
||||
translator.renderText(data.errors[this.props.name].error)
|
||||
);
|
||||
}
|
||||
}]);
|
||||
@@ -3286,36 +3317,5 @@ TextArea.defaultProps = {
|
||||
onChangeValue: function onChangeValue(text) {}
|
||||
};
|
||||
|
||||
var FormTranslationContext = React.createContext({
|
||||
renderText: function renderText(text) {
|
||||
return text;
|
||||
}
|
||||
});
|
||||
|
||||
var FormTranslationConsumer$1 = function (_Component) {
|
||||
inherits(FormTranslationConsumer, _Component);
|
||||
|
||||
function FormTranslationConsumer() {
|
||||
classCallCheck(this, FormTranslationConsumer);
|
||||
return possibleConstructorReturn(this, (FormTranslationConsumer.__proto__ || Object.getPrototypeOf(FormTranslationConsumer)).apply(this, arguments));
|
||||
}
|
||||
|
||||
createClass(FormTranslationConsumer, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return React.createElement(
|
||||
FormTranslationContext.Consumer,
|
||||
null,
|
||||
function (props) {
|
||||
return _this2.props.children(props);
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return FormTranslationConsumer;
|
||||
}(Component);
|
||||
|
||||
export { CheckBox, Form, Input, Option, OptionGroup, RadioGroup, Radio, Submit, TextArea, FormTranslationContext };
|
||||
//# sourceMappingURL=index.es.js.map
|
||||
|
||||
2
dist/index.es.js.map
vendored
2
dist/index.es.js.map
vendored
File diff suppressed because one or more lines are too long
72
dist/index.js
vendored
72
dist/index.js
vendored
@@ -98,6 +98,37 @@ var FormConsumer = function (_Component) {
|
||||
return FormConsumer;
|
||||
}(React.Component);
|
||||
|
||||
var FormTranslationContext = React__default.createContext({
|
||||
renderText: function renderText(text) {
|
||||
return text;
|
||||
}
|
||||
});
|
||||
|
||||
var FormTranslationConsumer = function (_Component) {
|
||||
inherits(FormTranslationConsumer, _Component);
|
||||
|
||||
function FormTranslationConsumer() {
|
||||
classCallCheck(this, FormTranslationConsumer);
|
||||
return possibleConstructorReturn(this, (FormTranslationConsumer.__proto__ || Object.getPrototypeOf(FormTranslationConsumer)).apply(this, arguments));
|
||||
}
|
||||
|
||||
createClass(FormTranslationConsumer, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return React__default.createElement(
|
||||
FormTranslationContext.Consumer,
|
||||
null,
|
||||
function (props) {
|
||||
return _this2.props.children(props);
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return FormTranslationConsumer;
|
||||
}(React.Component);
|
||||
|
||||
var FormItemError = function (_Component) {
|
||||
inherits(FormItemError, _Component);
|
||||
|
||||
@@ -107,7 +138,7 @@ var FormItemError = function (_Component) {
|
||||
}
|
||||
|
||||
createClass(FormItemError, [{
|
||||
key: "render",
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
@@ -124,12 +155,12 @@ var FormItemError = function (_Component) {
|
||||
);
|
||||
}
|
||||
}, {
|
||||
key: "renderError",
|
||||
key: 'renderError',
|
||||
value: function renderError(data, translator) {
|
||||
return React__default.createElement(
|
||||
"p",
|
||||
{ className: "text-danger" },
|
||||
translator.handleText(data.errors[this.props.name].error)
|
||||
'p',
|
||||
{ className: 'text-danger' },
|
||||
translator.renderText(data.errors[this.props.name].error)
|
||||
);
|
||||
}
|
||||
}]);
|
||||
@@ -3293,37 +3324,6 @@ TextArea.defaultProps = {
|
||||
onChangeValue: function onChangeValue(text) {}
|
||||
};
|
||||
|
||||
var FormTranslationContext = React__default.createContext({
|
||||
renderText: function renderText(text) {
|
||||
return text;
|
||||
}
|
||||
});
|
||||
|
||||
var FormTranslationConsumer$1 = function (_Component) {
|
||||
inherits(FormTranslationConsumer, _Component);
|
||||
|
||||
function FormTranslationConsumer() {
|
||||
classCallCheck(this, FormTranslationConsumer);
|
||||
return possibleConstructorReturn(this, (FormTranslationConsumer.__proto__ || Object.getPrototypeOf(FormTranslationConsumer)).apply(this, arguments));
|
||||
}
|
||||
|
||||
createClass(FormTranslationConsumer, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return React__default.createElement(
|
||||
FormTranslationContext.Consumer,
|
||||
null,
|
||||
function (props) {
|
||||
return _this2.props.children(props);
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return FormTranslationConsumer;
|
||||
}(React.Component);
|
||||
|
||||
exports.CheckBox = CheckBox;
|
||||
exports.Form = Form;
|
||||
exports.Input = Input;
|
||||
|
||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -17,6 +17,6 @@ export default class FormItemError extends Component
|
||||
|
||||
renderError(data, translator)
|
||||
{
|
||||
return <p className="text-danger">{translator.handleText(data.errors[this.props.name].error)}</p>
|
||||
return <p className="text-danger">{translator.renderText(data.errors[this.props.name].error)}</p>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user