I am trying to achieve the following: When a user enters a specific value, then additional fields are displayed, there the user can enter the values, also the values from this fields should be displayed when exporting the query to json.
I am passing this custom editor to controlElements={{ valueEditor: CustomValueEditor }} on <QueryBuilder /> and it adds these fields when the required values are specified. But I cannot get X, Y and Z when exporting.
const CustomValueEditor = (props: ValueEditorProps) => {
switch (props.value) {
case "3d":
return (
<div className='demo-space-x'>
<ValueEditor {...props} />
<input placeholder='X' />
<input placeholder='Y' />
<input placeholder='Z' />
</div>
)
case "2d":
return (
<div className='demo-space-x'>
<ValueEditor {...props} />
<input placeholder='X' />
<input placeholder='Y' />
</div>
)
default:
return <ValueEditor {...props} />
}
}
Here is how I specify a field that takes the value 2d or 3d.
{
name: 'system',
label: 'system',
inputType: 'string',
operators: [equal, notEqual, less, lessOrEqual, greater, greaterOrEqual],
}
I know that in the JQuery JavaScript version there is a ValueGetter and a ValueSetter, which greatly simplifies this task. How can I achieve this result in React Query Builder?
Thank you.