angular: add option to toggle off errors without user interaction#2583
Conversation
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks for the PR. However we can only accept it in case you sign the CLA |
|
Already did not sure it's still saying I haven't. I've give another try. |
|
"You have agreed to the CLA for multiple repositories or organizations" |
|
Looks like the commit author points to a different Github account than the one you signed the CLA with, i.e. |
sdirix
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I had a look over the code, please see my comments.
Oh snap, forgot about that. I guess I will have to redo the whole thing on my personal laptop. |
|
You could amend the existing commit and force push to switch the author |
e8811c9 to
f1d7c0f
Compare
sdirix
left a comment
There was a problem hiding this comment.
Thanks for the changes. Please have a look at my comments.
|
|
||
| export const angularConfigDefault: JsonFormsAngularConfig = { | ||
| showErrorsOnTouch: false, | ||
| }; |
There was a problem hiding this comment.
angularConfigDefault is redundant: showErrorsOnTouch: false is equivalent to undefined in the !appliedUiSchemaOptions.showErrorsOnTouch check. Dropping the const (and the merges referencing it in jsonforms-root.component.ts) would simplify the wiring and we don't need a framework-specific default at all.
| this.readonly = !this.readonly; | ||
| } | ||
|
|
||
| toggleShowErrorsImmediately() { |
There was a problem hiding this comment.
Leftover naming from the previous iteration. Rename to toggleShowErrorsOnTouch to match the config flag.
| */ | ||
| import { registerExamples } from '../register'; | ||
|
|
||
| export const schema = { |
There was a problem hiding this comment.
Is this example needed? There is nothing "show-errors-on-touch" related in here? So we can just skip all the examples changes?
There was a problem hiding this comment.
Removed, it was to test with all component as required.
|
Thanks for the contribution ❤️ |
By default the library is marking all fields as touched, to avoid creating regressions I added an option to toggle this behavior off.
Added as a component option or as a global configuration.
Since everything is being treated as "any" which is not really a good convention for this component I added an interface with the new option, where for now will be only available on Angular (feel free to move to the core if someone wants to implement on the other frameworks).
Fixes #2458