(js/css) Update generated files

This commit is contained in:
InverseBot
2016-05-18 02:10:53 -04:00
parent 669eee301b
commit 4b0fadbe22
6 changed files with 129 additions and 93 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+121 -85
View File
@@ -1,6 +1,6 @@
/**
* State-based routing for AngularJS
* @version v0.2.18
* @version v0.3.0
* @link http://angular-ui.github.com/
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
@@ -2274,6 +2274,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {
if (name.indexOf('@') < 0) name += '@' + state.parent.name;
view.resolveAs = view.resolveAs || state.resolveAs || '$resolve';
views[name] = view;
});
return views;
@@ -3606,6 +3607,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
// Provide access to the state itself for internal use
result.$$state = state;
result.$$controllerAs = view.controllerAs;
result.$$resolveAs = view.resolveAs;
dst[name] = result;
}));
});
@@ -3652,7 +3654,15 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
angular.module('ui.router.state')
.factory('$stateParams', function () { return {}; })
.provider('$state', $StateProvider);
.constant("$state.runtime", { autoinject: true })
.provider('$state', $StateProvider)
// Inject $state to initialize when entering runtime. #2574
.run(['$injector', function ($injector) {
// Allow tests (stateSpec.js) to turn this off by defining this constant
if ($injector.get("$state.runtime").autoinject) {
$injector.get('$state');
}
}]);
$ViewProvider.$inject = [];
@@ -3753,8 +3763,6 @@ function $ViewScrollProvider() {
angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);
var ngMajorVer = angular.version.major;
var ngMinorVer = angular.version.minor;
/**
* @ngdoc directive
* @name ui.router.state.directive:ui-view
@@ -3779,34 +3787,31 @@ var ngMinorVer = angular.version.minor;
* service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
* scroll ui-view elements into view when they are populated during a state activation.
*
* @param {string=} noanimation If truthy, the non-animated renderer will be selected (no animations
* will be applied to the ui-view)
*
* *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
* functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
*
* @param {string=} onload Expression to evaluate whenever the view updates.
*
*
* @example
* A view can be unnamed or named.
* A view can be unnamed or named.
* <pre>
* <!-- Unnamed -->
* <div ui-view></div>
*
* <div ui-view></div>
*
* <!-- Named -->
* <div ui-view="viewName"></div>
* </pre>
*
* You can only have one unnamed view within any template (or root html). If you are only using a
* You can only have one unnamed view within any template (or root html). If you are only using a
* single view and it is unnamed then you can populate it like so:
* <pre>
* <div ui-view></div>
* <div ui-view></div>
* $stateProvider.state("home", {
* template: "<h1>HELLO!</h1>"
* })
* </pre>
*
* The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}
*
* The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#methods_state `views`}
* config property, by name, in this case an empty name:
* <pre>
* $stateProvider.state("home", {
@@ -3817,13 +3822,13 @@ var ngMinorVer = angular.version.minor;
* }
* })
* </pre>
*
* But typically you'll only use the views property if you name your view or have more than one view
* in the same template. There's not really a compelling reason to name a view if its the only one,
*
* But typically you'll only use the views property if you name your view or have more than one view
* in the same template. There's not really a compelling reason to name a view if its the only one,
* but you could if you wanted, like so:
* <pre>
* <div ui-view="main"></div>
* </pre>
* </pre>
* <pre>
* $stateProvider.state("home", {
* views: {
@@ -3833,14 +3838,14 @@ var ngMinorVer = angular.version.minor;
* }
* })
* </pre>
*
*
* Really though, you'll use views to set up multiple views:
* <pre>
* <div ui-view></div>
* <div ui-view="chart"></div>
* <div ui-view="data"></div>
* <div ui-view="chart"></div>
* <div ui-view="data"></div>
* </pre>
*
*
* <pre>
* $stateProvider.state("home", {
* views: {
@@ -3870,9 +3875,28 @@ var ngMinorVer = angular.version.minor;
* <ui-view autoscroll='false'/>
* <ui-view autoscroll='scopeVariable'/>
* </pre>
*
* Resolve data:
*
* The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this
* can be customized using [[ViewDeclaration.resolveAs]]). This can be then accessed from the template.
*
* Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the
* controller is instantiated. The `$onInit()` hook can be used to perform initialization code which
* depends on `$resolve` data.
*
* Example usage of $resolve in a view template
* <pre>
* $stateProvider.state('home', {
* template: '<my-component user="$resolve.user"></my-component>',
* resolve: {
* user: function(UserService) { return UserService.fetchUser(); }
* }
* });
* </pre>
*/
$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate'];
function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate) {
$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate', '$q'];
function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate, $q) {
function getService() {
return ($injector.has) ? function(service) {
@@ -3893,35 +3917,24 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
// Returns a set of DOM manipulation functions based on which Angular version
// it should use
function getRenderer(attrs, scope) {
var statics = {
enter: function (element, target, cb) { target.after(element); cb(); },
leave: function (element, cb) { element.remove(); cb(); }
var statics = function() {
return {
enter: function (element, target, cb) { target.after(element); cb(); },
leave: function (element, cb) { element.remove(); cb(); }
};
};
if (!!attrs.noanimation) return statics;
function animEnabled(element) {
if (ngMajorVer === 1 && ngMinorVer >= 4) return !!$animate.enabled(element);
if (ngMajorVer === 1 && ngMinorVer >= 2) return !!$animate.enabled();
return (!!$animator);
}
// ng 1.2+
if ($animate) {
return {
enter: function(element, target, cb) {
if (!animEnabled(element)) {
statics.enter(element, target, cb);
} else if (angular.version.minor > 2) {
if (angular.version.minor > 2) {
$animate.enter(element, null, target).then(cb);
} else {
$animate.enter(element, null, target, cb);
}
},
leave: function(element, cb) {
if (!animEnabled(element)) {
statics.leave(element, cb);
} else if (angular.version.minor > 2) {
if (angular.version.minor > 2) {
$animate.leave(element).then(cb);
} else {
$animate.leave(element, cb);
@@ -3930,7 +3943,6 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
};
}
// ng 1.1.5
if ($animator) {
var animate = $animator && $animator(scope, attrs);
@@ -3940,7 +3952,7 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
};
}
return statics;
return statics();
}
var directive = {
@@ -3953,7 +3965,8 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
var previousEl, currentEl, currentScope, latestLocals,
onloadExp = attrs.onload || '',
autoScrollExp = attrs.autoscroll,
renderer = getRenderer(attrs, scope);
renderer = getRenderer(attrs, scope),
inherited = $element.inheritedData('$uiView');
scope.$on('$stateChangeSuccess', function() {
updateView(false);
@@ -3962,45 +3975,34 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
updateView(true);
function cleanupLastView() {
var _previousEl = previousEl;
var _currentScope = currentScope;
if (_currentScope) {
_currentScope._willBeDestroyed = true;
if (previousEl) {
previousEl.remove();
previousEl = null;
}
function cleanOld() {
if (_previousEl) {
_previousEl.remove();
}
if (_currentScope) {
_currentScope.$destroy();
}
if (currentScope) {
currentScope.$destroy();
currentScope = null;
}
if (currentEl) {
var $uiViewData = currentEl.data('$uiView');
renderer.leave(currentEl, function() {
cleanOld();
$uiViewData.$$animLeave.resolve();
previousEl = null;
});
previousEl = currentEl;
} else {
cleanOld();
previousEl = null;
currentEl = null;
}
currentEl = null;
currentScope = null;
}
function updateView(firstTime) {
var newScope,
name = getUiViewName(scope, attrs, $element, $interpolate),
name = getUiViewName(scope, attrs, inherited, $interpolate),
previousLocals = name && $state.$current && $state.$current.locals[name];
if (!firstTime && previousLocals === latestLocals || scope._willBeDestroyed) return; // nothing to do
if (!firstTime && previousLocals === latestLocals) return; // nothing to do
newScope = scope.$new();
latestLocals = $state.$current.locals[name];
@@ -4019,7 +4021,16 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
newScope.$emit('$viewContentLoading', name);
var clone = $transclude(newScope, function(clone) {
renderer.enter(clone, $element, function onUiViewEnter() {
var animEnter = $q.defer(), animLeave = $q.defer();
var viewData = {
name: name,
$animEnter: animEnter.promise,
$animLeave: animLeave.promise,
$$animLeave: animLeave
};
renderer.enter(clone.data('$uiView', viewData), $element, function onUiViewEnter() {
animEnter.resolve();
if(currentScope) {
currentScope.$emit('$viewContentAnimationEnded');
}
@@ -4063,16 +4074,19 @@ function $ViewDirectiveFill ( $compile, $controller, $state, $interpolate
var initial = tElement.html();
return function (scope, $element, attrs) {
var current = $state.$current,
name = getUiViewName(scope, attrs, $element, $interpolate),
locals = current && current.locals[name];
$uiViewData = $element.data('$uiView'),
locals = current && current.locals[$uiViewData.name];
if (! locals) {
return;
}
$element.data('$uiView', { name: name, state: locals.$$state });
extend($uiViewData, { state: locals.$$state });
$element.html(locals.$template ? locals.$template : initial);
var resolveData = angular.extend({}, locals);
scope[locals.$$resolveAs] = resolveData;
var link = $compile($element.contents());
if (locals.$$controller) {
@@ -4081,7 +4095,9 @@ function $ViewDirectiveFill ( $compile, $controller, $state, $interpolate
var controller = $controller(locals.$$controller, locals);
if (locals.$$controllerAs) {
scope[locals.$$controllerAs] = controller;
scope[locals.$$controllerAs][locals.$$resolveAs] = resolveData;
}
if (isFunction(controller.$onInit)) controller.$onInit();
$element.data('$ngControllerController', controller);
$element.children().data('$ngControllerController', controller);
}
@@ -4096,9 +4112,8 @@ function $ViewDirectiveFill ( $compile, $controller, $state, $interpolate
* Shared ui-view code for both directives:
* Given scope, element, and its attributes, return the view's name
*/
function getUiViewName(scope, attrs, element, $interpolate) {
function getUiViewName(scope, attrs, inherited, $interpolate) {
var name = $interpolate(attrs.uiView || attrs.name || '')(scope);
var inherited = element.inheritedData('$uiView');
return name.indexOf('@') >= 0 ? name : (name + '@' + (inherited ? inherited.state.name : ''));
}
@@ -4181,7 +4196,7 @@ function defaultOpts(el, $state) {
* to the state that the link lives in, in other words the state that loaded the
* template containing the link.
*
* You can specify options to pass to {@link ui.router.state.$state#go $state.go()}
* You can specify options to pass to {@link ui.router.state.$state#methods_go $state.go()}
* using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,
* and `reload`.
*
@@ -4218,7 +4233,7 @@ function defaultOpts(el, $state) {
* </pre>
*
* @param {string} ui-sref 'stateName' can be any valid absolute or relative state
* @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}
* @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#methods_go $state.go()}
*/
$StateRefDirective.$inject = ['$state', '$timeout'];
function $StateRefDirective($state, $timeout) {
@@ -4230,6 +4245,8 @@ function $StateRefDirective($state, $timeout) {
var def = { state: ref.state, href: null, params: null };
var type = getTypeInfo(element);
var active = uiSrefActive[1] || uiSrefActive[0];
var unlinkInfoFn = null;
var hookFn;
def.options = extend(defaultOpts(element, $state), attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {});
@@ -4237,7 +4254,8 @@ function $StateRefDirective($state, $timeout) {
if (val) def.params = angular.copy(val);
def.href = $state.href(ref.state, def.params, def.options);
if (active) active.$$addStateInfo(ref.state, def.params);
if (unlinkInfoFn) unlinkInfoFn();
if (active) unlinkInfoFn = active.$$addStateInfo(ref.state, def.params);
if (def.href !== null) attrs.$set(type.attr, def.href);
};
@@ -4248,7 +4266,11 @@ function $StateRefDirective($state, $timeout) {
update();
if (!type.clickable) return;
element.bind("click", clickHook(element, $state, $timeout, type, function() { return def; }));
hookFn = clickHook(element, $state, $timeout, type, function() { return def; });
element.bind("click", hookFn);
scope.$on('$destroy', function() {
element.unbind("click", hookFn);
});
}
};
}
@@ -4266,8 +4288,8 @@ function $StateRefDirective($state, $timeout) {
* params and override options.
*
* @param {string} ui-state 'stateName' can be any valid absolute or relative state
* @param {Object} ui-state-params params to pass to {@link ui.router.state.$state#href $state.href()}
* @param {Object} ui-state-opts options to pass to {@link ui.router.state.$state#go $state.go()}
* @param {Object} ui-state-params params to pass to {@link ui.router.state.$state#methods_href $state.href()}
* @param {Object} ui-state-opts options to pass to {@link ui.router.state.$state#methods_go $state.go()}
*/
$StateRefDynamicDirective.$inject = ['$state', '$timeout'];
function $StateRefDynamicDirective($state, $timeout) {
@@ -4280,12 +4302,15 @@ function $StateRefDynamicDirective($state, $timeout) {
var group = [attrs.uiState, attrs.uiStateParams || null, attrs.uiStateOpts || null];
var watch = '[' + group.map(function(val) { return val || 'null'; }).join(', ') + ']';
var def = { state: null, params: null, options: null, href: null };
var unlinkInfoFn = null;
var hookFn;
function runStateRefLink (group) {
def.state = group[0]; def.params = group[1]; def.options = group[2];
def.href = $state.href(def.state, def.params, def.options);
if (active) active.$$addStateInfo(def.state, def.params);
if (unlinkInfoFn) unlinkInfoFn();
if (active) unlinkInfoFn = active.$$addStateInfo(def.state, def.params);
if (def.href) attrs.$set(type.attr, def.href);
}
@@ -4293,7 +4318,11 @@ function $StateRefDynamicDirective($state, $timeout) {
runStateRefLink(scope.$eval(watch));
if (!type.clickable) return;
element.bind("click", clickHook(element, $state, $timeout, type, function() { return def; }));
hookFn = clickHook(element, $state, $timeout, type, function() { return def; });
element.bind("click", hookFn);
scope.$on('$destroy', function() {
element.unbind("click", hookFn);
});
}
};
}
@@ -4426,8 +4455,9 @@ function $StateRefActiveDirective($state, $stateParams, $interpolate) {
if (isObject(uiSrefActive) && states.length > 0) {
return;
}
addState(newState, newParams, uiSrefActive);
var deregister = addState(newState, newParams, uiSrefActive);
update();
return deregister;
};
$scope.$on('$stateChangeSuccess', update);
@@ -4436,13 +4466,19 @@ function $StateRefActiveDirective($state, $stateParams, $interpolate) {
var state = $state.get(stateName, stateContext($element));
var stateHash = createStateHash(stateName, stateParams);
states.push({
var stateInfo = {
state: state || { name: stateName },
params: stateParams,
hash: stateHash
});
};
states.push(stateInfo);
activeClasses[stateHash] = activeClass;
return function removeState() {
var idx = states.indexOf(stateInfo);
if (idx !== -1) states.splice(idx, 1);
};
}
/**
File diff suppressed because one or more lines are too long