Skip to content

Commit 2c0e2a7

Browse files
committed
Freeze v4.5.2 documentation
1 parent e92e80a commit 2c0e2a7

23 files changed

+3312
-69
lines changed

docs/api/querybuilder.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,9 @@ Pass `true` to display a drag handle to the left of each group header and rule.
770770

771771
:::caution
772772

773-
`react-querybuilder` uses [`react-dnd`](https://react-dnd.github.io/react-dnd/) to enable drag-and-drop features. If your application already uses `react-dnd`, you should import and render `<QueryBuilderWithoutDndProvider />` instead of `<QueryBuilder />`. They are functionally the same, but the former will rely on your pre-existing `DndProvider` wrapper while the latter implements its own and will clash with a separate `DndProvider` higher up in the component tree (the error will typically look like this: "Cannot have two HTML5 backends at the same time.").
773+
Drag-and-drop features are only enabled when `<QueryBuilder />` is imported from the companion package [`@react-querybuilder/dnd`](https://www.npmjs.com/package/@react-querybuilder/dnd). [`react-dnd`](https://www.npmjs.com/package/react-dnd) and [`react-dnd-html5-backend`](https://www.npmjs.com/package/react-dnd-html5-backend) will also need to be installed.
774+
775+
If your application already uses [`react-dnd`](https://react-dnd.github.io/react-dnd/), you should import and render `<QueryBuilderWithoutDndProvider />` instead of `<QueryBuilder />`. They are functionally the same, but the former will rely on your pre-existing `<DndProvider />` wrapper while the latter implements its own and will clash with a separate `<DndProvider />` higher up in the component tree (the error will typically look like this: "Cannot have two HTML5 backends at the same time.").
774776

775777
:::
776778

docusaurus.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ const config = {
9494
position: "right",
9595
},
9696
// {to: '/blog', label: 'Blog', position: 'right'},
97+
{
98+
type: "docsVersionDropdown",
99+
position: "right",
100+
},
97101
{
98102
href: "https://github.com/react-querybuilder/react-querybuilder",
99103
"aria-label": "GitHub repository",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:::info
2+
3+
Please refer to the [TypeScript](../typescript) page for information about the types and interfaces referenced below.
4+
5+
:::
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
title: CSS classes
3+
hide_table_of_contents: true
4+
description: Visual guide to CSS classes for each component element
5+
---
6+
7+
The `<QueryBuilder />` component assigns [standard classes](./misc#defaults) to each element. In the (fully operational) query builder below, the `title` and `label` for each element have been set to the element's standard class.
8+
9+
The following standard classnames are not visible below:
10+
11+
- `.queryBuilder` (black outline; the outer-most `<div>`)
12+
- `.ruleGroup` (maroon outline)
13+
- `.ruleGroup-header` (purple outline)
14+
- `.ruleGroup-body` (blue outline)
15+
- `.rule.queryBuilder-disabled` (gray outline for locked/disabled rules)
16+
- `.rule.queryBuilder-valid` (green outline for valid rules)
17+
- `.rule.queryBuilder-invalid` (red outline for invalid rules)
18+
- `.dndDragging` (applied to "preview" element while dragging)
19+
- `.dndOver` (applied to "hovered over" element while dragging)
20+
21+
import { QueryBuilderEmbed } from '@site/src/components/QueryBuilderEmbed';
22+
import { standardClassnames as sc } from 'react-querybuilder';
23+
24+
<QueryBuilderEmbed
25+
showNotToggle
26+
showCloneButtons
27+
showLockButtons
28+
enableDragAndDrop
29+
fields={[
30+
{
31+
name: 'f1',
32+
label: `.${sc.fields}`,
33+
defaultValue: 'This rule is valid',
34+
validator: () => true,
35+
},
36+
{
37+
name: 'f2',
38+
label: `.${sc.fields}`,
39+
defaultValue: 'This rule is invalid',
40+
validator: () => false,
41+
},
42+
{
43+
name: 'f3',
44+
label: `.${sc.valueSource}`,
45+
valueSources: ['value', 'field'],
46+
},
47+
{
48+
name: 'fb1',
49+
label: `Value list`,
50+
operators: [{ name: 'between', label: 'between' }],
51+
valueSources: ['field', 'value'],
52+
comparator: f => f.name === 'fb2',
53+
},
54+
{
55+
name: 'fb2',
56+
label: `.${sc.valueListItem}`,
57+
},
58+
]}
59+
combinators={[{ name: 'and', label: `.${sc.combinators}` }]}
60+
getOperators={() => [{ name: '=', label: `.${sc.operators}` }]}
61+
controlClassnames={{
62+
queryBuilder: 'rqb-structure',
63+
}}
64+
translations={{
65+
fields: {
66+
title: `.${sc.fields}`,
67+
},
68+
operators: {
69+
title: `.${sc.operators}`,
70+
},
71+
value: {
72+
title: `.${sc.value}`,
73+
},
74+
removeRule: {
75+
label: `.${sc.removeRule}`,
76+
title: `.${sc.removeRule}`,
77+
},
78+
removeGroup: {
79+
label: `.${sc.removeGroup}`,
80+
title: `.${sc.removeGroup}`,
81+
},
82+
addRule: {
83+
label: `.${sc.addRule}`,
84+
title: `.${sc.addRule}`,
85+
},
86+
addGroup: {
87+
label: `.${sc.addGroup}`,
88+
title: `.${sc.addGroup}`,
89+
},
90+
combinators: {
91+
title: `.${sc.combinators}`,
92+
},
93+
notToggle: {
94+
label: `.${sc.notToggle}`,
95+
title: `.${sc.notToggle}`,
96+
},
97+
cloneRule: {
98+
label: `.${sc.cloneRule}`,
99+
title: `.${sc.cloneRule}`,
100+
},
101+
cloneRuleGroup: {
102+
label: `.${sc.cloneGroup}`,
103+
title: `.${sc.cloneGroup}`,
104+
},
105+
dragHandle: {
106+
label: `.${sc.dragHandle}`,
107+
title: `.${sc.dragHandle}`,
108+
},
109+
lockRule: {
110+
label: `.${sc.lockRule}`,
111+
title: `.${sc.lockRule}`,
112+
},
113+
lockGroup: {
114+
label: `.${sc.lockGroup}`,
115+
title: `.${sc.lockGroup}`,
116+
},
117+
lockRuleDisabled: {
118+
label: `.${sc.lockRuleDisabled}`,
119+
title: `.${sc.lockRuleDisabled}`,
120+
},
121+
lockGroupDisabled: {
122+
label: `.${sc.lockGroupDisabled}`,
123+
title: `.${sc.lockGroupDisabled}`,
124+
},
125+
valueSourceSelector: {
126+
title: `.${sc.valueSource}`,
127+
},
128+
}}
129+
defaultQuery={{
130+
combinator: 'and',
131+
rules: [
132+
{ field: 'f1', operator: '=', value: `.${sc.value}` },
133+
{
134+
combinator: 'and',
135+
rules: [
136+
{ field: 'f1', operator: '=', value: 'This rule is valid' },
137+
{ field: 'f2', operator: '=', value: 'This rule is invalid' },
138+
{
139+
disabled: true,
140+
combinator: 'and',
141+
rules: [
142+
{
143+
field: 'f1',
144+
operator: '=',
145+
value: `This rule's group is disabled, therefore this rule is also disabled`,
146+
},
147+
],
148+
},
149+
],
150+
},
151+
{ field: 'f3', operator: '=', value: 'f1' },
152+
{ field: 'fb1', operator: 'between', value: 'fb2,fb2', valueSource: 'field' },
153+
],
154+
}}
155+
/>

0 commit comments

Comments
 (0)