-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor query builder state #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import type { FullField, FullOperator, GetOptionIdentifierType } from '@react-querybuilder/core'; | ||
| import type { Accessor } from 'solid-js'; | ||
| import type { QueryBuilderContextProps } from '../types/props.js'; | ||
| import type { MergedQueryBuilderConfig } from './context.js'; | ||
|
|
||
| /** | ||
| * Builds the value handed to `<QueryBuilderContext value={…}>` — the merged config, projected back | ||
| * into the context's own shape so nested builders inherit it. | ||
| * | ||
| * A getter object, not a memo returning a fresh object: a Solid context value is read once by | ||
| * descendants, so every field must be a getter or consumers freeze on the first value. | ||
| */ | ||
| export const createContextValue = <F extends FullField, O extends FullOperator>( | ||
| config: Accessor<MergedQueryBuilderConfig<F, GetOptionIdentifierType<O>>> | ||
| ): QueryBuilderContextProps<F, GetOptionIdentifierType<O>> => ({ | ||
| get controlElements() { | ||
| return config().controls; | ||
| }, | ||
| get controlClassnames() { | ||
| return config().classNames; | ||
| }, | ||
| get translations() { | ||
| return config().translations; | ||
| }, | ||
| get debugMode() { | ||
| return config().debugMode; | ||
| }, | ||
| get enableMountQueryChange() { | ||
| return config().enableMountQueryChange; | ||
| }, | ||
| get showCombinatorsBetweenRules() { | ||
| return config().showCombinatorsBetweenRules; | ||
| }, | ||
| get showNotToggle() { | ||
| return config().showNotToggle; | ||
| }, | ||
| get showShiftActions() { | ||
| return config().showShiftActions; | ||
| }, | ||
| get showUndoRedo() { | ||
| return config().showUndoRedo; | ||
| }, | ||
| get showCloneButtons() { | ||
| return config().showCloneButtons; | ||
| }, | ||
| get showLockButtons() { | ||
| return config().showLockButtons; | ||
| }, | ||
| get showMuteButtons() { | ||
| return config().showMuteButtons; | ||
| }, | ||
| get resetOnFieldChange() { | ||
| return config().resetOnFieldChange; | ||
| }, | ||
| get resetOnOperatorChange() { | ||
| return config().resetOnOperatorChange; | ||
| }, | ||
| get autoSelectField() { | ||
| return config().autoSelectField; | ||
| }, | ||
| get autoSelectOperator() { | ||
| return config().autoSelectOperator; | ||
| }, | ||
| get autoSelectValue() { | ||
| return config().autoSelectValue; | ||
| }, | ||
| get addRuleToNewGroups() { | ||
| return config().addRuleToNewGroups; | ||
| }, | ||
| get listsAsArrays() { | ||
| return config().listsAsArrays; | ||
| }, | ||
| get suppressStandardClassnames() { | ||
| return config().suppressStandardClassnames; | ||
| }, | ||
| }); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.