Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add documentation for query tools
  • Loading branch information
jakeboone02 committed Jan 25, 2022
commit 4801436583435f59d0e78e1cbdda79cf9c7cd92c
15 changes: 13 additions & 2 deletions docs/api/misc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,18 @@ function convertQuery(query: RuleGroupTypeIC): RuleGroupType;

`convertToIC` and `convertFromIC` do the same thing as `convertQuery`, but only in one direction.

### Defaults
## Query tools

Several methods are available to assist with manipulation of query objects outside the context of the `<QueryBuilder />` component:

- `add` - adds a rule or group (and an independent combinator if necessary to keep the query valid)
- `remove` - removes a rule or group (and the previous independent combinator if one exists)
- `update` - updates a property of a rule or group, or updates an independent combinator
- `move` - moves (or clones, with new `id` and `path`) a rule or group to a new location in the query tree

These methods are used by the `<QueryBuilder />` component itself, so they are guaranteed to achieve the same result as a corresponding UI-based update.

## Defaults

The following default configuration objects are exported for convenience.

Expand All @@ -54,7 +65,7 @@ The following default configuration objects are exported for convenience.
- `defaultFields`
- `standardClassnames`

The following components are also exported:
The default components are also exported:

- `ActionElement` - used for action buttons (to add rules, remove groups, etc.)
- `DragHandle` - used for the drag handle on rules and group headers
Expand Down