Commit 6afcd61
committed
feature #378 Model rendering overhaul (weaverryan)
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
Model rendering overhaul
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | yes
| Tickets | None
| License | MIT
Hi!
tl;dr
```twig
BEFORE:
<input
data-model="firstName"
data-action="live#update"
>
AFTER:
<input
data-model="firstName"
>
```
This PR makes it so that you *only* need to use `data-model` to bind an input to a `LiveProp` on your component object. This also introduces:
A) **model modifiers** (e.g. `data-model="on(change)|norender|firstName"` to update the model on change and skip re-rendering)
B) **A new way to "opt in" to the `name` attribute being used in place of `data-model`**: you now add a `data-model` to the `form` tag surrounding your fields: `<form data-model"*">`.
All of this is explained more in the CHANGELOG and documentation.
The motivation behind this change was actually to fix a bug. If you typed into field (A), then quickly typed into field (B) before the re-render Ajax request finished from changing field (A), when that Ajax call *did* finish, it would "replace" your custom changes to field (B). Basically, what you just typed disappears. Fixing this meant making `live_controller.ts` listen to the `input` event in all situations and track "unsynced inputs". And since we were now listening to the `input` event all the time, it seemed logical to no longer require the user to do this manually with `data-action="live#update"`.
This PR also overhauls the test suite to make it *much* more readable and user friends 🌞 and also completes the conversion to TypeScript by removing all of the TS warnings.
Cheers!
Commits
-------
d3aaf4f Model rendering overhaulFile tree
43 files changed
+3305
-1785
lines changed- src
- Autocomplete/assets/dist
- Chartjs/Twig
- LiveComponent
- assets
- dist
- src
- test
- controller
- src
- Resources/doc
- tests/Functional/Form
- Notify/Twig
- ux.symfony.com
- bin
- templates/components
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
43 files changed
+3305
-1785
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
3 | 66 | | |
4 | 67 | | |
5 | 68 | | |
| |||
0 commit comments