Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
value.then(function (resolved) {
// Ensure that we don't overwrite new value
if (get(self, 'value') === value) {
self._setSelectedIndex(resolved);
}
});
} else {
function computeActive(view, routerState) {
if (get(view, 'loading')) { return false; }
var currentWhen = get(view, 'current-when');
var isCurrentWhenSpecified = !!currentWhen;
currentWhen = currentWhen || get(view, 'targetRouteName');
currentWhen = currentWhen.split(' ');
for (var i = 0, len = currentWhen.length; i < len; i++) {
if (isActiveForRoute(view, currentWhen[i], isCurrentWhenSpecified, routerState)) {
return get(view, 'activeClass');
}
}
return false;
}
_currentViewDidChange: observer('currentView', function() {
var currentView = get(this, 'currentView');
if (currentView) {
Ember.assert("You tried to set a current view that already has a parent. Make sure you don't have multiple outlets in the same view.", !get(currentView, '_parentView'));
this.pushObject(currentView);
}
}),
transitioningOut: computed('active', 'willBeActive', function() {
var willBeActive = get(this, 'willBeActive');
if (typeof willBeActive === 'undefined') { return false; }
return get(this, 'active') && !willBeActive && 'ember-transitioning-out';
}),
arrayDidChange(content, start, removed, added) {
var addedViews = [];
var view, item, idx, len, itemViewClass, itemViewProps;
len = content ? get(content, 'length') : 0;
if (len) {
itemViewProps = this._itemViewProps || {};
itemViewClass = this.getAttr('itemViewClass') || get(this, 'itemViewClass');
itemViewClass = readViewFactory(itemViewClass, getOwner(this));
for (idx = start; idx < start + added; idx++) {
item = objectAt(content, idx);
itemViewProps._context = this.keyword ? this.get('context') : item;
itemViewProps.content = item;
itemViewProps.contentIndex = idx;
view = this.createChildView(itemViewClass, itemViewProps);
addedViews.push(view);
}
this.replace(start, 0, addedViews);
}
if (get(this, '_isDisabled')) { return false; }
if (get(this, 'loading')) {
Ember.Logger.warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.');
return false;
}
var targetAttribute2 = this.attrs.target;
if (targetAttribute2 && targetAttribute2 !== '_self') {
return false;
}
var routing = get(this, '_routing');
var targetRouteName = this._computeRouteNameWithQueryParams(get(this, 'targetRouteName'));
var models = get(this, 'models');
var queryParamValues = get(this, 'queryParams.values');
var shouldReplace = get(this, 'attrs.replace');
routing.transitionTo(targetRouteName, models, queryParamValues, shouldReplace);
},
forEach(views, function(view) {
set(view, '_parentView', parentView);
if (!view.container && parentView) {
set(view, 'container', parentView.container);
}
if (!get(view, 'templateData')) {
set(view, 'templateData', templateData);
}
});
},
loading: computed('_modelsAreLoaded', 'qualifiedRouteName', function computeLinkToComponentLoading() {
let qualifiedRouteName = get(this, 'qualifiedRouteName');
let modelsAreLoaded = get(this, '_modelsAreLoaded');
if (!modelsAreLoaded || qualifiedRouteName == null) {
return get(this, 'loadingClass');
}
}),
render(renderNode, env, scope, params, hash, template, inverse, visitor) {
var state = renderNode.state;
var parentView = env.view;
var outletState = state.outletState;
var toRender = outletState.render;
var namespace = env.container.lookup('application:main');
var LOG_VIEW_LOOKUPS = get(namespace, 'LOG_VIEW_LOOKUPS');
var ViewClass = outletState.render.ViewClass;
if (!state.hasParentOutlet && !ViewClass) {
ViewClass = env.container.lookupFactory('view:toplevel');
}
var options = {
component: ViewClass,
self: toRender.controller,
createOptions: {
controller: toRender.controller
}
};
template = template || toRender.template && toRender.template.raw;
selection = content ? content.find(function(obj) {
return value === (valuePath ? get(obj, valuePath) : obj);
}) : null;