Skip to content

feat(Form): initial Implementation #242

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

Merged
merged 37 commits into from
Dec 13, 2019
Merged

feat(Form): initial Implementation #242

merged 37 commits into from
Dec 13, 2019

Conversation

andybessm
Copy link
Contributor

Thank you for your contribution! 👏

To get it merged faster, kindly review the checklist below:

Pull Request Checklist

MarcusNotheis and others added 24 commits November 7, 2019 10:33
…use of a standard style added; custom dnd hook added
… with absolute layout

BREAKING CHANGE: Update `react-table` to `7.0.0-rc.23`
@andybessm andybessm requested a review from vbersch December 9, 2019 08:16
@vbersch vbersch changed the title Feat/form component feat(Form): initial Implementation Dec 9, 2019
@netlify
Copy link

netlify bot commented Dec 9, 2019

Deploy preview for ui5-webcomponents-react ready!

Built with commit 211ac8f

https://deploy-preview-242--ui5-webcomponents-react.netlify.com

@codecov-io
Copy link

codecov-io commented Dec 9, 2019

Codecov Report

Merging #242 into master will decrease coverage by 0.04%.
The diff coverage is 69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
- Coverage   72.53%   72.48%   -0.05%     
==========================================
  Files         156      162       +6     
  Lines        3466     3558      +92     
  Branches      605      618      +13     
==========================================
+ Hits         2514     2579      +65     
- Misses        744      769      +25     
- Partials      208      210       +2
Impacted Files Coverage Δ
...components/AnalyticalTable/hooks/useCellStyling.ts 0% <0%> (ø)
packages/main/src/components/Grid/index.tsx 86.2% <100%> (+3.12%) ⬆️
...src/components/Form/CurrentViewportRangeContext.ts 100% <100%> (ø)
...kages/main/src/components/Form/FormGroup/index.tsx 100% <100%> (ø)
packages/base/src/hooks/useViewportRange.ts 87.5% <87.5%> (ø)
packages/main/src/components/Form/index.tsx 88.88% <88.88%> (ø)
...ckages/main/src/components/Form/FormItem/index.tsx 96.55% <96.55%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ed5dd6...211ac8f. Read the comment docs.

Copy link
Contributor

@vbersch vbersch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn´t find any bugs. It works as expected!
Just a couple of things:

  • You extracted your styles into a jss file, but you don´t actually use jss. It would be cleaner to either use jss or create the styles you need directly in your component with stable references.
  • You modified the Grid component and added a new event. You should be able to get the size changes with already existing apis (see comment in grid file)
  • Each FormItem reacts separately to viewport changes. I think it would be more efficient (and you would need less code) to only subscribe to viewport changes with the Form component and pass that information down to its children.
  • I think the logic to assign separate FormItems to a synthetic FormGroup can be simplified.
  • Could you please create lib exports for Form, FormItem and FormGroup? Have a look at main/src/libas a reference. Afterwards, could you please execute the script main/scripts/create-library-export.js?

@andybessm andybessm requested a review from vbersch December 12, 2019 11:49
@@ -0,0 +1,5 @@
import React from 'react';

const CurrentRange = React.createContext(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should delete this file.

<FlexBox
justifyContent={FlexBoxJustifyContent.Start}
alignItems={FlexBoxAlignItems.End}
fitContainer={true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a tslint error. You should omit the ={true} part.

import { TitleLevel } from '@ui5/webcomponents-react/lib/TitleLevel';
import { styles } from './Form.jss';
import { createUseStyles } from 'react-jss';
import { useViewportRange } from '@ui5/webcomponents-react-base/src/hooks/useViewportRange';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should add a lib export for useViewportRange and import from there. see e.g. lib/Device.

import { styles } from './Grid.jss';
import { useViewportRange } from '@ui5/webcomponents-react-base/src/hooks/useViewportRange';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment above. You should import from @ui5/webcomponents-react-base/lib/useViewportRange

@andybessm andybessm requested a review from vbersch December 12, 2019 14:05
import notes from './Form.md';
import { FormItem } from './FormItem';
import { FormGroup } from './FormGroup';
import { CheckBox, Input, InputType, Option, Select } from '../..';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still not correct. Please import each of those components separately. e.g.
import { CheckBox } from '@ui5/webcomponents-react/lib/CheckBox';

import { Label } from '@ui5/webcomponents-react/lib/Label';
import { styles } from '../Form.jss';
import { createUseStyles } from 'react-jss';
import { CurrentRange } from '../index';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh. I know we talked about this but I now realize that we have a cyclic dependency if we do it this way.... sorry!
Form imports FormItem and FormItem imports Form. Thats not a good idea. Could we put the CurrentRangeContext in a separate file, please?

@vbersch vbersch merged commit c4c2848 into master Dec 13, 2019
@vbersch vbersch deleted the feat/form-component branch December 13, 2019 06:38
@andybessm andybessm requested a review from vbersch December 13, 2019 07:03
@MarcusNotheis MarcusNotheis mentioned this pull request Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants