From 39f2e57a19f14666dc06f8d29538d14a2d9483d3 Mon Sep 17 00:00:00 2001 From: Ben March Date: Tue, 16 Aug 2016 17:15:10 -0400 Subject: [PATCH 1/2] #65 and #67 only supporting angular bootstrap 2.x.x --- app/templates/tour-step-popup.html | 17 ++++------- app/tour-controller.js | 1 + app/tour-step-directive.js | 29 +++++++++--------- bower.json | 2 +- dist/angular-ui-tour.js | 47 ++++++++++++++---------------- dist/angular-ui-tour.min.js | 2 +- 6 files changed, 46 insertions(+), 52 deletions(-) diff --git a/app/templates/tour-step-popup.html b/app/templates/tour-step-popup.html index 7f3c9e7..03e6749 100644 --- a/app/templates/tour-step-popup.html +++ b/app/templates/tour-step-popup.html @@ -1,13 +1,8 @@ -
-
+
-
-

-
-
+
+

+
diff --git a/app/tour-controller.js b/app/tour-controller.js index 0b381b9..d39f5ea 100644 --- a/app/tour-controller.js +++ b/app/tour-controller.js @@ -443,6 +443,7 @@ self.pause = function () { return handleEvent(options.onPause).then(function () { tourStatus = statuses.PAUSED; + uiTourBackdrop.hide(); return self.hideStep(getCurrentStep()); }).then(function () { self.emit('paused', getCurrentStep()); diff --git a/app/tour-step-directive.js b/app/tour-step-directive.js index f7ba7e3..65e52cb 100644 --- a/app/tour-step-directive.js +++ b/app/tour-step-directive.js @@ -135,21 +135,16 @@ }]); - app.directive('tourStepPopup', ['TourConfig', 'smoothScroll', 'ezComponentHelpers', function (TourConfig, smoothScroll, ezComponentHelpers) { + app.directive('tourStepPopup', ['TourConfig', 'smoothScroll', 'ezComponentHelpers', '$uibPosition', function (TourConfig, smoothScroll, ezComponentHelpers, $uibPostion) { return { - restrict: 'EA', - replace: true, - scope: { title: '@', uibTitle: '@uibTitle', content: '@', placement: '@', animation: '&', isOpen: '&', originScope: '&'}, + restrict: 'A', + scope: { uibTitle: '@', contentExp: '&', originScope: '&' }, templateUrl: 'tour-step-popup.html', link: function (scope, element, attrs) { var step = scope.originScope().tourStep, ch = ezComponentHelpers.apply(null, arguments), - scrollOffset = step.config('scrollOffset'); - - //UI Bootstrap name changed in 1.3.0 - if (!scope.title && scope.uibTitle) { - scope.title = scope.uibTitle; - } + scrollOffset = step.config('scrollOffset'), + isScrolling = false; //for arrow styles, unfortunately UI Bootstrap uses attributes for styling attrs.$set('uib-popover-popup', 'uib-popover-popup'); @@ -159,7 +154,7 @@ display: 'block' }); - element.addClass(step.config('popupClass')); + element.addClass([step.config('popupClass'), 'popover'].join(' ')); if (step.config('fixed')) { element.css('position', 'fixed'); @@ -184,10 +179,16 @@ ); } - scope.$watch('isOpen', function (isOpen) { - if (isOpen() && !step.config('orphan') && step.config('scrollIntoView')) { + scope.$watch(function () { + var offset = $uibPostion.offset(element), + isOpen = offset.width && offset.height; + if (isOpen && !step.config('orphan') && step.config('scrollIntoView') && !isScrolling) { + isScrolling = true; smoothScroll(element[0], { - offset: scrollOffset + offset: scrollOffset, + callbackAfter: function () { + isScrolling = false; + } }); } }); diff --git a/bower.json b/bower.json index 18bb5db..e01b84b 100644 --- a/bower.json +++ b/bower.json @@ -19,7 +19,7 @@ "test/" ], "dependencies": { - "angular-bootstrap": ">=0.14.3 <2.0.0", + "angular-bootstrap": ">=2.0.0", "ngSmoothScroll": "2.0.0", "angular-sanitize": ">=1.3", "ez-ng": "0.1.8", diff --git a/dist/angular-ui-tour.js b/dist/angular-ui-tour.js index a635b08..799ef15 100644 --- a/dist/angular-ui-tour.js +++ b/dist/angular-ui-tour.js @@ -657,6 +657,7 @@ self.pause = function () { return handleEvent(options.onPause).then(function () { tourStatus = statuses.PAUSED; + uiTourBackdrop.hide(); return self.hideStep(getCurrentStep()); }).then(function () { self.emit('paused', getCurrentStep()); @@ -1239,21 +1240,16 @@ }]); - app.directive('tourStepPopup', ['TourConfig', 'smoothScroll', 'ezComponentHelpers', function (TourConfig, smoothScroll, ezComponentHelpers) { + app.directive('tourStepPopup', ['TourConfig', 'smoothScroll', 'ezComponentHelpers', '$uibPosition', function (TourConfig, smoothScroll, ezComponentHelpers, $uibPostion) { return { - restrict: 'EA', - replace: true, - scope: { title: '@', uibTitle: '@uibTitle', content: '@', placement: '@', animation: '&', isOpen: '&', originScope: '&'}, + restrict: 'A', + scope: { uibTitle: '@', contentExp: '&', originScope: '&' }, templateUrl: 'tour-step-popup.html', link: function (scope, element, attrs) { var step = scope.originScope().tourStep, ch = ezComponentHelpers.apply(null, arguments), - scrollOffset = step.config('scrollOffset'); - - //UI Bootstrap name changed in 1.3.0 - if (!scope.title && scope.uibTitle) { - scope.title = scope.uibTitle; - } + scrollOffset = step.config('scrollOffset'), + isScrolling = false; //for arrow styles, unfortunately UI Bootstrap uses attributes for styling attrs.$set('uib-popover-popup', 'uib-popover-popup'); @@ -1263,7 +1259,7 @@ display: 'block' }); - element.addClass(step.config('popupClass')); + element.addClass([step.config('popupClass'), 'popover'].join(' ')); if (step.config('fixed')) { element.css('position', 'fixed'); @@ -1288,10 +1284,16 @@ ); } - scope.$watch('isOpen', function (isOpen) { - if (isOpen() && !step.config('orphan') && step.config('scrollIntoView')) { + scope.$watch(function () { + var offset = $uibPostion.offset(element), + isOpen = offset.width && offset.height; + if (isOpen && !step.config('orphan') && step.config('scrollIntoView') && !isScrolling) { + isScrolling = true; smoothScroll(element[0], { - offset: scrollOffset + offset: scrollOffset, + callbackAfter: function () { + isScrolling = false; + } }); } }); @@ -1303,18 +1305,13 @@ angular.module('bm.uiTour').run(['$templateCache', function($templateCache) { $templateCache.put("tour-step-popup.html", - "
\n" + - "
\n" + + "
\n" + "\n" + - "
\n" + - "

\n" + - "
\n" + - "
\n" + + "
\n" + + "

\n" + + "
\n" + "
\n" + ""); $templateCache.put("tour-step-template.html", diff --git a/dist/angular-ui-tour.min.js b/dist/angular-ui-tour.min.js index ca4d30d..66d90d4 100644 --- a/dist/angular-ui-tour.min.js +++ b/dist/angular-ui-tour.min.js @@ -1 +1 @@ -!function(a){"use strict";a.config(["$uibTooltipProvider",function(a){a.setTriggers({uiTourShow:"uiTourHide"})}])}(angular.module("bm.uiTour",["ngSanitize","ui.bootstrap","smoothScroll","ezNg","cfp.hotkeys"])),function(a){"use strict";a.factory("uiTourBackdrop",["TourConfig","$document","$uibPosition",function(a,b,c){function d(){j.addClass("no-scrolling"),j.on("touchmove",l)}function e(){j.removeClass("no-scrolling"),j.off("touchmove",l)}function f(b){b.addClass("tour-backdrop").css({display:"none",zIndex:a.get("backdropZIndex")}),j.append(b)}function g(){k.top.css("display","block"),k.bottom.css("display","block"),k.left.css("display","block"),k.right.css("display","block")}function h(){k.top.css("display","none"),k.bottom.css("display","none"),k.left.css("display","none"),k.right.css("display","none")}var i={},j=angular.element(b[0].body),k={top:angular.element(b[0].createElement("div")),bottom:angular.element(b[0].createElement("div")),left:angular.element(b[0].createElement("div")),right:angular.element(b[0].createElement("div"))},l=function(a){a.preventDefault()};return function(){var a=".no-scrolling",c="height: 100%; overflow: hidden;",d=b[0].createElement("style");d.type="text/css",b[0].getElementsByTagName("head")[0].appendChild(d),d.sheet||d.sheet.insertRule?d.sheet.insertRule(a+"{"+c+"}",0):(d.styleSheet||d.sheet).addRule(a,c)}(),f(k.top),f(k.bottom),f(k.left),f(k.right),i.createForElement=function(a,b,e){var f,h,i;b&&d(),f=c.offset(a),h=c.viewportOffset(a),i=c.offset(j),e&&angular.extend(f,h),k.top.css({position:e?"fixed":"absolute",top:0,left:0,width:"100%",height:f.top+"px"}),k.bottom.css({position:e?"fixed":"absolute",left:0,width:"100%",height:i.top+i.height-f.top-f.height+"px",top:f.top+f.height+"px"}),k.left.css({position:e?"fixed":"absolute",top:f.top+"px",width:f.left+"px",height:f.height+"px"}),k.right.css({position:e?"fixed":"absolute",top:f.top+"px",width:i.left+i.width-f.left-f.width+"px",height:f.height+"px",left:f.left+f.width+"px"}),g(),b&&d()},i.hide=function(){h(),e()},i}])}(angular.module("bm.uiTour")),function(a){"use strict";a.provider("TourConfig",[function(){var a={placement:"top",animation:!0,popupDelay:1,closePopupDelay:0,enable:!0,appendToBody:!1,popupClass:"",orphan:!1,backdrop:!1,backdropZIndex:1e4,scrollOffset:100,scrollIntoView:!0,useUiRouter:!1,useHotkeys:!1,onStart:null,onEnd:null,onPause:null,onResume:null,onNext:null,onPrev:null,onShow:null,onShown:null,onHide:null,onHidden:null};this.set=function(b,c){a[b]=c},this.$get=["$q",function(b){var c={};return c.get=function(b){return a[b]},c.getAll=function(){return angular.copy(a)},function(){angular.forEach(a,function(c,d){0===d.indexOf("on")&&angular.isFunction(c)&&(a[d]=function(){return b.resolve(c())})})}(),c}]}])}(angular.module("bm.uiTour")),function(a){"use strict";a.controller("uiTourController",["$timeout","$q","$filter","TourConfig","uiTourBackdrop","uiTourService","ezEventEmitter","hotkeys",function(a,b,c,d,e,f,g,h){function i(){return b(function(b){a(b)})}function j(){return y}function k(a){y=a}function l(a){return j()?x[x.indexOf(j())+a]:null}function m(a){if(angular.isNumber(a))return x[a];if(angular.isString(a))return x.filter(function(b){return b.stepId===a})[0];if(angular.isObject(a)){if(~x.indexOf(a))return a;if(a.stepId)return x.filter(function(b){return b.stepId===a.stepId})[0]}return null}function n(){return l(1)}function o(){return l(-1)}function p(){return!(!n()&&!j().nextPath)}function q(){return!(!o()&&!j().prevPath)}function r(a,c){return b(function(b){a.element[0].dispatchEvent(new CustomEvent(c)),b()})}function s(a){return(a||b.resolve)()}function t(){h.add({combo:"esc",description:"End tour",callback:function(){w.end()}}),h.add({combo:"right",description:"Go to next step",callback:function(){p()&&w.next()}}),h.add({combo:"left",description:"Go to previous step",callback:function(){q()&&w.prev()}})}function u(){h.del("esc"),h.del("right"),h.del("left")}var v,w=this,x=[],y=null,z={OFF:0,ON:1,PAUSED:2},A=z.OFF,B=d.getAll();g.mixin(w),w.addStep=function(a){~x.indexOf(a)||(x.push(a),x=c("orderBy")(x,"order"),w.emit("stepAdded",a),v&&v(a))},w.removeStep=function(a){x.splice(x.indexOf(a),1),w.emit("stepRemoved",a)},w.reorderStep=function(a){w.removeStep(a),w.addStep(a),w.emit("stepsReordered",a)},w.hasStep=function(a){return!!m(a)},w.showStep=function(a){return a?s(a.config("onShow")).then(function(){a.config("backdrop")&&e.createForElement(a.element,a.config("preventScrolling"),a.config("fixed"))}).then(function(){return a.element.addClass("ui-tour-active-step"),r(a,"uiTourShow")}).then(function(){return i()}).then(function(){return s(a.config("onShown"))}).then(function(){w.emit("stepShown",a),a.isNext=p(),a.isPrev=q()}):b.reject("No step.")},w.hideStep=function(a){return a?s(a.config("onHide")).then(function(){return a.element.removeClass("ui-tour-active-step"),r(a,"uiTourHide")}).then(function(){return i()}).then(function(){return s(a.config("onHidden"))}).then(function(){w.emit("stepHidden",a)}):b.reject("No step.")},w.waitFor=function(a){w.pause(),v=function(b){b.stepId===a&&(k(x[x.indexOf(b)]),w.resume(),v=null)}},w.config=function(a){return B[a]},w.init=function(a){return B=angular.extend(B,a),w.options=B,f._registerTour(w),w.initialized=!0,w.emit("initialized"),w},w.destroy=function(){f._unregisterTour(w)},w.start=function(){return w.startAt(0)},w.startAt=function(a){return s(B.onStart).then(function(){var b=m(a);return k(b),A=z.ON,w.emit("started",b),B.useHotkeys&&t(),w.showStep(j())})},w.end=function(){return s(B.onEnd).then(function(){return j()?(e.hide(),w.hideStep(j())):void 0}).then(function(){k(null),w.emit("ended"),A=z.OFF,B.useHotkeys&&u()})},w.pause=function(){return s(B.onPause).then(function(){return A=z.PAUSED,w.hideStep(j())}).then(function(){w.emit("paused",j())})},w.resume=function(){return s(B.onResume).then(function(){return A=z.ON,w.emit("resumed",j()),w.showStep(j())})},w.next=function(){return w.goTo("$next")},w.prev=function(){return w.goTo("$prev")},w.goTo=function(a){var c=j(),d=m(a),f={$prev:{getStep:o,preEvent:"onPrev",navCheck:"prevStep"},$next:{getStep:n,preEvent:"onNext",navCheck:"nextStep"}};return"$prev"===a||"$next"===a?s(c.config(f[a].preEvent)).then(function(){return w.hideStep(c)}).then(function(){j().config("backdrop")&&!f[a].getStep().config("backdrop")&&e.hide(),c[f[a].navCheck]&&c[f[a].navCheck]===j().stepId||(k(f[a].getStep()),w.emit("stepChanged",j()))}).then(function(){return j()?w.showStep(j()):void w.end()}):d?w.hideStep(j()).then(function(){return j().config("backdrop")&&!d.config("backdrop")&&e.hide(),k(d),w.emit("stepChanged",j()),w.showStep(d)}):b.reject("No step.")},w.getCurrentStep=function(){return j()},w.getStatus=function(){return A},w.status=z,w._getSteps=function(){return x},w._getCurrentStep=j,w._setCurrentStep=k}])}(angular.module("bm.uiTour")),function(a){"use strict";a.directive("uiTour",["TourHelpers",function(a){return{restrict:"EA",scope:!0,controller:"uiTourController",link:function(b,c,d,e){var f={name:d.uiTour},g="onReady onStart onEnd onShow onShown onHide onHidden onNext onPrev onPause onResume".split(" "),h="placement animation popupDelay closePopupDelay enable appendToBody popupClass orphan backdrop scrollOffset scrollIntoView useUiRouter useHotkeys".split(" ");a.attachInterpolatedValues(d,f,h,"uiTour"),a.attachEventHandlers(b,d,f,g,"uiTour"),d[a.getAttrName("templateUrl","uiTour")]&&(f.templateUrl=b.$eval(d[a.getAttrName("templateUrl","uiTour")])),d[a.getAttrName("options")]&&angular.extend(f,b.$eval(d[a.getAttrName("options")])),b.tour=e.init(f),"function"==typeof f.onReady&&f.onReady(),b.$on("$destroy",function(){e.destroy()})}}}])}(angular.module("bm.uiTour")),function(a){"use strict";a.factory("TourHelpers",["$templateCache","$http","$compile","$location","TourConfig","$q","$injector",function(a,b,c,d,e,f,g){function h(a){return"true"===a?!0:"false"===a?!1:a}var i,j,k={};return g.has("$state")&&(j=g.get("$state")),i=k.safeApply=function(a,b){var c=a.$$phase;"$apply"===c||"$digest"===c?b&&"function"==typeof b&&b():a.$apply(b)},k.attachTourConfigProperties=function(a,b,c,d){angular.forEach(d,function(a){!b[k.getAttrName(a)]&&angular.isDefined(c.config(a))&&b.$set(k.getAttrName(a),String(c.config(a)))})},k.attachEventHandlers=function(a,b,c,d,e){angular.forEach(d,function(d){var g=k.getAttrName(d,e);b[g]&&(c[d]=function(){return f(function(c){i(a,function(){c(a.$eval(b[g]))})})})})},k.attachInterpolatedValues=function(a,b,c,d){angular.forEach(c,function(c){var e=k.getAttrName(c,d);a[e]&&(b[c]=h(a[e]),a.$observe(e,function(a){b[c]=h(a)}))})},k.setRedirect=function(a,b,c,e,g){var h=a[c];a[c]=function(c){return f(function(f){h&&h(c),b.waitFor(g),a.config("useUiRouter")?j.transitionTo(e).then(f):(d.path(e),f())})}},k.getAttrName=function(a,b){return(b||"tourStep")+a.charAt(0).toUpperCase()+a.substr(1)},k}])}(angular.module("bm.uiTour")),function(a){"use strict";a.factory("uiTourService",["$controller",function(a){var b={},c=[];return b.getTour=function(){return c[0]},b.getTourByName=function(a){return c.filter(function(b){return b.options.name===a})[0]},b.getTourByElement=function(a){return angular.element(a).controller("uiTour")},b.createDetachedTour=function(b,c){if(!b)throw{name:"ParameterMissingError",message:"A unique tour name is required for creating a detached tour."};return c=c||{},c.name=b,a("uiTourController").init(c)},b._registerTour=function(a){c.push(a)},b._unregisterTour=function(a){c.splice(c.indexOf(a),1)},b}])}(angular.module("bm.uiTour")),function(a){"use strict";a.directive("tourStep",["TourConfig","TourHelpers","uiTourService","$uibTooltip","$q","$sce",function(a,b,c,d,e,f){var g=d("tourStep","tourStep","uiTourShow",{popupDelay:1});return{restrict:"EA",scope:!0,require:"?^uiTour",compile:function(a,d){d.tourStep||d.$set("tourStep","'PH'");var e=g.compile(a,d);return function(a,d,g,h){function i(){b.attachTourConfigProperties(a,g,m,p,"tourStep"),e(a,d,g)}var j;if(g[b.getAttrName("belongsTo")]?j=c.getTourByName(g[b.getAttrName("belongsTo")]):h&&(j=h),!j)throw{name:"DependencyMissingError",message:"No tour provided for tour step."};var k,l,m={stepId:g.tourStep,enabled:!0,config:function(a){return angular.isDefined(m[a])?m[a]:j.config(a)}},n="onShow onShown onHide onHidden onNext onPrev".split(" "),o="content title animation placement backdrop orphan popupDelay popupCloseDelay popupClass fixed preventScrolling scrollIntoView nextStep prevStep nextPath prevPath scrollOffset".split(" "),p="animation appendToBody placement popupDelay popupCloseDelay".split(" ");b.attachInterpolatedValues(g,m,o),k=g.$observe(b.getAttrName("order"),function(a){m.order=isNaN(1*a)?0:1*a,j.hasStep(m)&&j.reorderStep(m)}),l=g.$observe(b.getAttrName("enabled"),function(a){m.enabled="false"!==a,m.enabled?j.addStep(m):j.removeStep(m)}),b.attachEventHandlers(a,g,m,n),g[b.getAttrName("templateUrl")]&&(m.templateUrl=a.$eval(g[b.getAttrName("templateUrl")])),g[b.getAttrName("options")]&&angular.extend(m,a.$eval(g[b.getAttrName("options")])),m.nextPath&&(m.redirectNext=!0,b.setRedirect(m,j,"onNext",m.nextPath,m.nextStep)),m.prevPath&&(m.redirectPrev=!0,b.setRedirect(m,j,"onPrev",m.prevPath,m.prevStep)),m.trustedContent=f.trustAsHtml(m.content),a.tourStep=m,a.tour=a.tour||j,j.initialized?(i(),j.addStep(m)):j.once("initialized",function(){i(),j.addStep(m)}),Object.defineProperties(m,{element:{value:d}}),a.$on("$destroy",function(){j.removeStep(m),k(),l()})}}}}]),a.directive("tourStepPopup",["TourConfig","smoothScroll","ezComponentHelpers",function(a,b,c){return{restrict:"EA",replace:!0,scope:{title:"@",uibTitle:"@uibTitle",content:"@",placement:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"tour-step-popup.html",link:function(d,e,f){var g=d.originScope().tourStep,h=c.apply(null,arguments),i=g.config("scrollOffset");!d.title&&d.uibTitle&&(d.title=d.uibTitle),f.$set("uib-popover-popup","uib-popover-popup"),e.css({zIndex:a.get("backdropZIndex")+2,display:"block"}),e.addClass(g.config("popupClass")),g.config("fixed")&&e.css("position","fixed"),g.config("orphan")&&h.useStyles(":scope { position: fixed; top: 50% !important; left: 50% !important; margin: 0 !important; -ms-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%);}.arrow { display: none;}"),d.$watch("isOpen",function(a){a()&&!g.config("orphan")&&g.config("scrollIntoView")&&b(e[0],{offset:i})})}}}])}(angular.module("bm.uiTour")),angular.module("bm.uiTour").run(["$templateCache",function(a){a.put("tour-step-popup.html",'
\n
\n\n
\n

\n
\n
\n
\n'),a.put("tour-step-template.html",'
\n
\n
\n
\n \n \n \n
\n \n
\n
\n')}]),function(a){function b(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}b.prototype=a.Event.prototype,a.CustomEvent=b}(window); \ No newline at end of file +!function(a){"use strict";a.config(["$uibTooltipProvider",function(a){a.setTriggers({uiTourShow:"uiTourHide"})}])}(angular.module("bm.uiTour",["ngSanitize","ui.bootstrap","smoothScroll","ezNg","cfp.hotkeys"])),function(a){"use strict";a.factory("uiTourBackdrop",["TourConfig","$document","$uibPosition",function(a,b,c){function d(){j.addClass("no-scrolling"),j.on("touchmove",l)}function e(){j.removeClass("no-scrolling"),j.off("touchmove",l)}function f(b){b.addClass("tour-backdrop").css({display:"none",zIndex:a.get("backdropZIndex")}),j.append(b)}function g(){k.top.css("display","block"),k.bottom.css("display","block"),k.left.css("display","block"),k.right.css("display","block")}function h(){k.top.css("display","none"),k.bottom.css("display","none"),k.left.css("display","none"),k.right.css("display","none")}var i={},j=angular.element(b[0].body),k={top:angular.element(b[0].createElement("div")),bottom:angular.element(b[0].createElement("div")),left:angular.element(b[0].createElement("div")),right:angular.element(b[0].createElement("div"))},l=function(a){a.preventDefault()};return function(){var a=".no-scrolling",c="height: 100%; overflow: hidden;",d=b[0].createElement("style");d.type="text/css",b[0].getElementsByTagName("head")[0].appendChild(d),d.sheet||d.sheet.insertRule?d.sheet.insertRule(a+"{"+c+"}",0):(d.styleSheet||d.sheet).addRule(a,c)}(),f(k.top),f(k.bottom),f(k.left),f(k.right),i.createForElement=function(a,b,e){var f,h,i;b&&d(),f=c.offset(a),h=c.viewportOffset(a),i=c.offset(j),e&&angular.extend(f,h),k.top.css({position:e?"fixed":"absolute",top:0,left:0,width:"100%",height:f.top+"px"}),k.bottom.css({position:e?"fixed":"absolute",left:0,width:"100%",height:i.top+i.height-f.top-f.height+"px",top:f.top+f.height+"px"}),k.left.css({position:e?"fixed":"absolute",top:f.top+"px",width:f.left+"px",height:f.height+"px"}),k.right.css({position:e?"fixed":"absolute",top:f.top+"px",width:i.left+i.width-f.left-f.width+"px",height:f.height+"px",left:f.left+f.width+"px"}),g(),b&&d()},i.hide=function(){h(),e()},i}])}(angular.module("bm.uiTour")),function(a){"use strict";a.provider("TourConfig",[function(){var a={placement:"top",animation:!0,popupDelay:1,closePopupDelay:0,enable:!0,appendToBody:!1,popupClass:"",orphan:!1,backdrop:!1,backdropZIndex:1e4,scrollOffset:100,scrollIntoView:!0,useUiRouter:!1,useHotkeys:!1,onStart:null,onEnd:null,onPause:null,onResume:null,onNext:null,onPrev:null,onShow:null,onShown:null,onHide:null,onHidden:null};this.set=function(b,c){a[b]=c},this.$get=["$q",function(b){var c={};return c.get=function(b){return a[b]},c.getAll=function(){return angular.copy(a)},function(){angular.forEach(a,function(c,d){0===d.indexOf("on")&&angular.isFunction(c)&&(a[d]=function(){return b.resolve(c())})})}(),c}]}])}(angular.module("bm.uiTour")),function(a){"use strict";a.controller("uiTourController",["$timeout","$q","$filter","TourConfig","uiTourBackdrop","uiTourService","ezEventEmitter","hotkeys",function(a,b,c,d,e,f,g,h){function i(){return b(function(b){a(b)})}function j(){return y}function k(a){y=a}function l(a){return j()?x[x.indexOf(j())+a]:null}function m(a){if(angular.isNumber(a))return x[a];if(angular.isString(a))return x.filter(function(b){return b.stepId===a})[0];if(angular.isObject(a)){if(~x.indexOf(a))return a;if(a.stepId)return x.filter(function(b){return b.stepId===a.stepId})[0]}return null}function n(){return l(1)}function o(){return l(-1)}function p(){return!(!n()&&!j().nextPath)}function q(){return!(!o()&&!j().prevPath)}function r(a,c){return b(function(b){a.element[0].dispatchEvent(new CustomEvent(c)),b()})}function s(a){return(a||b.resolve)()}function t(){h.add({combo:"esc",description:"End tour",callback:function(){w.end()}}),h.add({combo:"right",description:"Go to next step",callback:function(){p()&&w.next()}}),h.add({combo:"left",description:"Go to previous step",callback:function(){q()&&w.prev()}})}function u(){h.del("esc"),h.del("right"),h.del("left")}var v,w=this,x=[],y=null,z={OFF:0,ON:1,PAUSED:2},A=z.OFF,B=d.getAll();g.mixin(w),w.addStep=function(a){~x.indexOf(a)||(x.push(a),x=c("orderBy")(x,"order"),w.emit("stepAdded",a),v&&v(a))},w.removeStep=function(a){x.splice(x.indexOf(a),1),w.emit("stepRemoved",a)},w.reorderStep=function(a){w.removeStep(a),w.addStep(a),w.emit("stepsReordered",a)},w.hasStep=function(a){return!!m(a)},w.showStep=function(a){return a?s(a.config("onShow")).then(function(){a.config("backdrop")&&e.createForElement(a.element,a.config("preventScrolling"),a.config("fixed"))}).then(function(){return a.element.addClass("ui-tour-active-step"),r(a,"uiTourShow")}).then(function(){return i()}).then(function(){return s(a.config("onShown"))}).then(function(){w.emit("stepShown",a),a.isNext=p(),a.isPrev=q()}):b.reject("No step.")},w.hideStep=function(a){return a?s(a.config("onHide")).then(function(){return a.element.removeClass("ui-tour-active-step"),r(a,"uiTourHide")}).then(function(){return i()}).then(function(){return s(a.config("onHidden"))}).then(function(){w.emit("stepHidden",a)}):b.reject("No step.")},w.waitFor=function(a){w.pause(),v=function(b){b.stepId===a&&(k(x[x.indexOf(b)]),w.resume(),v=null)}},w.config=function(a){return B[a]},w.init=function(a){return B=angular.extend(B,a),w.options=B,f._registerTour(w),w.initialized=!0,w.emit("initialized"),w},w.destroy=function(){f._unregisterTour(w)},w.start=function(){return w.startAt(0)},w.startAt=function(a){return s(B.onStart).then(function(){var b=m(a);return k(b),A=z.ON,w.emit("started",b),B.useHotkeys&&t(),w.showStep(j())})},w.end=function(){return s(B.onEnd).then(function(){return j()?(e.hide(),w.hideStep(j())):void 0}).then(function(){k(null),w.emit("ended"),A=z.OFF,B.useHotkeys&&u()})},w.pause=function(){return s(B.onPause).then(function(){return A=z.PAUSED,e.hide(),w.hideStep(j())}).then(function(){w.emit("paused",j())})},w.resume=function(){return s(B.onResume).then(function(){return A=z.ON,w.emit("resumed",j()),w.showStep(j())})},w.next=function(){return w.goTo("$next")},w.prev=function(){return w.goTo("$prev")},w.goTo=function(a){var c=j(),d=m(a),f={$prev:{getStep:o,preEvent:"onPrev",navCheck:"prevStep"},$next:{getStep:n,preEvent:"onNext",navCheck:"nextStep"}};return"$prev"===a||"$next"===a?s(c.config(f[a].preEvent)).then(function(){return w.hideStep(c)}).then(function(){j().config("backdrop")&&!f[a].getStep().config("backdrop")&&e.hide(),c[f[a].navCheck]&&c[f[a].navCheck]===j().stepId||(k(f[a].getStep()),w.emit("stepChanged",j()))}).then(function(){return j()?w.showStep(j()):void w.end()}):d?w.hideStep(j()).then(function(){return j().config("backdrop")&&!d.config("backdrop")&&e.hide(),k(d),w.emit("stepChanged",j()),w.showStep(d)}):b.reject("No step.")},w.getCurrentStep=function(){return j()},w.getStatus=function(){return A},w.status=z,w._getSteps=function(){return x},w._getCurrentStep=j,w._setCurrentStep=k}])}(angular.module("bm.uiTour")),function(a){"use strict";a.directive("uiTour",["TourHelpers",function(a){return{restrict:"EA",scope:!0,controller:"uiTourController",link:function(b,c,d,e){var f={name:d.uiTour},g="onReady onStart onEnd onShow onShown onHide onHidden onNext onPrev onPause onResume".split(" "),h="placement animation popupDelay closePopupDelay enable appendToBody popupClass orphan backdrop scrollOffset scrollIntoView useUiRouter useHotkeys".split(" ");a.attachInterpolatedValues(d,f,h,"uiTour"),a.attachEventHandlers(b,d,f,g,"uiTour"),d[a.getAttrName("templateUrl","uiTour")]&&(f.templateUrl=b.$eval(d[a.getAttrName("templateUrl","uiTour")])),d[a.getAttrName("options")]&&angular.extend(f,b.$eval(d[a.getAttrName("options")])),b.tour=e.init(f),"function"==typeof f.onReady&&f.onReady(),b.$on("$destroy",function(){e.destroy()})}}}])}(angular.module("bm.uiTour")),function(a){"use strict";a.factory("TourHelpers",["$templateCache","$http","$compile","$location","TourConfig","$q","$injector",function(a,b,c,d,e,f,g){function h(a){return"true"===a?!0:"false"===a?!1:a}var i,j,k={};return g.has("$state")&&(j=g.get("$state")),i=k.safeApply=function(a,b){var c=a.$$phase;"$apply"===c||"$digest"===c?b&&"function"==typeof b&&b():a.$apply(b)},k.attachTourConfigProperties=function(a,b,c,d){angular.forEach(d,function(a){!b[k.getAttrName(a)]&&angular.isDefined(c.config(a))&&b.$set(k.getAttrName(a),String(c.config(a)))})},k.attachEventHandlers=function(a,b,c,d,e){angular.forEach(d,function(d){var g=k.getAttrName(d,e);b[g]&&(c[d]=function(){return f(function(c){i(a,function(){c(a.$eval(b[g]))})})})})},k.attachInterpolatedValues=function(a,b,c,d){angular.forEach(c,function(c){var e=k.getAttrName(c,d);a[e]&&(b[c]=h(a[e]),a.$observe(e,function(a){b[c]=h(a)}))})},k.setRedirect=function(a,b,c,e,g){var h=a[c];a[c]=function(c){return f(function(f){h&&h(c),b.waitFor(g),a.config("useUiRouter")?j.transitionTo(e).then(f):(d.path(e),f())})}},k.getAttrName=function(a,b){return(b||"tourStep")+a.charAt(0).toUpperCase()+a.substr(1)},k}])}(angular.module("bm.uiTour")),function(a){"use strict";a.factory("uiTourService",["$controller",function(a){var b={},c=[];return b.getTour=function(){return c[0]},b.getTourByName=function(a){return c.filter(function(b){return b.options.name===a})[0]},b.getTourByElement=function(a){return angular.element(a).controller("uiTour")},b.createDetachedTour=function(b,c){if(!b)throw{name:"ParameterMissingError",message:"A unique tour name is required for creating a detached tour."};return c=c||{},c.name=b,a("uiTourController").init(c)},b._registerTour=function(a){c.push(a)},b._unregisterTour=function(a){c.splice(c.indexOf(a),1)},b}])}(angular.module("bm.uiTour")),function(a){"use strict";a.directive("tourStep",["TourConfig","TourHelpers","uiTourService","$uibTooltip","$q","$sce",function(a,b,c,d,e,f){var g=d("tourStep","tourStep","uiTourShow",{popupDelay:1});return{restrict:"EA",scope:!0,require:"?^uiTour",compile:function(a,d){d.tourStep||d.$set("tourStep","'PH'");var e=g.compile(a,d);return function(a,d,g,h){function i(){b.attachTourConfigProperties(a,g,m,p,"tourStep"),e(a,d,g)}var j;if(g[b.getAttrName("belongsTo")]?j=c.getTourByName(g[b.getAttrName("belongsTo")]):h&&(j=h),!j)throw{name:"DependencyMissingError",message:"No tour provided for tour step."};var k,l,m={stepId:g.tourStep,enabled:!0,config:function(a){return angular.isDefined(m[a])?m[a]:j.config(a)}},n="onShow onShown onHide onHidden onNext onPrev".split(" "),o="content title animation placement backdrop orphan popupDelay popupCloseDelay popupClass fixed preventScrolling scrollIntoView nextStep prevStep nextPath prevPath scrollOffset".split(" "),p="animation appendToBody placement popupDelay popupCloseDelay".split(" ");b.attachInterpolatedValues(g,m,o),k=g.$observe(b.getAttrName("order"),function(a){m.order=isNaN(1*a)?0:1*a,j.hasStep(m)&&j.reorderStep(m)}),l=g.$observe(b.getAttrName("enabled"),function(a){m.enabled="false"!==a,m.enabled?j.addStep(m):j.removeStep(m)}),b.attachEventHandlers(a,g,m,n),g[b.getAttrName("templateUrl")]&&(m.templateUrl=a.$eval(g[b.getAttrName("templateUrl")])),g[b.getAttrName("options")]&&angular.extend(m,a.$eval(g[b.getAttrName("options")])),m.nextPath&&(m.redirectNext=!0,b.setRedirect(m,j,"onNext",m.nextPath,m.nextStep)),m.prevPath&&(m.redirectPrev=!0,b.setRedirect(m,j,"onPrev",m.prevPath,m.prevStep)),m.trustedContent=f.trustAsHtml(m.content),a.tourStep=m,a.tour=a.tour||j,j.initialized?(i(),j.addStep(m)):j.once("initialized",function(){i(),j.addStep(m)}),Object.defineProperties(m,{element:{value:d}}),a.$on("$destroy",function(){j.removeStep(m),k(),l()})}}}}]),a.directive("tourStepPopup",["TourConfig","smoothScroll","ezComponentHelpers","$uibPosition",function(a,b,c,d){return{restrict:"A",scope:{uibTitle:"@",contentExp:"&",originScope:"&"},templateUrl:"tour-step-popup.html",link:function(e,f,g){var h=e.originScope().tourStep,i=c.apply(null,arguments),j=h.config("scrollOffset"),k=!1;g.$set("uib-popover-popup","uib-popover-popup"),f.css({zIndex:a.get("backdropZIndex")+2,display:"block"}),f.addClass([h.config("popupClass"),"popover"].join(" ")),h.config("fixed")&&f.css("position","fixed"),h.config("orphan")&&i.useStyles(":scope { position: fixed; top: 50% !important; left: 50% !important; margin: 0 !important; -ms-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%);}.arrow { display: none;}"),e.$watch(function(){var a=d.offset(f),c=a.width&&a.height;c&&!h.config("orphan")&&h.config("scrollIntoView")&&!k&&(k=!0,b(f[0],{offset:j,callbackAfter:function(){k=!1}}))})}}}])}(angular.module("bm.uiTour")),angular.module("bm.uiTour").run(["$templateCache",function(a){a.put("tour-step-popup.html",'
\n\n
\n

\n
\n
\n'),a.put("tour-step-template.html",'
\n
\n
\n
\n \n \n \n
\n \n
\n
\n')}]),function(a){function b(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}b.prototype=a.Event.prototype,a.CustomEvent=b}(window); \ No newline at end of file From 4d5e1c2049d41fa31700a0e192fd771eea155052 Mon Sep 17 00:00:00 2001 From: Ben March Date: Tue, 16 Aug 2016 17:18:07 -0400 Subject: [PATCH 2/2] updated package.json with correct version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b292e5..2e6f83f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "dependencies": { "angular-hotkeys": "1.7.0", "angular-sanitize": ">=1.3", - "angular-ui-bootstrap": ">=0.14.3 <2.0.0", + "angular-ui-bootstrap": ">=2.0.0", "ez-ng": "0.1.8", "ngSmoothScroll": "2.0.0" },