{"id":20650968,"url":"https://github.com/niklr/angular-query-builder","last_synced_at":"2025-04-17T12:42:46.554Z","repository":{"id":84678125,"uuid":"44380764","full_name":"niklr/angular-query-builder","owner":"niklr","description":"Dynamic query building UI written in Angular and Bootstrap. https://niklr.github.io/angular-query-builder","archived":false,"fork":false,"pushed_at":"2019-12-25T09:04:42.000Z","size":505,"stargazers_count":63,"open_issues_count":1,"forks_count":23,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-29T06:11:18.402Z","etag":null,"topics":["angular","bootstrap","search-interface"],"latest_commit_sha":null,"homepage":"https://niklr.github.io/angular-query-builder","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niklr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-16T11:28:23.000Z","updated_at":"2025-01-08T04:50:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"92f79a64-51a0-44e7-8b54-807d641043c4","html_url":"https://github.com/niklr/angular-query-builder","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Fangular-query-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Fangular-query-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Fangular-query-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Fangular-query-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niklr","download_url":"https://codeload.github.com/niklr/angular-query-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249342149,"owners_count":21254230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","bootstrap","search-interface"],"created_at":"2024-11-16T17:24:46.632Z","updated_at":"2025-04-17T12:42:46.548Z","avatar_url":"https://github.com/niklr.png","language":"JavaScript","readme":"Angular Query Builder\n=========\n\nDemo: http://niklr.github.io/angular-query-builder\n\nThis 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.\n\nThe project was inspired by: https://github.com/mfauveau/angular-query-builder\n\nAdditional features:\n* Autocomplete based on selected options implemented with Bootstrap's typeahead plugin.\n* Dynamic source fields based on selected source types.\n* Dynamic comparison operators based on selected source field.\n* Nested form validation.\n* Configurable maximum for groups and conditions.\n* Fancy enter and leave animations for groups and conditions.\n\nTable of Content\n* [Dependencies](#dependencies)\n* [Basic setup](#basic_setup)\n* [Configuration](#configuration)\n* [Terminology](#terminology)\n* [Building](#building)\n\n## Dependencies \u003ca name=\"dependencies\"\u003e\u003c/a\u003e\n\n* [AngularJS v1.4.7](https://angularjs.org/)\n* [Bootstrap v2.3.2](http://getbootstrap.com/2.3.2)\n* [jQuery v1.11.3](https://jquery.com/)\n* [Underscore v1.8.3](http://underscorejs.org/)\n\n## Basic setup \u003ca name=\"basic_setup\"\u003e\u003c/a\u003e\n\nindex.html\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"utf-8\"\u003e\n    \u003ctitle\u003eAngular Query Builder\u003c/title\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003clink href=\"libraries/bootstrap/css/bootstrap.css\" rel=\"stylesheet\"\u003e\n    \u003clink href=\"libraries/bootstrap/css/bootstrap-responsive.css\" rel=\"stylesheet\"\u003e\n    \u003clink href=\"main.css\" rel=\"stylesheet\"\u003e\n\u003c/head\u003e\n\u003cbody ng-app=\"app\"\u003e\n    \u003cdiv ng-controller=\"MainController\"\u003e\n        \u003cdiv class=\"aqb-search-form\"\u003e\n            \u003cform name=\"searchForm\" ng-submit=\"search(searchForm, $event)\"\u003e\n                \u003cdiv class=\"aqb-search-form-body\"\u003e\n                    \u003cdiv class=\"aqb-animate-combined\" ng-repeat=\"group in searchContainer.groups | orderBy:'index'\"\u003e\n                        \u003cdiv search-group\n                                search-container=\"searchContainer\"\n                                groups=\"searchContainer.groups\"\n                                group-index=\"$index\"\n                                source-types=\"sourceTypes\"\n                                logical-operators=\"logicalOperators\"\u003e\u003c/div\u003e\n                    \u003c/div\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"aqb-search-form-footer\"\u003e\n                    \u003cbutton type=\"submit\" class=\"btn\" ng-disabled=\"searchForm.$invalid\"\u003eSearch\u003c/button\u003e\n                \u003c/div\u003e\n            \u003c/form\u003e\n        \u003c/div\u003e\n        \u003cdiv\u003e\n            \u003cpre\u003e{{jsonOutput}}\u003c/pre\u003e\n        \u003c/div\u003e        \n    \u003c/div\u003e\n\n    \u003cscript src=\"libraries/jquery/jquery.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"libraries/bootstrap/js/bootstrap.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"libraries/angular/angular.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"libraries/angular/angular-animate.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"libraries/underscore/underscore.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"js/angular-query-builder-templates.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"js/angular-query-builder.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"main.js\"\u003e\u003c/script\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nmain.js\n\n```js\nangular.module('app', [\n    'angular-query-builder'\n])\n\n.controller('MainController', ['$scope', 'AppConfig', function ($scope, AppConfig) {\n\n    AppConfig.setMaxGroups(4);\n    AppConfig.setMaxConditions(4);\n\n    $scope.jsonOutput = {};\n\n    $scope.search = function (form, $event) {\n        $scope.jsonOutput = JSON.stringify($scope.searchContainer, null, 4);\n    };\n\n    $scope.sourceTypes = [\n        {\n            \"name\": \"Objects\",\n            \"displayName\": \"Objects\",\n            \"sourceFields\": [\n                {\n                    \"name\": \"ObjectId\",\n                    \"displayName\": \"Id\",\n                    \"comparisonOperators\": [\n                        {\n                            \"name\": \"Equals\",\n                            \"displayName\": \"=\"\n                        },\n                        {\n                            \"name\": \"NotEquals\",\n                            \"displayName\": \"!=\"\n                        }\n                    ]\n                }\n            ],\n        }\n    ];\n\n    $scope.logicalOperators = [\n        {\n            \"name\": \"And\",\n            \"displayName\": \"AND\"\n        },\n        {\n            \"name\": \"Or\",\n            \"displayName\": \"OR\"\n        }\n    ];\n\n    var defaultSearchContainer = {\n        \"groups\": [\n            {\n                \"sourceType\": {\n                    \"name\": \"Objects\",\n                    \"displayName\": \"Objects\"\n                },\n                \"logicalOperator\": {\n                    \"name\": \"And\",\n                    \"displayName\": \"AND\"\n                },                \n                \"conditions\": [\n                    {}\n                ]\n            }\n        ]\n    };\n    $scope.searchContainer = defaultSearchContainer;\n}]);\n```\n\n## Configuration \u003ca name=\"configuration\"\u003e\u003c/a\u003e\n\n* `AppConfig.setMaxGroups` Sets the maximum amount of groups the user is able to create.\n* `AppConfig.setMaxConditions` Sets the maximum amount of conditions the user is able to create.\n\n## Terminology \u003ca name=\"terminology\"\u003e\u003c/a\u003e\n\nAngular 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.\n\n* `SearchContainer` can contain one or multiple `Group`.\n* `Group` consists of a `SourceType`, `LogicalOperator` and one or multiple `Condition`.\n* `Condition` consists of a `SourceField`, `ComparisonOperator` and an `InputItem`.\n* `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:\n  * `name` is a string\n  * `displayName` is a string\n  * `sourceFields` is an array of `SourceField` objects\n* `SourceField` defines the available options for the first dropdown element of each `Condition`. The `SourceField` object consists of the following keys:\n  * `name` is a string\n  * `displayName` is a string\n  * `comparisonOperators` is an array of `ComparisonOperator` objects\n* `ComparisonOperator` defines the available options for the second dropdown element of each `Condition`. The `ComparisonOperator` object consists of the following keys:\n  * `name` is a string\n  * `displayName` is a string\n* `LogicalOperator` defines how each `Condition` in a `Group` should be logically connected. The `LogicalOperator` object consists of the following keys:\n  * `name` is a string\n  * `displayName` is a string  \n* `InputItem` contains the data entered by the user. The `InputItem` object consists of the following keys:\n  * `data` is a string\n  * `displayName` is a string\n\n## Building \u003ca name=\"building\"\u003e\u003c/a\u003e\n\nIn order to build Angular Query Builder, ensure that you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed.\n\nClone a copy of the repo:\n\n```bash\ngit clone https://github.com/niklr/angular-query-builder.git\n```\n\nChange to the angular-query-builder directory:\n\n```bash\ncd angular-query-builder\n```\n\nInstall [Grunt](https://gruntjs.com/) and dev dependencies:\n\n```bash\nnpm install -g grunt-cli\nnpm install\n```\n\nUse one of the following to build:\n\n```\ngrunt release               # Builds into dist\ngrunt release-watch         # Same as release + watching for changes\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklr%2Fangular-query-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniklr%2Fangular-query-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklr%2Fangular-query-builder/lists"}