From 394ca79f420d3bebc4f81c16bf8ca3a71f4cd6c1 Mon Sep 17 00:00:00 2001 From: mdiaz Date: Fri, 12 May 2017 14:36:13 -0400 Subject: [PATCH] Export angular module name --- dist/angular-bootstrap-switch.js | 10 +++++++++- dist/angular-bootstrap-switch.min.js | 4 ++-- src/directives/bsSwitch.js | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dist/angular-bootstrap-switch.js b/dist/angular-bootstrap-switch.js index 70756d8..38719c7 100644 --- a/dist/angular-bootstrap-switch.js +++ b/dist/angular-bootstrap-switch.js @@ -1,6 +1,6 @@ /** * angular-bootstrap-switch - * @version v0.5.2 - 2017-04-19 + * @version v0.5.2 - 2017-05-12 * @author Francesco Pontillo (francescopontillo@gmail.com) * @link https://github.com/frapontillo/angular-bootstrap-switch * @license Apache License 2.0(http://www.apache.org/licenses/LICENSE-2.0.html) @@ -163,6 +163,12 @@ angular.module('frapontillo.bootstrap-switch') controller.$setViewValue(controller.$modelValue); } else { controller.$setViewValue(viewValue); + controller.$formatters[0] = function(value) { + if (value === undefined || value === null) { + return value; + } + return angular.equals(value, getTrueValue()); + }; } } }; @@ -285,5 +291,7 @@ angular.module('frapontillo.bootstrap-switch') }; }); +module.exports = 'frapontillo.bootstrap-switch'; + // Source: bsSwitch.suffix })(); \ No newline at end of file diff --git a/dist/angular-bootstrap-switch.min.js b/dist/angular-bootstrap-switch.min.js index e1a26ea..b6284b2 100644 --- a/dist/angular-bootstrap-switch.min.js +++ b/dist/angular-bootstrap-switch.min.js @@ -1,9 +1,9 @@ /** * angular-bootstrap-switch - * @version v0.5.2 - 2017-04-19 + * @version v0.5.2 - 2017-05-12 * @author Francesco Pontillo (francescopontillo@gmail.com) * @link https://github.com/frapontillo/angular-bootstrap-switch * @license Apache License 2.0(http://www.apache.org/licenses/LICENSE-2.0.html) **/ -!function(){"use strict";angular.module("frapontillo.bootstrap-switch",[]),angular.module("frapontillo.bootstrap-switch").directive("bsSwitch",["$parse","$timeout",function(a,b){return{restrict:"A",require:"ngModel",link:function(c,d,e,f){var g=!1,h=function(){if("radio"===e.type)return e.value||a(e.ngValue)(c)||!0;var b=a(e.ngTrueValue)(c);return angular.isUndefined(b)&&(b=!0),b},i=function(a){return c.$eval(a)===!0},j=function(a){return a===!0||"true"===a||!a},k=function(a){return a?a:void 0},l=function(a){return angular.isUndefined(a)?angular.noop:function(){c.$evalAsync(a)}},m=function(a){var b={switchRadioOff:j,switchActive:function(a){return!j(a)},switchAnimate:j,switchLabel:function(a){return a?a:" "},switchIcon:function(a){return a?"":void 0},switchWrapper:function(a){return a||"wrapper"},switchInverse:i,switchReadonly:i,switchChange:l},c=b[a]||k;return c(e[a])},n=function(a,b,c){if(g){var d=m(c);a.bootstrapSwitch(b,d)}},o=function(){n(d,"disabled","switchActive")},p=function(){if(!g){var a=f.$modelValue===h();g=!g,d.bootstrapSwitch({radioAllOff:m("switchRadioOff"),disabled:m("switchActive"),state:a,onText:m("switchOnText"),offText:m("switchOffText"),onColor:m("switchOnColor"),offColor:m("switchOffColor"),animate:m("switchAnimate"),size:m("switchSize"),labelText:m(e.switchLabel?"switchLabel":"switchIcon"),wrapperClass:m("switchWrapper"),handleWidth:m("switchHandleWidth"),labelWidth:m("switchLabelWidth"),inverse:m("switchInverse"),readonly:m("switchReadonly")}),"radio"===e.type?f.$setViewValue(f.$modelValue):f.$setViewValue(a)}},q=m("switchChange"),r=function(){e.$observe("switchActive",function(a){var c=j(a);c?o():b(o)}),f.$render=function(){p();var a=f.$modelValue;void 0!==a&&null!==a?d.bootstrapSwitch("state",a===h(),!0):(d.bootstrapSwitch("indeterminate",!0,!0),f.$setViewValue(void 0)),q()};var a={switchRadioOff:"radioAllOff",switchOnText:"onText",switchOffText:"offText",switchOnColor:"onColor",switchOffColor:"offColor",switchAnimate:"animate",switchSize:"size",switchLabel:"labelText",switchIcon:"labelText",switchWrapper:"wrapperClass",switchHandleWidth:"handleWidth",switchLabelWidth:"labelWidth",switchInverse:"inverse",switchReadonly:"readonly"},c=function(a,b){return function(){e.$observe(a,function(){n(d,b[a],a)})}};for(var g in a)e.$observe(g,c(g,a))},s=function(){"radio"===e.type?d.on("change.bootstrapSwitch",function(a){f.$modelValue===f.$viewValue&&a.target.checked!==$(a.target).bootstrapSwitch("state")&&(a.target.checked?f.$setViewValue(h()):h()===f.$viewValue&&f.$setViewValue(void 0),q())}):d.on("switchChange.bootstrapSwitch",function(a){f.$setViewValue(a.target.checked),q()})};s(),r(),c.$on("$destroy",function(){d.bootstrapSwitch("destroy")})}}}]).directive("bsSwitch",function(){return{restrict:"E",require:"ngModel",template:"",replace:!0}})}(); \ No newline at end of file +!function(){"use strict";angular.module("frapontillo.bootstrap-switch",[]),angular.module("frapontillo.bootstrap-switch").directive("bsSwitch",["$parse","$timeout",function(a,b){return{restrict:"A",require:"ngModel",link:function(c,d,e,f){var g=!1,h=function(){if("radio"===e.type)return e.value||a(e.ngValue)(c)||!0;var b=a(e.ngTrueValue)(c);return angular.isUndefined(b)&&(b=!0),b},i=function(a){return c.$eval(a)===!0},j=function(a){return a===!0||"true"===a||!a},k=function(a){return a?a:void 0},l=function(a){return angular.isUndefined(a)?angular.noop:function(){c.$evalAsync(a)}},m=function(a){var b={switchRadioOff:j,switchActive:function(a){return!j(a)},switchAnimate:j,switchLabel:function(a){return a?a:" "},switchIcon:function(a){if(a)return""},switchWrapper:function(a){return a||"wrapper"},switchInverse:i,switchReadonly:i,switchChange:l},c=b[a]||k;return c(e[a])},n=function(a,b,c){if(g){var d=m(c);a.bootstrapSwitch(b,d)}},o=function(){n(d,"disabled","switchActive")},p=function(){if(!g){var a=f.$modelValue===h();g=!g,d.bootstrapSwitch({radioAllOff:m("switchRadioOff"),disabled:m("switchActive"),state:a,onText:m("switchOnText"),offText:m("switchOffText"),onColor:m("switchOnColor"),offColor:m("switchOffColor"),animate:m("switchAnimate"),size:m("switchSize"),labelText:m(e.switchLabel?"switchLabel":"switchIcon"),wrapperClass:m("switchWrapper"),handleWidth:m("switchHandleWidth"),labelWidth:m("switchLabelWidth"),inverse:m("switchInverse"),readonly:m("switchReadonly")}),"radio"===e.type?f.$setViewValue(f.$modelValue):(f.$setViewValue(a),f.$formatters[0]=function(a){return void 0===a||null===a?a:angular.equals(a,h())})}},q=m("switchChange"),r=function(){e.$observe("switchActive",function(a){var c=j(a);c?o():b(o)}),f.$render=function(){p();var a=f.$modelValue;void 0!==a&&null!==a?d.bootstrapSwitch("state",a===h(),!0):(d.bootstrapSwitch("indeterminate",!0,!0),f.$setViewValue(void 0)),q()};var a={switchRadioOff:"radioAllOff",switchOnText:"onText",switchOffText:"offText",switchOnColor:"onColor",switchOffColor:"offColor",switchAnimate:"animate",switchSize:"size",switchLabel:"labelText",switchIcon:"labelText",switchWrapper:"wrapperClass",switchHandleWidth:"handleWidth",switchLabelWidth:"labelWidth",switchInverse:"inverse",switchReadonly:"readonly"},c=function(a,b){return function(){e.$observe(a,function(){n(d,b[a],a)})}};for(var g in a)e.$observe(g,c(g,a))},s=function(){"radio"===e.type?d.on("change.bootstrapSwitch",function(a){f.$modelValue===f.$viewValue&&a.target.checked!==$(a.target).bootstrapSwitch("state")&&(a.target.checked?f.$setViewValue(h()):h()===f.$viewValue&&f.$setViewValue(void 0),q())}):d.on("switchChange.bootstrapSwitch",function(a){f.$setViewValue(a.target.checked),q()})};s(),r(),c.$on("$destroy",function(){d.bootstrapSwitch("destroy")})}}}]).directive("bsSwitch",function(){return{restrict:"E",require:"ngModel",template:"",replace:!0}}),module.exports="frapontillo.bootstrap-switch"}(); \ No newline at end of file diff --git a/src/directives/bsSwitch.js b/src/directives/bsSwitch.js index 93b6e59..41363bc 100644 --- a/src/directives/bsSwitch.js +++ b/src/directives/bsSwitch.js @@ -277,3 +277,5 @@ angular.module('frapontillo.bootstrap-switch') replace: true }; }); + +module.exports = 'frapontillo.bootstrap-switch';