Add `baseField`, `baseOperator`, `baseCombinator` object props
Closed this issue · 0 comments
jakeboone02 commented
Description of the feature
Add baseField
, baseOperator
, baseCombinator
object props that each respective object would be spread on to.
Use case
Allow users to define properties common to all similar objects, overridable by the standard, existing configurations.
Usage:
<QueryBuilder
baseField={{ datatype: 'string' }}
fields={[
{ name: 'f1', label: 'F1' },
{ name: 'f2', label: 'F2', datatype: 'number' },
]}
/>
Internally, the fields
array would be augmented something like this:
const fields = props.fields.map(f => ({ ...props.baseField, ...f }));
So the fields
prop would effectively be:
[
{ name: 'f1', label: 'F1', datatype: 'string' },
{ name: 'f2', label: 'F2', datatype: 'number' },
]
Other prop name style possibilities: templateField
, fieldTemplate
.
Type will probably be Record<string, undefined>
.