Conversation
|
Claude finished @nicobytes's task in 2m 38s —— View job Review
Overall: The design is sound. A few things worth flagging: 1. Warning suppression is too broad —
|
…e-management-in-bridge-api
There was a problem hiding this comment.
Pull request overview
Adds a standardized field show()/hide() API across the Angular and Dojo form bridges, with Angular store-backed visibility state and UI updates to reflect hidden fields.
Changes:
- Introduces
show()/hide()onFormFieldAPIand implements them in both Angular and Dojo bridges. - Adds a new edit-content store feature to track hidden fields and binds templates to that state via Tailwind’s
hiddenclass. - Adds/updates Jest tests to validate visibility behavior and error-handling.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/show_hide.vtl | Adds a sample/custom-field script and UI showing how to toggle visibility via Bridge API. |
| core-web/libs/edit-content/src/lib/store/features/field-visibility/field-visibility.feature.ts | Introduces a signal-store feature for hidden field tracking. |
| core-web/libs/edit-content/src/lib/store/features/field-visibility/field-visibility.feature.spec.ts | Adds unit tests for the new visibility feature behavior. |
| core-web/libs/edit-content/src/lib/store/edit-content.store.ts | Extends root state with hiddenFields and wires in the feature. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-custom-field/dot-edit-content-custom-field.component.spec.ts | Updates test setup to provide the store dependency used for visibility propagation. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-custom-field/components/native-field/native-field.component.ts | Passes onFieldVisibilityChange callback to bridge to write visibility changes to the store. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-custom-field/components/native-field/native-field.component.spec.ts | Updates test setup to provide the store dependency used by NativeFieldComponent. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.html | Applies hidden class based on store visibility and tweaks grid classes. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html | Fixes event binding typo for binary wrapper. |
| core-web/libs/edit-content-bridge/src/lib/interfaces/form-field.interface.ts | Extends the public field API with show()/hide(). |
| core-web/libs/edit-content-bridge/src/lib/factories/form-bridge.factory.ts | Adds optional onFieldVisibilityChange to Angular bridge config and forwards it to the bridge. |
| core-web/libs/edit-content-bridge/src/lib/bridges/dojo-form-bridge.ts | Implements show()/hide() by toggling the .field container display. |
| core-web/libs/edit-content-bridge/src/lib/bridges/dojo-form-bridge.spec.ts | Adds tests for Dojo show/hide behavior and error handling. |
| core-web/libs/edit-content-bridge/src/lib/bridges/angular-form-bridge.ts | Adds callback plumbing and implements show/hide via NgZone + callback. |
| core-web/libs/edit-content-bridge/src/lib/bridges/angular-form-bridge.spec.ts | Adds tests validating Angular show/hide and NgZone integration. |
You can also share your feedback on Copilot code review. Take the survey.
core-web/libs/edit-content-bridge/src/lib/bridges/angular-form-bridge.ts
Show resolved
Hide resolved
core-web/libs/edit-content/src/lib/store/features/field-visibility/field-visibility.feature.ts
Outdated
Show resolved
Hide resolved
core-web/libs/edit-content-bridge/src/lib/bridges/dojo-form-bridge.spec.ts
Show resolved
Hide resolved
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/show_hide.vtl
Outdated
Show resolved
Hide resolved
core-web/libs/edit-content-bridge/src/lib/bridges/angular-form-bridge.ts
Show resolved
Hide resolved
… console warnings for missing callbacks
… for NativeFieldComponent and AngularFormBridge
There was a problem hiding this comment.
Pull request overview
This PR extends the edit-content Bridge API to support programmatic field visibility via show() / hide() across Angular and Dojo bridges, and wires Angular visibility changes into the edit-content signals store so the form UI can reactively hide/show fields.
Changes:
- Added
show()/hide()toFormFieldAPIand implemented them inAngularFormBridgeandDojoFormBridge. - Introduced an edit-content store feature (
hiddenFields) and updated form templates to hide fields via Tailwind’shiddenclass. - Added/updated unit tests for bridges and the new store feature; included a sample VTL script demonstrating visibility toggling.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/show_hide.vtl | Adds an example custom-field script that toggles another field’s visibility via the Bridge API. |
| core-web/libs/edit-content/src/lib/store/features/field-visibility/field-visibility.feature.ts | New store feature to track hidden fields and expose setFieldVisibility/isFieldHidden/resetFieldVisibility. |
| core-web/libs/edit-content/src/lib/store/features/field-visibility/field-visibility.feature.spec.ts | Unit tests covering hidden field set behavior and resets. |
| core-web/libs/edit-content/src/lib/store/edit-content.store.ts | Extends store state with hiddenFields and registers the new feature. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-custom-field/dot-edit-content-custom-field.component.spec.ts | Mocks DotEditContentStore for custom-field tests due to new visibility wiring. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-custom-field/components/native-field/native-field.component.ts | Passes onFieldVisibilityChange to the bridge and updates the store on show/hide. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-custom-field/components/native-field/native-field.component.spec.ts | Tests that bridge show()/hide() calls propagate to store.setFieldVisibility(...). |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.html | Applies [class.hidden] based on store visibility and tweaks the grid auto-column class. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html | Fixes binary wrapper output binding to (valueUpdated). |
| core-web/libs/edit-content-bridge/src/lib/interfaces/form-field.interface.ts | Adds show() / hide() to the public field API interface. |
| core-web/libs/edit-content-bridge/src/lib/factories/form-bridge.factory.ts | Extends Angular bridge config to accept onFieldVisibilityChange and passes it through. |
| core-web/libs/edit-content-bridge/src/lib/bridges/dojo-form-bridge.ts | Implements DOM-based show/hide by toggling the nearest .field container display. |
| core-web/libs/edit-content-bridge/src/lib/bridges/dojo-form-bridge.spec.ts | Adds coverage for show/hide behaviors and improves console spy cleanup. |
| core-web/libs/edit-content-bridge/src/lib/bridges/angular-form-bridge.ts | Adds show/hide support via optional callback and introduces a one-time warning if missing. |
| core-web/libs/edit-content-bridge/src/lib/bridges/angular-form-bridge.spec.ts | Adds tests for show/hide callback behavior, warnings, and NgZone execution. |
You can also share your feedback on Copilot code review. Take the survey.
core-web/libs/edit-content-bridge/src/lib/bridges/angular-form-bridge.ts
Outdated
Show resolved
Hide resolved
…e-management-in-bridge-api
erickgonzalez
left a comment
There was a problem hiding this comment.
@nicobytes Let's add how to do this and how to migrate this from dojo in the doc we have and also the skill
…e-management-in-bridge-api
… for NativeFieldComponent and AngularFormBridge
…t-in-bridge-api' of github.com:dotCMS/core into 33971-task-support-field-visibility-and-state-management-in-bridge-api
… visibility and state control methods
…zation and update onChange method signature in AngularFormBridge
…turn a callback function
…r improved JSON serialization and update related tests
…e-management-in-bridge-api
…t-form and update AngularFormBridge to support reference counting for singleton instances
…t-in-bridge-api' of github.com:dotCMS/core into 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: #33971
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()andhide()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:
show()andhide()methods to theFormFieldAPIinterface, and implemented them in bothAngularFormBridgeandDojoFormBridgeto allow programmatic control of field visibility. [1] [2] [3]AngularFormBridge, introduced an optionalonFieldVisibilityChangecallback, injected via the factory and used to decouple field visibility changes from the store, enabling state updates when fields are shown or hidden. [1] [2] [3] [4] [5]NativeFieldComponentto pass and handle theonFieldVisibilityChangecallback, ensuring visibility changes are reflected in the Angular store. [1] [2] [3]UI and Store Synchronization:
hiddenclass based on the field's visibility state from the store, ensuring the UI reflects the correct visibility.DotEditContentStorein relevant components and tests to support and verify visibility state propagation. [1] [2] [3] [4] [5]Testing Enhancements:
show()andhide()methods in both Angular and Dojo bridges, including error handling and NgZone integration. [1] [2] [3]Documentation and Minor Fixes:
This PR fixes: #33971
This PR fixes: #33971