-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form Layouts #1
Form Layouts #1
Conversation
Pull Request Test Coverage Report for Build 43
💛 - Coveralls |
src/layouts/ticketFormLayout.js
Outdated
@@ -0,0 +1,364 @@ | |||
export default [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this file into /tests/DemoState
as it is only needed for tests and storybook and would need to be provided when using this library
package.json
Outdated
@@ -8,9 +8,11 @@ | |||
"@deskpro/js-utils": "^1.0.4", | |||
"@deskpro/react-datepicker-hijri": "^1.4.2-beta.1", | |||
"@storybook/addon-knobs": "^3.4.3", | |||
"ajv": "^6.5.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be a dev dependency, it is not used outside the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had an idea to use this validation in the LayoutConfig helper in order to warn developers that the layout is not valid. But the library is a bit heavy so I decided to not implement that. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to keep things lightweight. I'm already worried by moment
size ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can replace moment
with date-fns
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into that. Does it support hijri calendar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I don't know..
@jducro I have fixed two your comments |
Here is the FieldLayout component with a possibility to define fields config and variations (dependent fields) in a simple javascript structure.
<FieldLayout />
(src/Components/FieldLayout.jsx
) doesn't provide an entire form and could be used as a part of the form.src/layouts/
) to leave only rendering-related code in the FieldLayout component and this allowed to cover this logic with unit tests (seetests/jest/Layout/layout.js
).eq
,gt
(greater than),gte
(greater or equal),lt
(less than),lte
(less or equal),in
(value is in array of allowed values)required
,min
,max
,minLength
,maxLength
,regex
,dateRange
with possibility to pass parameters into them