Skip to content

feat(lstsv): appearance=autocomplete → searchable bootstrap_dropdown (#226) - #232

Merged
jstet merged 1 commit into
mainfrom
feat/searchable-dropdown-226
Nov 4, 2026
Merged

jstet merged 1 commit into
mainfrom
feat/searchable-dropdown-226

Conversation

@jstet

@jstet jstet commented Nov 4, 2026

Copy link
Copy Markdown
Member

Closes #226.

appearance=autocomplete on a select_one / select_one_from_file used to become a plain LimeSurvey dropdown (!). On a long list (12,000 Kommunen) the native select only jumps by first letter. LimeSurvey 5+ ships the core question theme bootstrap_dropdown for type !, and its show_search attribute adds a search box. The TSV import sets the theme from question_theme_name and stores the other extra columns as question attributes, so no plugin is needed.

Mechanism. A new registry Appearance field, lsQuestionTheme: {name, attributes?} (schema, codegen → APPEARANCES[*].lsQuestionTheme):

  • Forward: AppearanceHandler.themeAttributes() writes question_theme_name = name plus each attribute as a Q-row column, where validForTypes allows it. It applies together with lsTypeOverride.
  • Reverse: themedAppearanceOf() (new src/conventions/questionTheme.ts, shared with the reverse type resolver) reads a Q row back as the appearance whose theme and attributes match, and whose type matches lsTypeOverride if one is set. show_search counts as matching when it is true or 1. A ! row without that theme, or with bootstrap_dropdown but no show_search, stays minimal. This replaces the lsReverse: false flag, which is removed.
  • question_theme_name and show_search are added to ATTRIBUTE_COLUMNS. As before, they are written only when a row sets them. A test checks that every theme column the registry names is a TSV column.

#227 should reuse this mechanism: appearance:horizontal only needs "lsQuestionTheme": {"name": "bootstrap_buttons"} (plus any attributes, added to ATTRIBUTE_COLUMNS). The forward path, the reverse path and the column check work without code changes. An appearance with a theme and no lsTypeOverride reads back on the base type, if that type is in validForTypes.

minimal stays a plain !. The externalCodeList convention, the autocomplete lsEffect, the README and the lstsv2xlsform reverse table no longer say that LimeSurvey has no built-in search. The cdlvocab-<vocab> cssclass is now described as provenance only, not as a theme hook. DDI is unaffected: the appearance still goes out as cdl:appearance (autocomplete), and lstsv2ddi now reads it back as autocomplete instead of minimal.

Before (select_one land, appearance: autocomplete):

class=Q  type/scale=!  name=land  relevance=1  text=Land?  language=en  hide_tip=1

After:

class=Q  type/scale=!  name=land  relevance=1  text=Land?  language=en  hide_tip=1  question_theme_name=bootstrap_dropdown  show_search=true

Tests

  • New tests/ts/unit/questionTheme.test.ts (14 tests):
    • Forward, on select_one and select_one_from_file: autocomplete writes the theme, minimal writes no theme columns, minimal autocomplete writes the theme, and autocomplete on text writes no theme.
    • Registry-vs-columns check.
    • validateLstsvSubset accepts the TSV.
    • Reverse round trip: autocomplete stays autocomplete (both types) and minimal stays minimal. bootstrap_dropdown without show_search reads as minimal, show_search=1 reads as autocomplete, and another theme reads as minimal.
    • lstsv2ddi carries autocomplete.
  • longFileList.test.ts: the way back now reads autocomplete and minimal each as itself.
  • CLI pipeline test (xlsform2lstsv: long select_one_from_file lists lose their codes (no mapping) and render as an unusable radio list #188 long list): the Q row carries question_theme_name and show_search.
  • Live test test_long_file_list_dropdown_with_derived_codes: after import, LimeSurvey reports question_theme_name=bootstrap_dropdown and the attribute show_search=true. It was run against the compose stack (LimeSurvey 6.16.4) and passes.
  • npm test: 104 files and 1712 tests pass. npm run validate (lint, types, format, knip, dup, arch, markdownlint) is clean. uv run pytest (non-docker): 76 passed.

🤖 Generated with Claude Code

…226)

An appearance can now select a LimeSurvey question theme through a new
registry Appearance field, lsQuestionTheme {name, attributes?}: the name
goes to the Q row's question_theme_name, each attribute to a column of its
own. autocomplete on select_one / select_one_from_file becomes `!` +
question_theme_name=bootstrap_dropdown + show_search=true, LimeSurvey's core
searchable dropdown; minimal stays a plain `!`.

The way back reads a Q row whose theme and attributes match as that
appearance (show_search `1` or `true`); `!` without the theme stays
minimal. This replaces the lsReverse flag. The convention text no longer
says LimeSurvey has no built-in search, and the cdlvocab- cssclass is
described as provenance only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jstet
jstet marked this pull request as ready for review November 4, 2026 18:53
@jstet
jstet force-pushed the feat/searchable-dropdown-226 branch from 819ac4a to db98b66 Compare November 4, 2026 18:53
@jstet
jstet merged commit c0962eb into main Nov 4, 2026
4 checks passed
@jstet
jstet deleted the feat/searchable-dropdown-226 branch November 4, 2026 18:57
jstet added a commit that referenced this pull request Nov 4, 2026
…ion theme (#227)

horizontal and horizontal-compact on select_one use the registry's
lsQuestionTheme (#232): question_theme_name=bootstrap_buttons. The way back
reads the first registered appearance of a theme, horizontal. A theme that
doesn't override the type is kept only on a plain list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jstet added a commit that referenced this pull request Nov 4, 2026
…ion theme (#227) (#229)

horizontal and horizontal-compact on select_one use the registry's
lsQuestionTheme (#232): question_theme_name=bootstrap_buttons. The way back
reads the first registered appearance of a theme, horizontal. A theme that
doesn't override the type is kept only on a plain list.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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=autocomplete to LimeSurvey's searchable bootstrap_dropdown theme

1 participant