feat(forms): matrix field type — slice 9b#62
Merged
Conversation
Matrix questions: rows are sub-questions, columns reuse the field's `options`,
and the answer is a `{ rowId: columnValue }` map.
- shared: `matrixRowSchema` + `rows` on the field spec; `buildAnswerSchema`
builds a per-row object schema (each row picks one column; rows required when
the field is required, validated against the column set); `formatAnswerValue`
renders "Row: Column" pairs.
- web: `MatrixField` table widget (one radio per row×column); wired in
`FieldInput`; `FieldValue` extended with the matrix map; `isEmpty` treats an
empty matrix object as unanswered. Builder offers the matrix type with a
columns editor (reused options) + a new rows editor; DE/EN strings.
- tests: matrix validation (required/optional, bad column) + formatter output.
Follow-up: signature (9c).
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.
Second Phase 2 field-type slice — the matrix question (grid of sub-questions × shared choices).
Model
Rows are the sub-questions (new
rowson the field spec), columns reuse the field'soptions, and the answer is a{ rowId: columnValue }map.Changes
matrixRowSchema+rowsonformFieldSchema.buildAnswerSchemabuilds a per-row object schema: each row must pick one of the columns; rows are required when the field is required, and values are validated against the column set.formatAnswerValuerenders "Row: Column; …".MatrixFieldtable widget (one radio per row × column), wired intoFieldInput;FieldValueextended with the matrix map;isEmptytreats an empty matrix object as unanswered. Builder offers the matrix type with a Columns editor (reused options) plus a new Rows editor; DE/EN strings.Validation
pnpm typecheck,pnpm lint,pnpm test,pnpm build— all green.Follow-up in this slice: signature (9c).