Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass to MuiFieldSelect customProps not working #1028

Open
noam7700 opened this issue Jan 22, 2024 · 0 comments
Open

Pass to MuiFieldSelect customProps not working #1028

noam7700 opened this issue Jan 22, 2024 · 0 comments

Comments

@noam7700
Copy link

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"):

const fieldAdapter = ({
items, selectedKey, setField, isValueField,
selectedLabel, selectedOpts, selectedAltLabel, selectedFullLabel,
...rest
}, config) => {

but in MuiFieldSelect the customProps is not deconstructed at all:

export default ({
items, setField, selectedKey, readonly, placeholder, errorText,
selectedLabel, selectedOpts, selectedAltLabel, selectedFullLabel,
}) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant