Feat DF-662: Allows new component to be added with minimal effort#1223
Merged
jbarnsley10 merged 5 commits intomainfrom Dec 5, 2025
Merged
Feat DF-662: Allows new component to be added with minimal effort#1223jbarnsley10 merged 5 commits intomainfrom
jbarnsley10 merged 5 commits intomainfrom
Conversation
…he component to be in preview or engine-plugin)
🧪 Acceptance Test Results❌ Some acceptance tests failed |
Closed
12 tasks
alexluckett
reviewed
Dec 4, 2025
Contributor
alexluckett
left a comment
There was a problem hiding this comment.
What an improvement! Nice work.
Can you put an updated step-by-step guide together?
| it('should update the List class when listeners are called', () => { | ||
| const preview = /** @type {ListSortableQuestion} */ ( | ||
| SetupPreview.ListSortable() | ||
| SetupPreview('ListSortable') |
Contributor
There was a problem hiding this comment.
enum here?
SetupPreview(PreviewTypes.ListSortable)
Contributor
Author
There was a problem hiding this comment.
This is from Chris' original implementation (and the 'Question' too).
Will see if it's easy to enum them both
Contributor
Author
There was a problem hiding this comment.
Ah, it's because he was using ComponentType for most apart from these two. Obvs we don;t want to add these two to ComponentType. I'll create a PreviewComponentType
| document.body.innerHTML = | ||
| questionDetailsLeftPanelHTML + questionDetailsPreviewHTML | ||
| const res = SetupPreview.Question() | ||
| const res = SetupPreview('Question') |
Contributor
There was a problem hiding this comment.
enum here?
SetupPreview(PreviewTypes.Question)
|
alexluckett
approved these changes
Dec 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



A new component can be added with minimal effort.
Originally, around 25 files needed to be change.
Now, only 6 files need to be changed.
There is also a small PR in forms-runner to handle components not yet setup in the preview DEFRA/forms-engine-plugin#274
Changes required in forms-designer to add a new component (this example uses 'UnicornField'):
model/src/components/enums.ts:
model/src/components/types.ts:
model/src/components/component-types.ts:
client/src/i18n/translations/en.translation.json:
model/src/form/form-editor/index.ts:
designer/server/src/models/forms/editor-v2/question-type.js: