Skip to content
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

Closed

Conversation

eladzipper96
Copy link
Contributor

@eladzipper96 eladzipper96 commented Feb 26, 2023

Closes: #72

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines: CONTRIBUTING.md
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

adds a library for shared components and a component for dynamic form

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

none

Issue Number: N/A

none

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Example of Component Generator (not included in this pr)
Screenshot_3

@nx-cloud
Copy link

nx-cloud bot commented Feb 26, 2023

☁️ Nx Cloud Report

CI 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 targets

Sent with 💌 from NxCloud.

@codecov
Copy link

codecov bot commented Feb 26, 2023

Codecov Report

Merging #74 (7afa6d7) into master (5b35eeb) will increase coverage by 1.31%.
The diff coverage is 92.85%.

@@            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     
Flag Coverage Δ
cli-daemon 55.00% <ø> (ø)
cli-gui 93.93% <ø> (ø)
configuration 100.00% <ø> (ø)
executors 100.00% <ø> (ø)
generators 77.77% <ø> (ø)
shared 92.85% <92.85%> (∅)
workspace-manager 100.00% <ø> (ø)
Impacted Files Coverage Δ
...nts/src/lib/form-builder/form-builder.component.ts 92.30% <92.30%> (ø)
...s/src/lib/form-builder/form-builder.component.html 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@Danieliverant Danieliverant left a 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?

@ronnetzer ronnetzer requested a review from a team February 28, 2023 12:30
@@ -0,0 +1,11 @@
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core';

export interface IFormData {
Copy link
Member

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

Copy link
Collaborator

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 {
Copy link
Member

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>;
Copy link
Member

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
Copy link
Member

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,
Copy link
Member

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,
Copy link
Member

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';
Copy link
Member

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:
Copy link
Member

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

Copy link
Member

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

@ronnetzer
Copy link
Member

We talked about not having a form-builder, what changed?

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

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.

dynamic form builder
4 participants