Closed pdesoyres-cc closed 2 weeks ago
🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/forms/init/index.html.
This preview will be deleted once this PR is closed.
Two random thoughts:
Hey @pdesoyres-cc, nice work :muscle:
I went through the commits and files of this PR with lots of attention. Before that, I had to try the low level stuffs by myself (element internals and creating your own directives) to really understand the whole thing :wink:
I wrote many remarks and questions in a local file and I also tried a simplification in a branch. I'd like to try some refactorings with you in pair (or mob) programming sessions but I don't want to freeze this ongoing PR.
My proposition would be to discuss and settle the "breaking stuffs" first (the publicly available APIs, the ones used by smart components). Once we (the team) agree on something, we can merge. Then we can make iterative refactoring sessions together that don't break the code but (hopefully simplify it, decouple it or reduce the amount of code).
🔎 The preview has been automatically deleted.
What is this PR?
This PR adds support for
ElementInternals
. It makes our inputs (cc-input-text
,cc-input-number
,cc-input-date
,cc-select
) and our button (cc-button
) implement the ElementInternals API.With this PR you get the following improvements:
<form>
, they will behave like native HTML inputs.validationMessage
property that will be displayed below the input (and not as a native tooltip)customValidator
property that lets developers add their validation logiccustomErrorMessages
property that lets developers add their error messages and also, override default error messages.Also, it adds some utility codes that will make our lives better when dealing with forms inside high-level components:
<form>
submit event handler that handles all the logic on form submission (validation, error message display, focus)<form>
elementFinally, this PR contains modifications on 3 high-level components containing a form (
cc-email-list
,cc-orga-member-list
,cc-ssh-key-list
). It implements form management using this new framework.How to review?
After many in-sync meetings, you should have a good understanding of the key concepts manipulated in this PR.
Now,