Skip to content

feat(lstsv): map appearance columns-n to display_columns - #243

Merged
jstet merged 1 commit into
mainfrom
feat/display-columns-239
Nov 4, 2026
Merged

jstet merged 1 commit into
mainfrom
feat/display-columns-239

Conversation

@jstet

@jstet jstet commented Nov 4, 2026

Copy link
Copy Markdown
Member

Closes #239.

columns-n (and plain columns) on select_one / select_multiple now becomes LimeSurvey's display_columns question attribute on L and M questions, so a long option list is laid out in n columns. The way back reads display_columns=n as columns-n.

Design:

  • The count is part of the appearance name, so this is a pattern, not a registry allowlist entry. I kept it out of the registry (no schema or codegen change, no generic "attribute from appearance" mechanism for a single user) and put it in src/conventions/displayColumns.ts, which the appearance handler, the validator and the reverse path share. display_columns is added to ATTRIBUTE_COLUMNS.
  • Valid n is 1 to 8. LimeSurvey's attribute definition (questionHelper.php, inputtype columns, default 1) states no maximum; 8 is the largest count its column selector offers and the renderer just adds the class nbcol-n. Anything else (columns-0, columns-9) warns with the new code appearance-invalid-columns and writes nothing. columns-x stays appearance-unregistered.
  • Plain columns means "as many as fit" in ODK, which LimeSurvey cannot do, so it becomes 2 (and reads back as columns-2).
  • Precedence: an explicit column count wins over horizontal (the button theme is dropped, as a dropdown appearance already wins over it). A dropdown (minimal, autocomplete) has no columns: none is written. On other types columns-n warns appearance-invalid-for-type.
  • Not checked: how fruity_twentythree renders nbcol-n at phone width (no LimeSurvey instance used).

Before / After:

  • Before: columns-2 warned appearance-unregistered and was ignored.
  • After: columns-2 on a select gives display_columns=2; the TSV round-trips to columns-2.

Tests: new tests/ts/unit/displayColumns.test.ts (17: mapping for one/multiple/plain/n=8, no column when unused, invalid n, wrong type, horizontal precedence, dropdown, round trips) and a appearance-invalid-columns case in diagnosticCodes.test.ts. npm test: 1791 passed (109 files); npm run validate passes.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jstet
jstet merged commit 1ebe6a6 into main Nov 4, 2026
4 checks passed
@jstet jstet mentioned this pull request Nov 4, 2026
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.

xlsform2lstsv: map appearance columns-n to LimeSurvey display_columns

1 participant