alaska-field-text
Advanced tools
Comparing version 0.12.12 to 0.13.0
{ | ||
"name": "alaska-field-text", | ||
"version": "0.12.12", | ||
"version": "0.13.0", | ||
"description": "Alaska text field", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -12,11 +12,10 @@ // @flow | ||
shouldComponentUpdate(props: Alaska$view$Field$View$Props): boolean { | ||
return !shallowEqualWithout(props, this.props, 'record', 'onChange', 'model', 'field'); | ||
shouldComponentUpdate(nextProps: Alaska$view$Field$View$Props): boolean { | ||
return nextProps.record._id !== this.props.record._id || | ||
!shallowEqualWithout(nextProps, this.props, 'record', 'onChange', 'model'); | ||
} | ||
hasError() { | ||
let { | ||
field, | ||
value | ||
} = this.props; | ||
getError(): string { | ||
const { t } = this.context; | ||
const { field, value } = this.props; | ||
if (value && field.match && typeof field.match === 'string') { | ||
@@ -27,7 +26,7 @@ let matchs = field.match.match(/^\/(.+)\/([igm]*)$/); | ||
if (!match.test(value)) { | ||
return true; | ||
return t('Invalid format'); | ||
} | ||
} | ||
} | ||
return false; | ||
return ''; | ||
} | ||
@@ -53,11 +52,3 @@ | ||
className += ' text-field'; | ||
if (!errorText && value && field.match && typeof field.match === 'string') { | ||
let matchs = field.match.match(/^\/(.+)\/([igm]*)$/); | ||
if (matchs) { | ||
let match = new RegExp(matchs[1], matchs[2]); | ||
if (!match.test(value)) { | ||
errorText = t('Invalid format'); | ||
} | ||
} | ||
} | ||
errorText = errorText || this.getError(); | ||
if (errorText) { | ||
@@ -64,0 +55,0 @@ className += ' has-error'; |
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
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
9988
294