-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.min.js
3 lines (3 loc) · 2.26 KB
/
index.min.js
1
2
3
(function(){angular.module("ng-form-group",[])}).call(this);
(function(){var t,r=function(t,r){return function(){return t.apply(r,arguments)}};t=function(){function t(t){this.$scope=t,this.update=r(this.update,this),this.status=null,this.disabled=!1,this.inputs=[],this.$scope.$watch(this.update)}return t.prototype.setParentForm=function(t){return this.ngFormCtrl=t},t.prototype.canValidate=function(){var t;return t=this.inputs.every(function(t){return t.$dirty&&!t.$pending}),this.ngFormCtrl?this.ngFormCtrl.$submitted||t:t},t.prototype.update=function(){return!1===this.disabled&&this.canValidate()?this.status=this.inputs.every(function(t){return t.$valid})?"success":"error":this.status=null},t.prototype.addInput=function(t){return this.inputs.push(t)},t}(),angular.module("ng-form-group").controller("FormGroupController",["$scope",t]).directive("formGroup",function(){return{restrict:"C",require:["formGroup","?^form"],controller:"FormGroupController",link:function(t,r,n,e){var i,u;i=e[0],u=e[1];{if(0!==i.inputs.length)return u&&i.setParentForm(u),t.$watch(function(){return r.hasClass("form-group-without-feedback")},function(t){return i.disabled=t}),t.$watch(function(){return i.status},function(t){if(r.removeClass("has-error has-success"),t)return r.addClass("has-"+t)});i.disabled=!0}}}}).directive("formControl",function(){return{restrict:"C",require:["?ngModel","?^formGroup"],link:function(t,r,n,e){var i,u;if(u=e[0],(i=e[1])&&!i.disabled)return u&&i?i.addInput(u):void 0}}})}).call(this);
(function(){var r;r=function(r){return Array.prototype.slice.call(r)},angular.module("ng-form-group").directive("hasFeedback",function(){return{restrict:"C",compile:function(e,n){return r(e[0].querySelectorAll(".form-control")).forEach(function(r){return r.setAttribute("has-feedback-watcher","")})}}}).directive("hasFeedbackWatcher",function(){return{require:"ngModel",link:function(e,n,t,o){var c,i;return c=function(r){return null==r&&(r=!1),'<span class="glyphicon '+(r?"glyphicon-ok":"glyphicon-remove")+' form-control-feedback"></span>'},i=e.$watch(function(){if(r(n[0].parentElement.querySelectorAll(".form-control-feedback")).forEach(function(r){return r.parentElement.removeChild(r)}),o.$dirty)return o.$valid?n.after(c(!0)):o.$invalid?n.after(c(!1)):void 0}),e.$on("$destroy",i)}}})}).call(this);