Skip to content

Commit

Permalink
updated dist
Browse files Browse the repository at this point in the history
  • Loading branch information
futurechan committed Mar 31, 2015
1 parent 74c4d27 commit 6201233
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
29 changes: 25 additions & 4 deletions dist/expression-builder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('expression-builder', [])
angular.module('expression-builder', ['ui.bootstrap'])

.controller('ExpressionBuilderController', function($scope){

Expand All @@ -19,6 +19,18 @@ angular.module('expression-builder', [])
$scope.removeAt=function(idx){
$scope.conditions.splice(idx,1);
}

$scope.getLeftOperands=function($viewValue){
return ($scope.leftOperandProvider)
? $scope.leftOperandProvider($viewValue)
: [];
}

$scope.getRightOperands=function($viewValue){
return ($scope.rightOperandProvider)
? $scope.rightOperandProvider($viewValue)
: [];
}
})

.directive('expressionBuilder', function($compile){
Expand All @@ -30,7 +42,9 @@ angular.module('expression-builder', [])
scope: {
conditions: '=',
booleanOperators: '=?',
comparisonOperators: '=?'
comparisonOperators: '=?',
leftOperandProvider: '&',
rightOperandProvider: '&'
},
compile: function (element) {
var contents = element.contents().remove();
Expand All @@ -46,12 +60,19 @@ angular.module('expression-builder', [])
});

if(scope.booleanOperators === undefined)
scope.booleanOperators = ['AND', 'OR', 'AND NOT', 'XOR'];
scope.booleanOperators = ['AND', 'OR', 'XOR'];

if(scope.comparisonOperators === undefined)
scope.comparisonOperators = ['=', '<>', '<', '<=', '>', '>='];

if(scope.leftOperandProvider)
scope.leftOperandProvider = scope.leftOperandProvider()

if(scope.rightOperandProvider)
scope.rightOperandProvider = scope.rightOperandProvider()
};
}
};
})
angular.module("expression-builder").run(["$templateCache", function($templateCache) {$templateCache.put("templates/expressionbuilder.html","<div class=condition-builder><div ng-repeat=\"c in conditions\"><div ng-if=\"$index != 0\" class=\"form-inline bool-op\"><select class=\"form-control input-sm\" ng-options=\"o as o for o in booleanOperators\" ng-model=c.bool></select></div><div ng-if=c.conditions class=condition-group><div class=pull-right><button class=\"btn btn-danger btn-sm\" ng-click=removeAt($index)>&times;</button></div><expression-builder conditions=c.conditions boolean-operators=booleanOperators comparison-operators=comparisonOperators></expression-builder></div><div ng-if=!c.conditions class=form-inline><div class=form-group-sm><input class=form-control ng-model=c.field placeholder=Field><select class=form-control ng-model=c.comparison ng-options=\"o as o for o in comparisonOperators\"></select><input class=form-control ng-model=c.value placeholder=value> <button class=\"btn btn-danger btn-sm\" ng-click=removeAt($index)>&times;</button></div></div></div><div class=condition-group-button-row><button class=\"btn btn-success btn-sm\" ng-click=addCondition()>Add Condition</button> <button class=\"btn btn-success btn-sm\" ng-click=addGroup()>Add Group</button></div></div>");}]);

angular.module("expression-builder").run(["$templateCache", function($templateCache) {$templateCache.put("templates/expressionbuilder.html","<div class=condition-builder><div ng-repeat=\"c in conditions\"><div ng-if=\"$index != 0\" class=\"form-inline bool-op\"><select class=\"form-control input-sm\" ng-options=\"o as o for o in booleanOperators\" ng-model=c.bool></select></div><div ng-if=c.conditions class=condition-group><div class=pull-right><button class=\"btn btn-danger btn-sm\" ng-click=removeAt($index)>&times;</button></div><expression-builder conditions=c.conditions boolean-operators=booleanOperators comparison-operators=comparisonOperators left-operand-provider=leftOperandProvider right-operand-provider=rightOperandProvider></expression-builder></div><div ng-if=!c.conditions class=form-inline><div class=form-group-sm><input class=form-control ng-model=c.leftOperand placeholder=\"Left Operand\" typeahead=\"operand for operand in getLeftOperands($viewValue)\"><select class=form-control ng-model=c.comparison ng-options=\"o as o for o in comparisonOperators\"></select><input class=form-control ng-model=c.rightOperand placeholder=\"Right Operand\" typeahead=\"operand for operand in getRightOperands($viewValue)\"> <button class=\"btn btn-danger btn-sm\" ng-click=removeAt($index)>&times;</button></div></div></div><div class=condition-group-button-row><button class=\"btn btn-success btn-sm\" ng-click=addCondition()>Add Condition</button> <button class=\"btn btn-success btn-sm\" ng-click=addGroup()>Add Group</button></div></div>");}]);
2 changes: 1 addition & 1 deletion dist/expression-builder.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6201233

Please sign in to comment.