Commit 7f82334
33971 task support field visibility and state management in bridge api (#35003)
This pull request adds robust show/hide field support to both Angular
and Dojo form bridges, enabling dynamic field visibility management in
forms. It introduces a standardized `show()` and `hide()` API for
fields, propagates visibility changes to the Angular state store, and
includes comprehensive tests to ensure correct behavior and error
handling. Additionally, it updates the UI to reflect field visibility
and improves documentation and type safety.
**Field Visibility API and Integration:**
* Added `show()` and `hide()` methods to the `FormFieldAPI` interface,
and implemented them in both `AngularFormBridge` and `DojoFormBridge` to
allow programmatic control of field visibility.
[[1]](diffhunk://#diff-9d724fb56dff8e4f9a22bc4a0963020c10c8964e1a0db7dc66de8cf1da373d92R39-R48)
[[2]](diffhunk://#diff-08b7f2dbb6ec1f4033d7a5801c7f63b080a8f9565b11c3f9b7c40ea512578e6fR249-R260)
[[3]](diffhunk://#diff-fe3a388c08be205717a8a85cc52f63bf2b3aacac655960871dc86e0276987e09R252-R275)
* In `AngularFormBridge`, introduced an optional
`onFieldVisibilityChange` callback, injected via the factory and used to
decouple field visibility changes from the store, enabling state updates
when fields are shown or hidden.
[[1]](diffhunk://#diff-08b7f2dbb6ec1f4033d7a5801c7f63b080a8f9565b11c3f9b7c40ea512578e6fR33-R46)
[[2]](diffhunk://#diff-08b7f2dbb6ec1f4033d7a5801c7f63b080a8f9565b11c3f9b7c40ea512578e6fR55-R70)
[[3]](diffhunk://#diff-7e7427e48350646c481f2a6d1653c32ba7e345af017115e8c16ae748689e1bfeL11-R26)
[[4]](diffhunk://#diff-7e7427e48350646c481f2a6d1653c32ba7e345af017115e8c16ae748689e1bfeL42-R55)
[[5]](diffhunk://#diff-cc87f031e0082ccc972a895afc5c910e3c87b060d93355eb7d757c25759d44a4L127-R137)
* Updated the Angular form bridge factory and the `NativeFieldComponent`
to pass and handle the `onFieldVisibilityChange` callback, ensuring
visibility changes are reflected in the Angular store.
[[1]](diffhunk://#diff-7e7427e48350646c481f2a6d1653c32ba7e345af017115e8c16ae748689e1bfeL11-R26)
[[2]](diffhunk://#diff-7e7427e48350646c481f2a6d1653c32ba7e345af017115e8c16ae748689e1bfeL42-R55)
[[3]](diffhunk://#diff-cc87f031e0082ccc972a895afc5c910e3c87b060d93355eb7d757c25759d44a4L127-R137)
**UI and Store Synchronization:**
* Modified form and field component templates to apply the `hidden`
class based on the field's visibility state from the store, ensuring the
UI reflects the correct visibility.
* Injected and mocked `DotEditContentStore` in relevant components and
tests to support and verify visibility state propagation.
[[1]](diffhunk://#diff-cc87f031e0082ccc972a895afc5c910e3c87b060d93355eb7d757c25759d44a4R63-R67)
[[2]](diffhunk://#diff-007f8368e1918a0e20d13e5200f1bd7b8959b0724e5f4835b2d976b317bd7b72R10-R11)
[[3]](diffhunk://#diff-007f8368e1918a0e20d13e5200f1bd7b8959b0724e5f4835b2d976b317bd7b72R25-R30)
[[4]](diffhunk://#diff-04465fbcea9c39bc66d73064e129700c837b5f08317a4fcab62e054b42d15665R13)
[[5]](diffhunk://#diff-04465fbcea9c39bc66d73064e129700c837b5f08317a4fcab62e054b42d15665R47-R52)
**Testing Enhancements:**
* Added comprehensive tests for the new `show()` and `hide()` methods in
both Angular and Dojo bridges, including error handling and NgZone
integration.
[[1]](diffhunk://#diff-56d79fca411f7de0eccc5e1f0b399892ecebc2c9a5148d75ebba52fa1f272639L371-R380)
[[2]](diffhunk://#diff-56d79fca411f7de0eccc5e1f0b399892ecebc2c9a5148d75ebba52fa1f272639R453-R530)
[[3]](diffhunk://#diff-d0fd14ebe4c48f46fc11d776a7a09ec7b511a7004d8aa03fc7731089e27c0334R250-R332)
**Documentation and Minor Fixes:**
* Improved documentation for the form bridge configuration and APIs,
clarifying the new callback and its usage.
* Fixed a minor typo in an event binding in the binary field wrapper.
* Updated CSS grid class for better layout consistency.
This PR fixes: #339711 parent 9ef6b36 commit 7f82334
19 files changed
Lines changed: 965 additions & 63 deletions
File tree
- .claude/skills/vtl-migration
- references
- core-web/libs
- edit-content-bridge/src/lib
- bridges
- factories
- interfaces
- edit-content/src/lib
- components
- dot-edit-content-field
- dot-edit-content-form
- fields/dot-edit-content-custom-field
- components/native-field
- store
- features
- content
- field-visibility
- dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
109 | 139 | | |
110 | 140 | | |
111 | 141 | | |
| |||
158 | 188 | | |
159 | 189 | | |
160 | 190 | | |
| 191 | + | |
| 192 | + | |
161 | 193 | | |
162 | 194 | | |
163 | 195 | | |
| |||
Lines changed: 187 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
36 | 56 | | |
37 | 57 | | |
38 | 58 | | |
| |||
283 | 303 | | |
284 | 304 | | |
285 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
286 | 359 | | |
287 | 360 | | |
288 | 361 | | |
| |||
464 | 537 | | |
465 | 538 | | |
466 | 539 | | |
| 540 | + | |
| 541 | + | |
467 | 542 | | |
468 | 543 | | |
469 | 544 | | |
| |||
495 | 570 | | |
496 | 571 | | |
497 | 572 | | |
| 573 | + | |
| 574 | + | |
498 | 575 | | |
499 | 576 | | |
500 | 577 | | |
| |||
516 | 593 | | |
517 | 594 | | |
518 | 595 | | |
| 596 | + | |
| 597 | + | |
519 | 598 | | |
520 | 599 | | |
521 | 600 | | |
| |||
565 | 644 | | |
566 | 645 | | |
567 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
568 | 661 | | |
569 | 662 | | |
570 | 663 | | |
| |||
978 | 1071 | | |
979 | 1072 | | |
980 | 1073 | | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
0 commit comments