Skip to content

feat(forms): matrix field type — slice 9b#62

Merged
Musiker15 merged 1 commit into
mainfrom
feat/slice-9b-matrix
Jun 21, 2026
Merged

feat(forms): matrix field type — slice 9b#62
Musiker15 merged 1 commit into
mainfrom
feat/slice-9b-matrix

Conversation

@Musiker15

Copy link
Copy Markdown
Member

Second Phase 2 field-type slice — the matrix question (grid of sub-questions × shared choices).

Model

Rows are the sub-questions (new rows on the field spec), columns reuse the field's options, and the answer is a { rowId: columnValue } map.

Changes

  • sharedmatrixRowSchema + rows on formFieldSchema. buildAnswerSchema builds 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. formatAnswerValue renders "Row: Column; …".
  • webMatrixField table widget (one radio per row × column), wired into 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) plus a new Rows editor; DE/EN strings.
  • tests — matrix validation (required vs optional, unknown column) + formatter output (shared now 19 tests).

Validation

pnpm typecheck, pnpm lint, pnpm test, pnpm build — all green.

Follow-up in this slice: signature (9c).

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).
@Musiker15 Musiker15 merged commit cb5eedc into main Jun 21, 2026
3 checks passed
@Musiker15 Musiker15 deleted the feat/slice-9b-matrix branch June 21, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant