Feel free to open PRs to fix bugs, add new features, add new reusable types/widgets/operators (eg., regex operator/widget, IP type/widget etc.). Pull Requests are always welcomed :)
We use pnpm. Please install pnpm:
npm install -g pnpm@9
Clone this repo, install deps with pnpm i.
Start with the demo app (with hot reload of demo code and local library code):
- Run
pnpm start. - Open
http://localhost:3001/in a browser.
Or with VSCode:
- Open
Run and Debugin VS Code - Run
Run examples - Run
Open Chrome with examples
packages/core/modules- Core functionality, does not depend from Reactpackages/sql/modules- SQL supportpackages/ui/modules- Core React componentsstores- Tree store reducer for Redux (reused fromcore)actions- Actions to dispatch on store (reused fromcore, addeddrag)config- Basic config with vanilla widgets (extends core config withfactorymethods to render UI components)hooks- Hooks. Contains useful hook for autocomplete for other UI frameworkscomponents- Core React componentsitem- Components representing building blocks of query - rule, group, more complex "rule-group" and switch/case (for ternary mode in SpEL)containers- Containers to support drag-n-dropoperators- Custom operators (proximity)rule- Components representing building blocks of rule - field, operator, widgetwidgets- Vanilla widgets - components to render list of fields, operators, values of different types
index.d.ts- TS definitions
packages/ui/styles- Styles for query builderpackages/antd- Provides config with Ant Design widgetspackages/mui- Provides config with MUI widgetspackages/material- Provides config with Material-UI v4 widgetspackages/bootstrap- Provides config with Bootstrap widgetspackages/fluent- Provides config with Fluent UI widgetspackages/examples- Demo app with hot reload of demo code and local library code, uses TS, uses complex config to demonstrate anvanced usage.src/demo- Advanced demosrc/demo_switch- Demo of ternary mode (switch/case)
packages/sandbox- Demo app with hot reload of only demo code (uses latest version of library from npm), uses TS, uses AntDesign widgets.packages/sandbox_simple- Demo app with hot reload of only demo code (uses latest version of library from npm), not uses TS, uses vanilla widgets.packages/sandbox_next- Demo app on Next.js with SSR, simple server-side query storage and exportpackages/tests- All tests are here. Uses Karma, Mocha, Chai, Enzyme
Useful scripts:
pnpm i- Install packages in all workspaces. Required for other scripts!pnpm start- Runexamplespnpm build- Build all packages and examplespnpm test- Run all tests with Karma and update coverage.pnpm test-dev- Run all tests with Karma in watch mode.pnpm test-debug- Run tests with Karma in watch & debug mode.pnpm test-debug --filter Validation WidgetsVanilla- Run only selected tests with Karma.pnpm lint- Run ESLint and TSC (in all workspaces)pnpm lint-fix- Run ESLint with--fixoption (in in all workspaces)pnpm clean- Clean all data that can be re-generated (likenode_modules,build,coverage)pnpm smoke- Run lint, test, build all packages and examples. Recommended before making PR
Currently there are 5 collections of widgets:
- vanilla widgets
- antdesign widgets
- material v4 widgets
- mui v5 widgets
- bootstrap widgets
- fluent widgets
Let's say you want to create new collection of widgets for new UI framework X to be used in this lib (and submit PR which is always welcomed!).
You can use any of this packages as a skeleton, eg. mui. I don't recommend to take antd as example as it's more complicated.
Create new package @react-awesome-query-builder/x in packages.
For a playground integrate it in examples - add to dependecies in package.json, paths in tsconfig.json, aliases in webpack.config.js, skinToConfig in config.tsx.
Take PR #727 to add Fluent UI widgets as an example.
See tests readme