Data types feature#67
Conversation
| FLOAT: 'float', | ||
| NUMBER: 'number', | ||
| BOOLEAN: 'boolean', | ||
| STRING: 'stirng', |
Codecov Report
@@ Coverage Diff @@
## master #67 +/- ##
==========================================
+ Coverage 82.76% 83.06% +0.29%
==========================================
Files 79 80 +1
Lines 1271 1299 +28
Branches 302 310 +8
==========================================
+ Hits 1052 1079 +27
- Misses 188 189 +1
Partials 31 31
Continue to review full report at Codecov.
|
dc22e60 to
9a26b28
Compare
| * Pick a value from event object and returns it | ||
| * @param {Object|Any} event event value returned from form field | ||
| */ | ||
| const sanytyzeValue = event => |
| pattern: /^\d*[.]{0,1}\d*$/, message: 'Values mut be number', ...options, | ||
| }), | ||
| float: options => pattern({ | ||
| pattern: /^\d*[.]{0,1}\d*$/, message: 'Values mut be number', ...options, |
| ## Introduction | ||
|
|
||
| You can specify a type of a component by providing `dataType`, which will automatically validates the component value. | ||
| Becuse almost everyting in html inputs is outputed as a string, adding the `dataType` props will also cast the value to given type. |
| You can specify a type of a component by providing `dataType`, which will automatically validates the component value. | ||
| Becuse almost everyting in html inputs is outputed as a string, adding the `dataType` props will also cast the value to given type. | ||
|
|
||
| ### Avaiable dataTypes |
|
Code looks solid! 👍 Just a few typos.. Need to test in UI. I like it, however, are we really make this feature as a default behavior? (To be honest, I haven't seen DataTypes used anywhere yet [except our demo schemas], but it can theoretically break some stuff if somebody uses it.) |
9a26b28 to
70ad7c1
Compare
|
@rvsia it theoretically could break something but if yo are using data types and actually not expecting that data type in the output i don't thin it should be used at all. They can always remove it and just use validator. |
| ### Available dataTypes | ||
|
|
||
| ```jsx | ||
| ['integer', 'float', 'number', 'bool', 'string'] |
There was a problem hiding this comment.
we will make this bool because Mozilla parser returns bool (i know we won't be using it). Let me fix it in the mapper.
There was a problem hiding this comment.
Nvm it is actually boolean
rvsia
left a comment
There was a problem hiding this comment.
Please add dataType validator to renderer, otherwise, it works perfectly! 👍 📈
|
Looks good! |
2d12716 to
5c8dc51
Compare
5c8dc51 to
755f93c
Compare
closes: #65
Adds data types casting to form fields (both default and custom)
onChangefunction with type casting if thedataTypeprop has been given