-
Notifications
You must be signed in to change notification settings - Fork 43
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: update forms doc #1694
base: main
Are you sure you want to change the base?
feat: update forms doc #1694
Conversation
View your CI Pipeline Execution ↗ for commit 06a74e2.
☁️ Nx Cloud last updated this comment at |
packages/@o3r/forms/README.md
Outdated
@@ -12,7 +12,11 @@ This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/ot | |||
[](https://www.npmjs.com/package/@o3r/forms) | |||
[](https://www.npmjs.com/package/@o3r/forms) | |||
|
|||
This module provides utilities to enhance Angular form (asynchronous decorator, additional validator, error store...). | |||
This module provides utilities to enhance the build of Angular reactive forms in the Otter context. These utilities include: |
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.
From what I see this entire module is related to guidelines for a product application, with container/presenter structure for components.
I think we should explain this here in the beginning and maybe add another section where to say that for small apps, be-spoke apps (I don;t know how to name them :D) this module does not bring added value on top of angular forms.
Maybe we can have a discussion inside the team to double check if something from this module can be used in any use-case.
Any thoughts @pginoux-1A @kpanot ?
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 agree with you for all the complexity brings by container / presenter.
But some features could be interesting even with as small apps
for example if you want to handle the submission at page level and display the error messages outside the form component
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.
Also, we should probably avoid "in the Otter context", from an outside perspective this is really scary. If I don't know what Otter is, I would imagine a big black box with guidelines from an entity I know nothing about.
Unlike Angular, ware not known enough to use this kind of sentence in a public documentation.
I would replace it with the actual context (described by @matthieu-crouzet and @mrednic-1A ) on where our utilities can be useful.
docs/forms/FORM_ERRORS.md
Outdated
- __longTranslationKey__ used for a more detailed message on the same error | ||
- __translationParams__ translations parameters | ||
- __validationError__ original error object | ||
- `ErrorMessageObject` is associated to an error message on a field. It contains: |
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.
Shouldn't this kind of doc be in the tsdoc only ?
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.
It depends, on the usage, it is nice to see how to use this model without going through the code. But maybe it could be more interesting to see how to use it instead of writing a tsdoc.
docs/forms/FORM_STRUCTURE.md
Outdated
__Presenter class:__ | ||
* Here we have to create the `formGroup`/`formArray`/`formControl` object. | ||
* Provide [NG_VALUE_ACCESSOR](https://angular.io/api/forms/NG_VALUE_ACCESSOR) - used to provide a [ControlValueAccessor](https://angular.io/api/forms/DefaultValueAccessor) for form controls, to write a value and listen to changes on input elements. | ||
* Provide [NG_VALIDATORS](https://angular.io/api/forms/NG_VALIDATORS) - this is an [InjectionToken](https://angular.io/api/core/InjectionToken) for registering additional synchronous validators used with forms. | ||
```typescript | ||
// in presenter class | ||
@Component({ |
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.
Should we keep an example like that in the doc
or have it in the showcase and add a link to it here
packages/@o3r/forms/README.md
Outdated
@@ -12,7 +12,11 @@ This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/ot | |||
[](https://www.npmjs.com/package/@o3r/forms) | |||
[](https://www.npmjs.com/package/@o3r/forms) | |||
|
|||
This module provides utilities to enhance Angular form (asynchronous decorator, additional validator, error store...). | |||
This module provides utilities to enhance the build of Angular reactive forms in the Otter context. These utilities include: |
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.
Also, we should probably avoid "in the Otter context", from an outside perspective this is really scary. If I don't know what Otter is, I would imagine a big black box with guidelines from an entity I know nothing about.
Unlike Angular, ware not known enough to use this kind of sentence in a public documentation.
I would replace it with the actual context (described by @matthieu-crouzet and @mrednic-1A ) on where our utilities can be useful.
packages/@o3r/forms/README.md
Outdated
This module provides utilities to enhance the build of Angular reactive forms in the Otter context. These utilities include: | ||
* An asynchronous decorator (`@AsyncInput`) to ensure subscriptions are handled if the references of the input observables change. | ||
* Basic and custom validators to validate user input for accuracy and completeness. | ||
* A dedicated NgRX store for form errors to have the possibility of displaying error messages. |
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.
* A dedicated NgRX store for form errors to have the possibility of displaying error messages. | |
* A dedicated NgRX store for form errors to have the possibility of displaying error messages outside the form component. |
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.
Not sure if this is useful to mention...
...e/src/components/utilities/forms-emergency-contact/forms-emergency-contact-pres.component.ts
Outdated
Show resolved
Hide resolved
2bef32d
to
2332915
Compare
278675b
to
1381aea
Compare
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
doc/forms-update-e2e-screenshots with the updated screenshots has been created! |
apps/showcase/src/components/showcase/forms-parent/forms-parent.component.ts
Outdated
Show resolved
Hide resolved
apps/showcase/src/components/showcase/forms-parent/forms-parent.template.html
Outdated
Show resolved
Hide resolved
.../components/utilities/forms-emergency-contact/forms-emergency-contact-pres.localization.json
Outdated
Show resolved
Hide resolved
6696f9d
to
4400b70
Compare
Proposed change
Update documentation on forms