feat(form): expose form values + autocomplete hooks for custom dependent components#30
Open
stmh wants to merge 1 commit into
Open
feat(form): expose form values + autocomplete hooks for custom dependent components#30stmh wants to merge 1 commit into
stmh wants to merge 1 commit into
Conversation
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
Implements the four API extensions proposed in #29 so consumers can build custom dependent-autocomplete field components without forking the library.
flowdrop:getFormValuescontext inConfigForm.svelte— registered field components can read sibling form values to resolvedependencies.FormField.svelte— mirrors the existing branch inFormFieldLight.svelte, so custom components registered viafieldComponentRegistryget rendered in the full form too, withautocompleteanddependenciesprops forwarded.autocomplete/dependenciesprops forwarded inFormFieldLight.svelte— the registered-component branch now passes both through, matching the newFormFieldbranch.FieldSchema.dependenciestype added inform/types.ts—Record<string, string>mapping URL param → sibling field name.form/autocompletesubpath export — newsrc/lib/form/autocomplete.tsbarrel re-exportsFormAutocompleteso consumers can wrap it without reaching into private paths; corresponding entry added topackage.jsonexports.Together these are the minimum hooks needed for a downstream app to ship its own dependent-autocomplete field (e.g. an autocomplete whose query depends on the value of another field in the same form) using only public API.
Closes #29.
Test plan
prettier --checkon changed files (clean)svelte-checkon touched files (no new errors; one pre-existing error inPlayground.svelteis unrelated)getContext('flowdrop:getFormValues')and rendersFormAutocompletewithdependencies