npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gw-query-builder

v0.0.25

Published

README.md

Readme

gw-query-builder

User-friendly React component to build queries.

Forked from https://github.com/fubhy/react-query-builder

Inspired by jQuery QueryBuilder

Using awesome Ant Design for widgets

Features

  • Highly configurable
  • Fields can be of type:
    • simple (string, number, bool, date/time/datetime, list)
    • structs (will be displayed in selectbox as tree of members)
    • custom type (dev should add its own widget component for this) (it's not complex, you can add slider for example)
  • Comparison operators can be:
    • binary (== != < > ..)
    • unary (is empty, is null)
    • 'between' (for numbers)
    • complex operators like 'proximity'
  • Values of fields can be compared with values -or- another fields (of same type)
  • Reordering support for rules and groups of rules
  • Using awesome Ant Design
  • Export to MongoDb or SQL
  • Basic/Advanced Query
  • Parameter for Each single Rule
  • Export Different QueryString( JS script, Huamn Readable String)
  • Export Parameterized Properties
  • Export ConfigGetter (Support 3 DataTypes (string,integer,boolean,object(nested object)) now. )
  • Export RuleOnly Feature ( specialized for Parameterized Feature )
  • Support GetFields By Json Schema

Install

Install: npm i gw-query-builder

See examples/demo as example of usage and configuration.

For full reordering support you need to add class query-builder-container for dom-element which is holding your querybuilder component AND has scrolling. If there is no such dom-element (only body) you can do nothing.

Use

import React, {Component} from 'react';
import {Query, Builder, Utils as QbUtils} from 'gw-query-builder';
import 'gw-query-builder/css/styles.scss';
import 'gw-query-builder/css/compact_styles.scss';
import 'gw-query-builder/css/denormalize.scss';
const fields=[
  {
    id:'Name',
    label:'Full name',
    dType: 'string'
  },
  {
    id:'Age',
    label:'Age',
    dType: 'integer'
  },
  {
    id:'Single',
    label:'Single',
    dType: 'boolean'
  }
];
// Json Schema Tool : https://jsonschema.net/
//or get fileds by json schema
// const schema="{
//   "definitions": {},
//   "$schema": "http://json-schema.org/draft-07/schema#",
//   "$id": "http://example.com/root.json",
//   "type": "object",
//   "title": "The Root Schema",
//   "required": [
//     "checked",
//     "id"
//   ],
//   "properties": {
//     "checked": {
//       "$id": "#/properties/checked",
//       "type": "boolean",
//       "title": "The Checked Schema",
//       "default": false,
//       "examples": [
//         false
//       ]
//     },
//     "id": {
//       "$id": "#/properties/id",
//       "type": "integer",
//       "title": "The Id Schema",
//       "default": 0,
//       "examples": [
//         1
//       ]
//     }
//   }
// }";
// const fields=QbUtils.getFields(JSON.parse(schema));
class DemoQueryBuilder extends Component {
    render() { 
      const config=QbUtils.configGetter(fields);               
        return (
            <div>
                <Query 
                  {...config} 
                  //you can pass object here, see treeJSON at onChange
                  //value=transit.fromJSON(treeJSON)
                  get_children={this.getChildren}
                  onChange={this.onChange}
                ></Query>
            </div>
        );
    }
    
    getChildren(props) {
        return (
            <div>
                <div className="query-builder">
                    <Builder {...props} 
                     queryType="advanced"
                     ruleOnly={false}
                    />
                </div>
                <div>Query string: {QbUtils.queryString(props.tree, props.config)}</div>
                <div>Mongodb query: {QbUtils.mongodbFormat(props.tree, props.config)}</div>
            </div>
        )
    }
    
    onChange(tree) {
      //here you can save tree object: 
      //var treeJSON = transit.toJSON(tree)
    }
}

Use can save tree as serialized Immutable object with transit.toJSON/transit.fromJSON -or- as plain JS, see loadTree = function(serTree) {...} at examples/demo/demo.js (using Immutable.fromJS with a little trick)

Development

To build the component locally, clone this repo then run:

npm install npm run examples

Then open localhost:3001 in a browser.

Scripts:

  • npm run build-npm - Builds a npm module. Output path: build/npm
  • npm run build-global - Builds with webpack the self contained pack of the component. Output path: build/global
  • npm run build-examples - Builds with webpack the examples. Output path: examples
  • npm run examples - Builds with webpack the examples and runs a dev-server on localhost:3001.
  • sh ./scripts/gh-pages.sh - Update gh pages

The repo sticks in general to the Airbnb JavaScript Style Guide.

Pull Requests are always welcomed :)

License

MIT. See also LICENSE.txt

S� �r�e�a�c�t�-�q�u�e�r�y�-�b�u�i�l�d�e�r� � �$� �r�e�a�c�t�-�q�u�e�r�y�-�b�u�i�l�d�e�r� � �#� �r�e�a�c�t�-�q�u�e�r�y�-�b�u�i�l�d�e�r� � �