-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 🎸 form builder + components shared library #74
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 7afa6d7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 3 targetsSent with 💌 from NxCloud. |
Codecov Report
@@ Coverage Diff @@
## master #74 +/- ##
==========================================
+ Coverage 67.71% 69.02% +1.31%
==========================================
Files 48 50 +2
Lines 254 268 +14
Branches 14 14
==========================================
+ Hits 172 185 +13
- Misses 82 83 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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 talked about not having a form-builder, what changed?
@@ -0,0 +1,11 @@ | |||
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core'; | |||
|
|||
export interface IFormData { |
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'm not a fan of the I
prefix for interfaces, if its done in other interfaces keep it but if not remove it
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.
Me either. The thing is that in a bunch of cases, we need Dto class and exactly the same interface for the FE. So, I had to add it.
@@ -0,0 +1,11 @@ | |||
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core'; | |||
|
|||
export interface IFormData { |
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.
redundant interface, its equivalent to Record<string, any>
|
||
export type IFormField = FormlyFieldConfig; | ||
|
||
export type IFormFields = Array<IFormField>; |
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.
redundant, just do IFormField[] where its needed (prefer to be explicit as its more readable IMO)
@@ -0,0 +1,7 @@ | |||
# shared-components |
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.
recreate the lib as "dynamic-form" outside of shared (shared is for things that are also used in the daemon)
im also suggesting dynamic-form instead of components because this lib will also have custom fields, validators, etc
selector: 'cli-form-builder', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, |
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.
remove and import specific parts of it if needed
imports: [ | ||
CommonModule, | ||
FormlyModule, | ||
FormlyMaterialModule, |
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.
this should be imported only where you do FormlyModule.forRoot
@@ -0,0 +1,11 @@ | |||
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core'; |
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.
In general, unless you're making your own interfaces and mappers between these types, I don't see any benefit of this file and IMO we should use formly models directly
@@ -181,6 +181,16 @@ importers: | |||
'@angular/core': 15.1.5_rxjs@7.5.7+zone.js@0.11.8 | |||
tslib: 2.5.0 | |||
|
|||
libs/shared/components: |
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.
is pnpm-workspaces file still exists? if so remove it, revert this file, remove node_modules, and run pnpm i
again
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.
pull and resolve conflicts, it'll probably fix it
I agree with @Danieliverant about this, unless we make our own providers that wrap formly's providers and add extra functionality I don't see any reason to have this component |
✅ Closes: #72
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
adds a library for shared components and a component for dynamic form
What is the current behavior?
none
Issue Number: N/A
none
Does this PR introduce a breaking change?
Other information
Example of Component Generator (not included in this pr)