Skip to content

Add library-specific props to compatibility components #304

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

Merged
merged 3 commits into from
May 19, 2022
Merged

Conversation

jakeboone02
Copy link
Member

@jakeboone02 jakeboone02 commented May 18, 2022

Fixes #289.

To use the extra props, spread the default props to the component and add any library specific props, like this:

import { AntDActionElement } from '@react-querybuilder/antd';
import { QueryBuilder, type ActionWithRulesProps } from 'react-querybuilder';

const MyActionElement = (props: ActionWithRulesProps) => (
  <AntDActionElement {...props} size="large" /> // `size` is from the 'antd' `Button` component
);

export const App = () => {
  return (
    <QueryBuilder
      controlElements={{
        addRuleAction: MyActionElement,
        addGroupAction: MyActionElement,
        cloneRuleAction: MyActionElement,
        cloneGroupAction: MyActionElement,
        lockRuleAction: MyActionElement,
        lockGroupAction: MyActionElement,
        removeRuleAction: MyActionElement,
        removeGroupAction: MyActionElement,
      }}
    />
  )
}

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 18, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 75e66f6:

Sandbox Source
react-querybuilder-ci Configuration

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #304 (75e66f6) into main (04d521b) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #304   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           60        60           
  Lines         1858      1911   +53     
  Branches       861       899   +38     
=========================================
+ Hits          1858      1911   +53     
Impacted Files Coverage Δ
packages/antd/src/AntDNotToggle.tsx 100.00% <ø> (ø)
packages/antd/src/AntDValueEditor.tsx 100.00% <ø> (ø)
packages/bulma/src/BulmaActionElement.tsx 100.00% <ø> (ø)
packages/chakra/src/ChakraValueEditor.tsx 100.00% <ø> (ø)
packages/material/src/MaterialValueEditor.tsx 100.00% <ø> (ø)
packages/antd/src/AntDActionElement.tsx 100.00% <100.00%> (ø)
packages/antd/src/AntDDragHandle.tsx 100.00% <100.00%> (ø)
packages/antd/src/AntDValueSelector.tsx 100.00% <100.00%> (ø)
packages/chakra/src/ChakraActionElement.tsx 100.00% <100.00%> (ø)
packages/chakra/src/ChakraDragHandle.tsx 100.00% <100.00%> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04d521b...75e66f6. Read the comment docs.

@jakeboone02 jakeboone02 merged commit 6aa7729 into main May 19, 2022
@jakeboone02 jakeboone02 deleted the extra-props branch May 19, 2022 06:46
Hamish-Blinx pushed a commit to Hamish-Blinx/react-querybuilder that referenced this pull request Aug 4, 2024
…ra-props

Add library-specific props to compatibility components
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

Successfully merging this pull request may close these issues.

Override Chakra UI component props
1 participant