react-awesome-query-builder icon indicating copy to clipboard operation
react-awesome-query-builder copied to clipboard

Pass to MuiFieldSelect customProps not working

Open noam7700 opened this issue 1 year ago • 0 comments

Describe the bug I try to pass customProps to MuiFieldSelect from @react-awesome-query-builder/mui library to customize renderOperator. I want show operator options as LTR in my RTL MUI project.

Passing customProps to MuiFieldAutocomplete works.

To Reproduce For example, just trying to pass backgroundColor: yellow to customProps doesnt work:

// passing settings to config.
settings: {
    ...MuiConfig.settings,
    // customProps works for renderField, but not for renderOperator
    renderField: (fieldProps) => <MuiFieldAutocomplete {...fieldProps} customProps={{ style: { backgroundColor: 'yellow' } }} />, 
    renderOperator: (operatorProps) => <MuiFieldSelect {...operatorProps} customProps={{ style: { backgroundColor: 'yellow' } }} />,
}

As you can see, only renderField receive yellow color: image

Expected behavior Both MuiFieldSelect and MuiFieldAutocomplete declares that they receive FieldProps, but only MuiFieldAutocomplete uses customProps in it.

I see in implementation that MuiFieldAutocomplete does pass customProps (inside "rest"): https://github.com/ukrbublik/react-awesome-query-builder/blob/d17da0103e90c96d3aa081304129b2b355b89c9a/packages/mui/modules/widgets/core/MuiFieldAutocomplete.jsx#L39-L43

but in MuiFieldSelect the customProps is not deconstructed at all: https://github.com/ukrbublik/react-awesome-query-builder/blob/d17da0103e90c96d3aa081304129b2b355b89c9a/packages/mui/modules/widgets/core/MuiFieldSelect.jsx#L8-L11

noam7700 avatar Jan 22 '24 09:01 noam7700