You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/ui/javascripts/libs/list-view.min.js

5 lines
16 KiB

// Last commit: 0bff5bc (2014-04-26 12:06:07 -0500)
// Copyright: ©2012-2013 Erik Bryn, Yapp Inc., and contributors.
!function(){function e(e,t){return e&&t&&e.x===t.x&&e.y===t.y}function t(){var t,n,r;Ember.instrument("view.updateContext.positionElement",this,function(){t=i(this,"element"),n=this.position,r=this._position,n&&t&&(e(n,r)||(Ember.run.schedule("render",this,this._parentView.applyTransform,t,n.x,n.y),this._position=n))},this)}var i=Ember.get;Ember.set,Ember.ListItemViewMixin=Ember.Mixin.create({init:function(){this._super(),this.one("didInsertElement",t)},classNames:["ember-list-item-view"],_position:null,updatePosition:function(e){this.position=e,this._positionElement()},_positionElement:t})}(),function(){function e(e){e.willInsertElement&&e.willInsertElement()}function t(e){e.didInsertElement&&e.didInsertElement()}function i(){var i,o,l,h;i=n(this,"element"),i&&(l=n(this,"context"),this.triggerRecursively("willClearRender"),this.lengthAfterRender>this.lengthBeforeRender&&(this.clearRenderedChildren(),this._childViews.length=this.lengthBeforeRender),l?(o=Ember.RenderBuffer(),o=this.renderToBuffer(o),h=this._childViews.length>0,h&&this.invokeRecursively(e,!1),i.innerHTML=o.innerString?o.innerString():s(o),r(this,"element",i),this.transitionTo("inDOM"),h&&this.invokeRecursively(t,!1)):i.innerHTML="")}var n=Ember.get,r=Ember.set,s=function(e){var t=[],i=e.childBuffers;return Ember.ArrayPolyfills.forEach.call(i,function(e){var i="string"==typeof e;i?t.push(e):e.array(t)}),t.join("")};Ember.ListItemView=Ember.View.extend(Ember.ListItemViewMixin,{updateContext:function(e){var t=n(this,"context");Ember.instrument("view.updateContext.render",this,function(){t!==e&&(r(this,"context",e),e&&e.isController&&r(this,"controller",e))},this)},rerender:function(){Ember.run.scheduleOnce("render",this,i)},_contextDidChange:Ember.observer(i,"context","controller")})}(),function(){var e=Ember.get,t=Ember.set;Ember.ReusableListItemView=Ember.View.extend(Ember.ListItemViewMixin,{init:function(){this._super();var e=Ember.ObjectProxy.create();this.set("context",e),this._proxyContext=e},isVisible:Ember.computed("context.content",function(){return!!this.get("context.content")}),updateContext:function(i){var n=e(this._proxyContext,"content");n!==i&&("inDOM"===this.state&&this.prepareForReuse(i),t(this._proxyContext,"content",i),i&&i.isController&&t(this,"controller",i))},prepareForReuse:Ember.K})}(),function(){function e(e){if(e in i)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),r=0;r<n.length;r++){var s=n[r]+t;if(s in i)return s}return null}var t=document.createElement("div"),i=t.style,n=["Webkit","Moz","O","ms"],r=e("transform"),s=e("perspective"),o=null!==r,l=null!==s;Ember.ListViewHelper={transformProp:r,applyTransform:function(){return o?function(e,t,i){e.style[r]="translate("+t+"px, "+i+"px)"}:function(e,t,i){e.style.top=i+"px",e.style.left=t+"px"}}(),apply3DTransform:function(){return l?function(e,t,i){e.style[r]="translate3d("+t+"px, "+i+"px, 0)"}:o?function(e,t,i){e.style[r]="translate("+t+"px, "+i+"px)"}:function(e,t,i){e.style.top=i+"px",e.style.left=t+"px"}}()}}(),function(){function e(){var e=l(this,"content");e&&e.addArrayObserver(this)}function t(e){this.removeObject(e),e.destroy()}function i(){Ember.run.once(this,"_syncChildViews")}function n(e,t){return l(e,"contentIndex")-l(t,"contentIndex")}function r(){Ember.View.notifyMutationListeners&&Ember.run.once(Ember.View,"notifyMutationListeners")}function s(){var e=l(this,"emptyView");e&&e instanceof Ember.View&&e.removeFromParent()}function o(){var e=l(this,"emptyView");e&&("string"==typeof e&&(e=l(e)||e),e=this.createChildView(e),h(this,"emptyView",e),Ember.CoreView.detect(e)&&(this._createdEmptyView=e),this.unshiftObject(e))}var l=Ember.get,h=Ember.set,c=Math.min,a=Math.max,u=Math.floor,d=Math.ceil,m=Ember.ArrayPolyfills.forEach,f=Ember.create(Ember.ContainerView.proto().domManager);f.prepend=function(e,t){e.$(".ember-list-container").prepend(t),r()},Ember.ListViewMixin=Ember.Mixin.create({itemViewClass:Ember.ReusableListItemView,emptyViewClass:Ember.View,classNames:["ember-list-view"],attributeBindings:["style"],domManager:f,scrollTop:0,bottomPadding:0,_lastEndingIndex:0,