@uidu/field-base
Advanced tools
Comparing version 0.1.43 to 0.1.44
# Change Log | ||
## 0.1.44 | ||
### Patch Changes | ||
- [patch][d524ca9](https://github.org/uidu-org/guidu/commits/d524ca9): | ||
Added input group, fix validation before submit | ||
## 0.1.43 | ||
@@ -4,0 +12,0 @@ |
import { PureComponent } from 'react'; | ||
import { InputGroupProps } from '../InputGroup'; | ||
import { WrapperProps } from './types'; | ||
export default class Wrapper extends PureComponent<WrapperProps> { | ||
export default class Wrapper extends PureComponent<WrapperProps & InputGroupProps> { | ||
static defaultProps: { | ||
@@ -5,0 +6,0 @@ layout: string; |
import { __assign, __extends } from "tslib"; | ||
import React, { PureComponent } from 'react'; | ||
import { ErrorMessages, FloatLabel, Help, Icon, RequiredSymbol, Row, } from '../../index'; | ||
import InputGroup from '../InputGroup'; | ||
var Wrapper = /** @class */ (function (_super) { | ||
@@ -10,10 +11,20 @@ __extends(Wrapper, _super); | ||
Wrapper.prototype.render = function () { | ||
var _a = this.props, children = _a.children, errorMessages = _a.errorMessages, floatLabel = _a.floatLabel, help = _a.help, id = _a.id, layout = _a.layout, type = _a.type, showErrors = _a.showErrors, required = _a.required; | ||
var _a = this.props, addonAfter = _a.addonAfter, addonBefore = _a.addonBefore, buttonAfter = _a.buttonAfter, buttonBefore = _a.buttonBefore, children = _a.children, errorMessages = _a.errorMessages, floatLabel = _a.floatLabel, help = _a.help, id = _a.id, layout = _a.layout, type = _a.type, showErrors = _a.showErrors, required = _a.required; | ||
var control = children; | ||
if (type === 'hidden') { | ||
return children; | ||
return control; | ||
} | ||
var inputGroupProps = { | ||
addonAfter: addonAfter, | ||
addonBefore: addonBefore, | ||
buttonAfter: buttonAfter, | ||
buttonBefore: buttonBefore, | ||
}; | ||
if (addonBefore || addonAfter || buttonBefore || buttonAfter) { | ||
control = React.createElement(InputGroup, __assign({}, inputGroupProps), control); | ||
} | ||
if (floatLabel) { | ||
return (React.createElement(Row, __assign({ label: function () { return null; }, required: false, htmlFor: id }, this.props), | ||
React.createElement(FloatLabel, { htmlFor: id, className: "has-float-label" }, | ||
children, | ||
control, | ||
showErrors ? React.createElement(ErrorMessages, { messages: errorMessages }) : null, | ||
@@ -27,6 +38,6 @@ React.createElement("span", null, | ||
if (layout === 'elementOnly') { | ||
return children; | ||
return control; | ||
} | ||
return (React.createElement(Row, __assign({ htmlFor: id }, this.props), | ||
children, | ||
control, | ||
showErrors ? React.createElement(ErrorMessages, { messages: errorMessages }) : null, | ||
@@ -33,0 +44,0 @@ help ? React.createElement(Help, { help: help }) : null, |
{ | ||
"name": "@uidu/field-base", | ||
"version": "0.1.43", | ||
"version": "0.1.44", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@uidu/field-base", | ||
"version": "0.1.43", | ||
"version": "0.1.44", | ||
"description": "Inputs using Formsy", | ||
@@ -12,3 +12,3 @@ "repository": "https://github.com/uidu-org/guidu.git", | ||
"dependencies": { | ||
"@uidu/form": "^0.1.36", | ||
"@uidu/form": "^0.1.37", | ||
"classnames": "^2.2.6", | ||
@@ -15,0 +15,0 @@ "formsy-react": "^2.0.0-beta.3", |
{ | ||
"name": "@uidu/field-base", | ||
"version": "0.1.43", | ||
"version": "0.1.44", | ||
"sideEffects": false | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
61312
93
1261
Updated@uidu/form@^0.1.37