Repository navigation
feat: add conditional fields and more source variants to FormBuilder - #463
Open
danielo515 wants to merge 2 commits into
Open
danielo515 wants to merge 2 commits into
danielo515 wants to merge 2 commits into
Conversation
The programmatic FormBuilder API had a few gaps compared to what the form editor UI and schema already supported: - No way to attach a `condition` to a field, so there was no programmatic equivalent of "show this field only when another one is set" (Closes #385). - `select` was always `fixed`-source — no way to build a select whose options come from notes in a folder. - `multiselect` was always `fixed`-source — no way to build a multiselect whose options come from a Dataview query. - `addMultiselectNotesField` existed but had no short alias alongside the other `multiselect`/`select`/etc. shortcuts. Adds `condition` to the shared `FieldArgs` so every builder method forwards it, plus `addSelectFromNotesField`/`selectFromNotes`, `addMultiselectQueryField`/`multiselectQuery`, and a `multiselectNotes` shortcut. Refactors the existing methods to use a `...rest` spread so the new option flows through without changing their public signatures. https://claude.ai/code/session_011up9cgw8Q9B38umdVuonM9
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile SummaryThis PR expands the programmatic FormBuilder API to match existing form capabilities. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| src/core/FormBuilder.ts | Adds conditional fields and new select and multiselect variants while preserving schema-compatible field shapes. |
| src/core/FormBuilder.test.ts | Covers the new source variants, shorthand, defaults, and conditional-field output. |
Reviews (2): Last reviewed commit: "Merge branch 'master' into claude/lucid-..." | Re-trigger Greptile
This branch has not been deployed
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
Fills a few gaps in the programmatic
FormBuilderAPI so it matches what the form editor UI and schema already support:condition: input.Condition, so you can do:selectFromNotes({ name, folder })— previouslyselectwas locked to thefixedsource; this is the notes-backed variant.multiselectQuery({ name, query, allowUnknownValues? })— multiselect whose options come from a Dataview query (matchesMultiSelectQuerySchema).multiselectNotesshortcut —addMultiselectNotesFieldalready existed but had no short alias alongside the othermultiselect/select/etc. shortcuts. Now it does.Under the hood, the existing methods were refactored to use a
...restspread overFieldArgsso the newconditionoption flows through without changing their public signatures.Test plan
npm run build(lint + svelte-check + esbuild production bundle) passes — 0 errors, only pre-existing warningsnpm run test— 167 tests pass (was 159, +8 new), 2 pre-existing skippedmodalForms.builderwith.selectFromNotes(...),.multiselectQuery(...), and acondition:on a field to confirm the builtFormDefinitionshape opens without validation errorshttps://claude.ai/code/session_011up9cgw8Q9B38umdVuonM9