All Projects → niklr → angular-query-builder

niklr / angular-query-builder

Licence: MIT license
Dynamic query building UI written in Angular and Bootstrap. https://niklr.github.io/angular-query-builder

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to angular-query-builder

Search Dialog
An easy to use, yet very customizable search dialog
Stars: ✭ 503 (+724.59%)
Mutual labels:  search-interface
Awesome Solr
A curated list of Awesome Apache Solr links and resources.
Stars: ✭ 69 (+13.11%)
Mutual labels:  search-interface
Structured Filter
jQuery UI widget for structured queries like "Contacts where Firstname starts with A and Birthday before 1/1/2000 and State in (CA, NY, FL)"...
Stars: ✭ 213 (+249.18%)
Mutual labels:  search-interface
Envtool
Utility to check and search along environment variables. Or where Python/Cmake/Man-pages/pkg-modules/VCPKG-packages are located.
Stars: ✭ 10 (-83.61%)
Mutual labels:  search-interface
Typesense Instantsearch Adapter
A JS adapter library to build rich search interfaces with Typesense and InstantSearch.js
Stars: ✭ 56 (-8.2%)
Mutual labels:  search-interface
Xinahn Client
一个开源,高隐私,自架自用的聚合搜索引擎。https://xinahn.com
Stars: ✭ 116 (+90.16%)
Mutual labels:  search-interface
Open Semantic Search
Open Source research tool to search, browse, analyze and explore large document collections by Semantic Search Engine and Open Source Text Mining & Text Analytics platform (Integrates ETL for document processing, OCR for images & PDF, named entity recognition for persons, organizations & locations, metadata management by thesaurus & ontologies, search user interface & search apps for fulltext search, faceted search & knowledge graph)
Stars: ✭ 386 (+532.79%)
Mutual labels:  search-interface
KatSearch
Fast, simple, powerful filesystem search for macOS, just like the good ol' days.
Stars: ✭ 86 (+40.98%)
Mutual labels:  search-interface
Search View Layout
Material Design Search View Layout, now implemented in Google Maps, Dialer, etc
Stars: ✭ 1,107 (+1714.75%)
Mutual labels:  search-interface
Recoll Webui
web interface for recoll desktop search
Stars: ✭ 204 (+234.43%)
Mutual labels:  search-interface
Kowl
Apache Kafka Web UI for exploring messages, consumers, configurations and more with a focus on a good UI & UX.
Stars: ✭ 1,036 (+1598.36%)
Mutual labels:  search-interface
Open Semantic Search Apps
Python/Django based webapps and web user interfaces for search, structure (meta data management like thesaurus, ontologies, annotations and named entities) and data import (ETL like text extraction, OCR and crawling filesystems or websites)
Stars: ✭ 55 (-9.84%)
Mutual labels:  search-interface
Instantsearch Android
A library of widgets and helpers to build instant-search applications on Android.
Stars: ✭ 129 (+111.48%)
Mutual labels:  search-interface
Ransack
Object-based searching.
Stars: ✭ 5,020 (+8129.51%)
Mutual labels:  search-interface
google-it-telegram-bot
🤖 @Google_itBot 🔎 Search and share LINKS/IMAGES/VIDEOS in inline mode
Stars: ✭ 40 (-34.43%)
Mutual labels:  search-interface
Instantsearch Ios
⚡️ A library of widgets and helpers to build instant-search applications on iOS.
Stars: ✭ 498 (+716.39%)
Mutual labels:  search-interface
Search Ui
Search UI. Libraries for the fast development of modern, engaging search experiences.
Stars: ✭ 1,294 (+2021.31%)
Mutual labels:  search-interface
search-ui
JavaScript library to develop Search UIs for the web
Stars: ✭ 16 (-73.77%)
Mutual labels:  search-interface
AzSearchStore
A UI state management library to build js apps against Azure Search
Stars: ✭ 23 (-62.3%)
Mutual labels:  search-interface
Search Query Parser
A simple parser for advanced search query syntax
Stars: ✭ 180 (+195.08%)
Mutual labels:  search-interface

Angular Query Builder

Demo: http://niklr.github.io/angular-query-builder

This is a sample HTML / JavaScript application that demonstrates how to use AngularJS in combination with Bootstrap to create a dynamic query building web user interface.

The project was inspired by: https://github.com/mfauveau/angular-query-builder

Additional features:

  • Autocomplete based on selected options implemented with Bootstrap's typeahead plugin.
  • Dynamic source fields based on selected source types.
  • Dynamic comparison operators based on selected source field.
  • Nested form validation.
  • Configurable maximum for groups and conditions.
  • Fancy enter and leave animations for groups and conditions.

Table of Content

Dependencies

Basic setup

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Angular Query Builder</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="libraries/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="libraries/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="main.css" rel="stylesheet">
</head>
<body ng-app="app">
    <div ng-controller="MainController">
        <div class="aqb-search-form">
            <form name="searchForm" ng-submit="search(searchForm, $event)">
                <div class="aqb-search-form-body">
                    <div class="aqb-animate-combined" ng-repeat="group in searchContainer.groups | orderBy:'index'">
                        <div search-group
                                search-container="searchContainer"
                                groups="searchContainer.groups"
                                group-index="$index"
                                source-types="sourceTypes"
                                logical-operators="logicalOperators"></div>
                    </div>
                </div>
                <div class="aqb-search-form-footer">
                    <button type="submit" class="btn" ng-disabled="searchForm.$invalid">Search</button>
                </div>
            </form>
        </div>
        <div>
            <pre>{{jsonOutput}}</pre>
        </div>        
    </div>

    <script src="libraries/jquery/jquery.js"></script>
    <script src="libraries/bootstrap/js/bootstrap.js"></script>
    <script src="libraries/angular/angular.js"></script>
    <script src="libraries/angular/angular-animate.js"></script>
    <script src="libraries/underscore/underscore.js"></script>
    <script src="js/angular-query-builder-templates.min.js"></script>
    <script src="js/angular-query-builder.min.js"></script>
    <script src="main.js"></script>

</body>
</html>

main.js

angular.module('app', [
    'angular-query-builder'
])

.controller('MainController', ['$scope', 'AppConfig', function ($scope, AppConfig) {

    AppConfig.setMaxGroups(4);
    AppConfig.setMaxConditions(4);

    $scope.jsonOutput = {};

    $scope.search = function (form, $event) {
        $scope.jsonOutput = JSON.stringify($scope.searchContainer, null, 4);
    };

    $scope.sourceTypes = [
        {
            "name": "Objects",
            "displayName": "Objects",
            "sourceFields": [
                {
                    "name": "ObjectId",
                    "displayName": "Id",
                    "comparisonOperators": [
                        {
                            "name": "Equals",
                            "displayName": "="
                        },
                        {
                            "name": "NotEquals",
                            "displayName": "!="
                        }
                    ]
                }
            ],
        }
    ];

    $scope.logicalOperators = [
        {
            "name": "And",
            "displayName": "AND"
        },
        {
            "name": "Or",
            "displayName": "OR"
        }
    ];

    var defaultSearchContainer = {
        "groups": [
            {
                "sourceType": {
                    "name": "Objects",
                    "displayName": "Objects"
                },
                "logicalOperator": {
                    "name": "And",
                    "displayName": "AND"
                },                
                "conditions": [
                    {}
                ]
            }
        ]
    };
    $scope.searchContainer = defaultSearchContainer;
}]);

Configuration

  • AppConfig.setMaxGroups Sets the maximum amount of groups the user is able to create.
  • AppConfig.setMaxConditions Sets the maximum amount of conditions the user is able to create.

Terminology

Angular Query Builder differentiates between SearchContainer, Group, Condition, SourceType, SourceField, ComparisonOperator, LogicalOperator and InputItem. Each object can be dynamically defined within the $scope of the AngularJS controller.

  • SearchContainer can contain one or multiple Group.
  • Group consists of a SourceType, LogicalOperator and one or multiple Condition.
  • Condition consists of a SourceField, ComparisonOperator and an InputItem.
  • SourceType basically represents the source to be searched. It is possible to define multiple SourceType but in most cases one is sufficient. The SourceType object consists of the following keys:
    • name is a string
    • displayName is a string
    • sourceFields is an array of SourceField objects
  • SourceField defines the available options for the first dropdown element of each Condition. The SourceField object consists of the following keys:
    • name is a string
    • displayName is a string
    • comparisonOperators is an array of ComparisonOperator objects
  • ComparisonOperator defines the available options for the second dropdown element of each Condition. The ComparisonOperator object consists of the following keys:
    • name is a string
    • displayName is a string
  • LogicalOperator defines how each Condition in a Group should be logically connected. The LogicalOperator object consists of the following keys:
    • name is a string
    • displayName is a string
  • InputItem contains the data entered by the user. The InputItem object consists of the following keys:
    • data is a string
    • displayName is a string

Building

In order to build Angular Query Builder, ensure that you have Git and Node.js installed.

Clone a copy of the repo:

git clone https://github.com/niklr/angular-query-builder.git

Change to the angular-query-builder directory:

cd angular-query-builder

Install Grunt and dev dependencies:

npm install -g grunt-cli
npm install

Use one of the following to build:

grunt release               # Builds into dist
grunt release-watch         # Same as release + watching for changes
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].