Repository navigation
feat(dialogs): add multi-select columns - #90
Merged
Merged
Conversation
A select column may now declare `multiple`. Space ticks the option under the bar without reaching the filter, ticks are kept per column by the path of option indices that opened it, and pre-ticks declared with `selected: true` seed a column the first time it opens. A pre-tick outside a multiple column is rejected before anything is drawn, at every reachable depth, by both the function form and the embedded component. Every result now carries `selected`: the ticks of every open column, left to right and in supplied order, or the completing option's value alone when none is ticked. A multiple column draws a tick cell at the start of every row, reserved before the width is split, and its hint names `Space tick`. Test doubles that construct a `SelectResult` fill the new field.
Every Multi-Select scenario runs through `select`, alongside ticking and submission through an embedded `Select` in a host session, the hint naming `Space tick` only in a multiple column, the tick cell under the cursor bar and offsetting a header, and the default theme drawing it as `marker`. The grid is confirmed to declare no multiple column and to map back the completing row alone, and the published consumer fixture builds a multiple request and reads `selected`.
`bun run demo multiple` shows a ticking root column with one host opening ticked, and a region column it opens that ticks as well, so a single answer can carry ticks from both. The help text says how Space and Enter behave in such a column, and the catalogue tests check that no scenario pre-ticks outside a column that ticks.
The plugin guide's dialogs section gains a section on ticking several options: the per-column `multiple` setting, the pre-tick and where it is accepted, Space, the tick cell, the `selected` list on every result, and that a test double constructing a `SelectResult` now fills it. The dialogs spec marks Multi-Select implemented with a changelog row, and the change is complete in its document and the docs index.
There was a problem hiding this comment.
🟡 Changes recommended
The contract and plugin-guide documentation currently contains wording that can mislead consumers about when SelectOption.selected is permitted (it’s selected: true that requires multiple, not the field itself).
2 open issues
What changed in this PR
Adds per-column multi-select support to the dialogs select UI and contract, including ticking behavior (Space), result shape changes (SelectResult.selected), and corresponding documentation/demo/test updates.
Changes:
- Extend the published dialogs contract with
SelectRequest.multiple,SelectOption.selected, and requiredSelectResult.selected. - Implement tick state management in the dialogs select view (per-column path keying), Space-to-tick behavior, hint updates, and tick-cell rendering.
- Add broad test coverage (new multi-select test suite + updates to existing tests) and update docs/change tracking + demo scenario.
| File | Description |
|---|---|
| test/plugin-consumer.test.ts | Updates consumer fixture to exercise multiple requests and read result.selected. |
| test/grid-select.test.ts | Adds regression coverage that grid→dialogs mapping never declares multi-select and ignores selected when mapping back. |
| test/dialogs-plugin.test.ts | Updates expected SelectResult shapes to include required selected. |
| test/dialogs-multi-select.test.ts | New end-to-end multi-select test suite (function form + embedded Select + presentation assertions). |
| test/dialogs-embedded.test.ts | Updates embedded dialog component expectations to include selected. |
| test/demo.test.ts | Updates demo output expectations to include selected; adds terminal-driven multi-select scenario assertion. |
| test/demo-scenarios.test.ts | Updates demo stubs/results for selected; adds assertions for pre-tick placement and multi-select scenario properties. |
| plugins/dialogs/select.ts | Implements ticking, tick storage keyed by column path, Space handling, hint logic, and selected computation on completion paths. |
| plugins/dialogs/index.ts | Adds request validation for invalid pre-ticks and wires multiple into SelectViewRequest. |
| plugins/dialogs/contract.ts | Updates published types/docs for multiple, selected pre-tick, and required SelectResult.selected. |
| plugins/dialogs/columns.ts | Adds tick glyphs/cell layout and rendering support for ticking columns. |
| docs/specs/dialogs/index.md | Marks multi-select implemented and documents behavior, plus changelog entry. |
| docs/manual/plugins.md | Updates plugin guide to document multiple, ticking, and selected results. |
| docs/index.yml | Marks change 0037 as complete. |
| docs/index.md | Marks change 0037 as complete in the docs index table. |
| docs/changes/0037-add-multi-select.md | Marks change complete and checks off tracked tasks. |
| demo/scenarios.ts | Adds a multiple demo scenario and updates help text to mention ticking. |
| demo/index.ts | Documents the new demo multiple scenario in the top-level demo help comment. |
Review effort: Lite
Three embedded-component tests flipped a host's state to make a component active, waited a fixed few milliseconds, and pressed a key. On a loaded runner the activated render may not have committed by then, so the component's input subscription is still off, the key is dropped, and the test times out waiting for a callback. Each host now records, in an effect, that the active render committed, and the test waits for that instead. The host is the root and a parent's effects run after its children's, so once it reports the commit the component's input subscription exists. Where the fixed pause also gave a differing frame time to appear, it stays after the wait. No assertion changed.
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.

Summary
A select column can now declare
multiple: true. In such a column, Space ticks the option under the bar instead of reaching the filter, and Enter takes every tick. Options can be pre-ticked withselected: true, which is accepted only in a multiple column and rejected at any depth anywhere else. The function form and the embeddedSelectshare this validation.Every
SelectResultnow carriesselected. It holds the ticked values of every column open at completion, left to right and in supplied order within each column, including ticked options the filter hides. When none of those columns holds a tick, it holds the completing option's value alone, so a dialog with no multiple column always resolves[value].valueandvalueskeep their meaning, and a ticked option's fields are never collected.Spec: Dialogs: Multi-Select. Change: 0037 Add Multi-Select.
Changes
plugins/dialogs/contract.ts:SelectRequest.multiple,selectedon the option base, andSelectResult.selectedplugins/dialogs/index.ts: a pre-tick validation with its cycle guard keyed on the request, run by bothselectandSelectplugins/dialogs/select.ts: ticks kept in a ref beside the stack, keyed by the path of option indices that opened each column, so two options sharing a sub-request do not share ticks and a re-opened column keeps its ticks. Pre-ticks seed a column when it first opens. Space is handled before the filter edit (exactly" "with no ctrl or meta). The hint showsSpace tick.selectedis computed on plain Enter, on a finished field collection, and on a submitted text leafplugins/dialogs/columns.ts: a■/□tick cell at the start of every row of a multiple column, reserved before the width is split. It is drawn asmarker, and ascursorunder the bar. The header row is offset by the same two columnsmultipleand maps back only the completing rowSelectResultnow fillselected. The demo's JSON output gains the fieldtest/dialogs-multi-select.test.tscovers every Multi-Select scenario throughselect, plus ticking and submission through an embeddedSelectin a host session, the hint, the tick cell geometry, and the theme variabledemo multiplescenario; the plugin guide gains "Tick several options"; the spec, change doc, and docs index are marked completeTest plan
bun run checkpasses (Biome,tsc,bun testat 100% statement, function, and line coverage, and the build)bun test test/dialogs-multi-select.test.tspasses, with one test named after each Multi-Select scenariobun test test/grid-select.test.tspasses, including "what a grid leaves to multi-select"bun test test/plugin-consumer.test.tspasses with the packed consumer building amultiplerequest and readingselectedbun test test/demo.test.ts test/demo-scenarios.test.tspasses, including themultiplescenario reportingselected: ["beta"]grep -c '\- \[ \]' docs/changes/0037-add-multi-select.mdprints0, anddocs/index.ymllists 0037 ascomplete