Closed jakeboone02 closed 3 weeks ago
Description of the feature
Add baseField, baseOperator, baseCombinator object props that each respective object would be spread on to.
baseField
baseOperator
baseCombinator
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:
fields
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.
templateField
fieldTemplate
Type will probably be Record<string, undefined>.
Record<string, undefined>
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:
Internally, the
fields
array would be augmented something like this:So the
fields
prop would effectively be:Other prop name style possibilities:
templateField
,fieldTemplate
.Type will probably be
Record<string, undefined>
.