Input losses antd compact style when using default ValueEditor
Closed this issue · 2 comments
Percivalll commented
React Query Builder version
v7.1.0
Platform
MacOS with Chrome
Description
When using controlElements to replace valueEditor, only the compact style of input losses.
Reproduction
import { QueryBuilderAntD } from '@react-querybuilder/antd';
import { useState } from 'react';
import type { Field, RuleGroupType } from 'react-querybuilder';
import { QueryBuilder, formatQuery,ValueEditor } from 'react-querybuilder';
import './styles.scss';
const fields: Field[] = [
{ name: 'firstName', label: 'First Name' },
{ name: 'lastName', label: 'Last Name' },
];
const initialQuery: RuleGroupType = {
combinator: 'and',
rules: [
{ field: 'firstName', operator: 'beginsWith', value: 'Stev' },
{ field: 'lastName', operator: 'in', value: 'Vai,Vaughan' },
],
};
export const App = () => {
const [query, setQuery] = useState(initialQuery);
return (
<div>
<QueryBuilderAntD>
<QueryBuilder fields={fields} query={query} onQueryChange={setQuery} controlElements={{valueEditor:ValueEditor}} />
</QueryBuilderAntD>
<h4>Query</h4>
<pre>
<code>{formatQuery(query, 'json')}</code>
</pre>
</div>
);
};
Expected behavior
No response
Additional information
No response
jakeboone02 commented
With controlElements={{ valueEditor: ValueEditor }}
, you're overriding the value editor assigned by QueryBuilderAntD
(AntDValueEditor
) with the basic default value editor. If you want the antd
controls then let the compatibility package assign them automatically.
Percivalll commented
Ohhhh!Thank you very much