diff --git a/Gruntfile.js b/Gruntfile.js index 5fb6e6f..99743b5 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -58,7 +58,8 @@ module.exports = function (grunt) { copy: { main: { files: [ - {src:'angular-busy.css',dest:'dist/'} + {src:'angular-busy.css',dest:'dist/'}, + {src:'index.js',dest:'dist/'} ] } }, diff --git a/README.md b/README.md index 82f47e6..54a5617 100755 --- a/README.md +++ b/README.md @@ -8,10 +8,11 @@ ## Getting Started -Install with Bower or download the files directly from the dist folder in the repo. +Install with Bower, npm, yarn, or download the files directly from the dist folder in the repo. ```bash bower install angular-busy --save +npm install @cgross/angular-busy ``` Add `dist/angular-busy.js` and `dist/angular-busy.css` to your index.html. @@ -91,6 +92,7 @@ Only the values you'd like overriden need to be specified. ## Release History + * v4.1.4 - Fixed deprecated Angular success promise methods for 1.6. Published to npm. * v4.1.3 - Fix for issue #45 and issue #49. * v4.1.2 - Small bugs fixed, wrapperClass option added. * v4.1.1 - Compatibility with Angular 1.3. diff --git a/bower.json b/bower.json index e670a48..0154500 100755 --- a/bower.json +++ b/bower.json @@ -1,13 +1,13 @@ { "name": "angular-busy", - "version": "4.1.3", + "version": "4.1.4", "main": [ "dist/angular-busy.js", "dist/angular-busy.css" ], "dependencies": { - "angular": "~1.3", - "angular-animate": "~1.3" + "angular": ">=1.3", + "angular-animate": ">=1.3" }, "ignore": [ "**/.*", diff --git a/dist/angular-busy.js b/dist/angular-busy.js index 31c8952..c696ebd 100644 --- a/dist/angular-busy.js +++ b/dist/angular-busy.js @@ -210,7 +210,7 @@ angular.module('cgBusy').directive('cgBusy',['$compile','$templateCache','cgBusy currentTemplate = options.templateUrl; backdrop = options.backdrop; - $http.get(currentTemplate,{cache: $templateCache}).success(function(indicatorTemplate){ + $http.get(currentTemplate,{cache: $templateCache}).then(function(indicatorTemplate){ options.backdrop = typeof options.backdrop === 'undefined' ? true : options.backdrop; @@ -220,7 +220,7 @@ angular.module('cgBusy').directive('cgBusy',['$compile','$templateCache','cgBusy element.append(backdropElement); } - var template = '
' + indicatorTemplate + '
'; + var template = '
' + indicatorTemplate.data + '
'; templateElement = $compile(template)(templateScope); angular.element(templateElement.children()[0]) @@ -231,7 +231,7 @@ angular.module('cgBusy').directive('cgBusy',['$compile','$templateCache','cgBusy .css('bottom',0); element.append(templateElement); - }).error(function(data){ + }, function(data){ throw new Error('Template specified for cgBusy ('+options.templateUrl+') could not be loaded. ' + data); }); } diff --git a/dist/angular-busy.min.js b/dist/angular-busy.min.js index 6d8738d..4e6f58c 100644 --- a/dist/angular-busy.min.js +++ b/dist/angular-busy.min.js @@ -1 +1 @@ -angular.module("cgBusy",[]),angular.module("cgBusy").factory("_cgBusyTrackerFactory",["$timeout","$q",function(a,b){return function(){var c={};c.promises=[],c.delayPromise=null,c.durationPromise=null,c.delayJustFinished=!1,c.reset=function(b){c.minDuration=b.minDuration,c.promises=[],angular.forEach(b.promises,function(a){a&&!a.$cgBusyFulfilled&&d(a)}),0!==c.promises.length&&(c.delayJustFinished=!1,b.delay&&(c.delayPromise=a(function(){c.delayPromise=null,c.delayJustFinished=!0},parseInt(b.delay,10))),b.minDuration&&(c.durationPromise=a(function(){c.durationPromise=null},parseInt(b.minDuration,10)+(b.delay?parseInt(b.delay,10):0))))},c.isPromise=function(a){var b=a&&(a.then||a.$then||a.$promise&&a.$promise.then);return"undefined"!=typeof b},c.callThen=function(a,c,d){var e;a.then||a.$then?e=a:a.$promise?e=a.$promise:a.denodeify&&(e=b.when(a));var f=e.then||e.$then;f.call(e,c,d)};var d=function(a){if(!c.isPromise(a))throw new Error("cgBusy expects a promise (or something that has a .promise or .$promise");-1===c.promises.indexOf(a)&&(c.promises.push(a),c.callThen(a,function(){a.$cgBusyFulfilled=!0,-1!==c.promises.indexOf(a)&&c.promises.splice(c.promises.indexOf(a),1)},function(){a.$cgBusyFulfilled=!0,-1!==c.promises.indexOf(a)&&c.promises.splice(c.promises.indexOf(a),1)}))};return c.active=function(){return c.delayPromise?!1:c.delayJustFinished?(c.delayJustFinished=!1,0===c.promises.length&&(c.durationPromise=null),c.promises.length>0):c.durationPromise?!0:c.promises.length>0},c}}]),angular.module("cgBusy").value("cgBusyDefaults",{}),angular.module("cgBusy").directive("cgBusy",["$compile","$templateCache","cgBusyDefaults","$http","_cgBusyTrackerFactory",function(a,b,c,d,e){return{restrict:"A",link:function(f,g,h){var i=g.css("position");("static"===i||""===i||"undefined"==typeof i)&&g.css("position","relative");var j,k,l,m,n,o=e(),p={templateUrl:"angular-busy.html",delay:0,minDuration:0,backdrop:!0,message:"Please Wait...",wrapperClass:"cg-busy cg-busy-animation"};angular.extend(p,c),f.$watchCollection(h.cgBusy,function(c){if(c||(c={promise:null}),angular.isString(c))throw new Error("Invalid value for cg-busy. cgBusy no longer accepts string ids to represent promises/trackers.");(angular.isArray(c)||o.isPromise(c))&&(c={promise:c}),c=angular.extend(angular.copy(p),c),c.templateUrl||(c.templateUrl=p.templateUrl),angular.isArray(c.promise)||(c.promise=[c.promise]),m||(m=f.$new()),m.$message=c.message,angular.equals(o.promises,c.promise)||o.reset({promises:c.promise,delay:c.delay,minDuration:c.minDuration}),m.$cgBusyIsActive=function(){return o.active()},j&&l===c.templateUrl&&n===c.backdrop||(j&&j.remove(),k&&k.remove(),l=c.templateUrl,n=c.backdrop,d.get(l,{cache:b}).success(function(b){if(c.backdrop="undefined"==typeof c.backdrop?!0:c.backdrop,c.backdrop){var d='
';k=a(d)(m),g.append(k)}var e='
'+b+"
";j=a(e)(m),angular.element(j.children()[0]).css("position","absolute").css("top",0).css("left",0).css("right",0).css("bottom",0),g.append(j)}).error(function(a){throw new Error("Template specified for cgBusy ("+c.templateUrl+") could not be loaded. "+a)}))},!0)}}}]),angular.module("cgBusy").run(["$templateCache",function(a){"use strict";a.put("angular-busy.html",'
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
{{$message}}
\n\n
\n\n
')}]); \ No newline at end of file +angular.module("cgBusy",[]),angular.module("cgBusy").factory("_cgBusyTrackerFactory",["$timeout","$q",function(a,b){return function(){var c={};c.promises=[],c.delayPromise=null,c.durationPromise=null,c.delayJustFinished=!1,c.reset=function(b){c.minDuration=b.minDuration,c.promises=[],angular.forEach(b.promises,function(a){a&&!a.$cgBusyFulfilled&&d(a)}),0!==c.promises.length&&(c.delayJustFinished=!1,b.delay&&(c.delayPromise=a(function(){c.delayPromise=null,c.delayJustFinished=!0},parseInt(b.delay,10))),b.minDuration&&(c.durationPromise=a(function(){c.durationPromise=null},parseInt(b.minDuration,10)+(b.delay?parseInt(b.delay,10):0))))},c.isPromise=function(a){var b=a&&(a.then||a.$then||a.$promise&&a.$promise.then);return"undefined"!=typeof b},c.callThen=function(a,c,d){var e;a.then||a.$then?e=a:a.$promise?e=a.$promise:a.denodeify&&(e=b.when(a));var f=e.then||e.$then;f.call(e,c,d)};var d=function(a){if(!c.isPromise(a))throw new Error("cgBusy expects a promise (or something that has a .promise or .$promise");-1===c.promises.indexOf(a)&&(c.promises.push(a),c.callThen(a,function(){a.$cgBusyFulfilled=!0,-1!==c.promises.indexOf(a)&&c.promises.splice(c.promises.indexOf(a),1)},function(){a.$cgBusyFulfilled=!0,-1!==c.promises.indexOf(a)&&c.promises.splice(c.promises.indexOf(a),1)}))};return c.active=function(){return c.delayPromise?!1:c.delayJustFinished?(c.delayJustFinished=!1,0===c.promises.length&&(c.durationPromise=null),c.promises.length>0):c.durationPromise?!0:c.promises.length>0},c}}]),angular.module("cgBusy").value("cgBusyDefaults",{}),angular.module("cgBusy").directive("cgBusy",["$compile","$templateCache","cgBusyDefaults","$http","_cgBusyTrackerFactory",function(a,b,c,d,e){return{restrict:"A",link:function(f,g,h){var i=g.css("position");("static"===i||""===i||"undefined"==typeof i)&&g.css("position","relative");var j,k,l,m,n,o=e(),p={templateUrl:"angular-busy.html",delay:0,minDuration:0,backdrop:!0,message:"Please Wait...",wrapperClass:"cg-busy cg-busy-animation"};angular.extend(p,c),f.$watchCollection(h.cgBusy,function(c){if(c||(c={promise:null}),angular.isString(c))throw new Error("Invalid value for cg-busy. cgBusy no longer accepts string ids to represent promises/trackers.");(angular.isArray(c)||o.isPromise(c))&&(c={promise:c}),c=angular.extend(angular.copy(p),c),c.templateUrl||(c.templateUrl=p.templateUrl),angular.isArray(c.promise)||(c.promise=[c.promise]),m||(m=f.$new()),m.$message=c.message,angular.equals(o.promises,c.promise)||o.reset({promises:c.promise,delay:c.delay,minDuration:c.minDuration}),m.$cgBusyIsActive=function(){return o.active()},j&&l===c.templateUrl&&n===c.backdrop||(j&&j.remove(),k&&k.remove(),l=c.templateUrl,n=c.backdrop,d.get(l,{cache:b}).then(function(b){if(c.backdrop="undefined"==typeof c.backdrop?!0:c.backdrop,c.backdrop){var d='
';k=a(d)(m),g.append(k)}var e='
'+b.data+"
";j=a(e)(m),angular.element(j.children()[0]).css("position","absolute").css("top",0).css("left",0).css("right",0).css("bottom",0),g.append(j)},function(a){throw new Error("Template specified for cgBusy ("+c.templateUrl+") could not be loaded. "+a)}))},!0)}}}]),angular.module("cgBusy").run(["$templateCache",function(a){"use strict";a.put("angular-busy.html",'
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
{{$message}}
\n\n
\n\n
')}]); \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..f2a5c6a --- /dev/null +++ b/dist/index.js @@ -0,0 +1,2 @@ +require('./angular-busy'); +module.exports = 'cgBusy'; \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..f2a5c6a --- /dev/null +++ b/index.js @@ -0,0 +1,2 @@ +require('./angular-busy'); +module.exports = 'cgBusy'; \ No newline at end of file diff --git a/package.json b/package.json index c4e364d..e7f6a75 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "angular-busy", - "main": "angular-busy.js", - "version": "4.1.3", + "name": "@cgross/angular-busy", + "main": "dist/index.js", + "version": "4.1.4", "description": "", "repository": { "type": "git",