define("qui/controls/elements/List",["qui/QUI","qui/controls/Control","css!qui/controls/elements/List.css"],function(t,e){"use strict";return new Class({Extends:e,Type:"qui/controls/elements/List",Binds:["$itemClick"],options:{styles:!1,checkboxes:!1},initialize:function(t){this.parent(t),this.$items=[]},create:function(){return this.$Elm=new Element("div",{"class":"qui-elements-list"}),this.getAttribute("styles")&&this.$Elm.setStyles(this.getAttribute("styles")),this.refresh(),this.$Elm},refresh:function(){if(this.$Elm){this.$Elm.set("html","");var t,e,i,s,n,l,c,h,m=this,r=function(t){var e=t.target;if(e.hasClass("qui-elements-list-item")||(e=e.getParent(".qui-elements-list-item")),"INPUT"!=t.target.nodeName&&m.getAttribute("checkboxes")){var i=e.getElement('[type="checkbox"]');i.checked=!i.checked}m.$itemClick(e)};for(t=0,e=this.$items.length;e>t;t++)s=this.$items[t],i="",l="",n="","icon"in s&&(i=s.icon),"title"in s&&(l=s.title),"text"in s&&(n=s.text),c=new Element("section",{"class":"qui-elements-list-item smooth",html:'<div class="qui-elements-list-item-icon"><span class="'+i+'"></span></div><div class="qui-elements-list-item-text"><header>'+l+'</header><div class="qui-elements-list-item-description">'+n+"</div></div>",events:{click:r},"data-id":t}).inject(this.$Elm),this.getAttribute("checkboxes")&&(h=new Element("div",{"class":"qui-elements-list-item-checkbox",html:'<input type="checkbox" />'}).inject(c,"top"),c.getElement(".qui-elements-list-item-text").setStyles({width:"calc( 100% - 120px )"}))}},addItem:function(t){return this.$items.push(t),this.refresh(),this},addItems:function(t){for(var e=0,i=t.length;i>e;e++)this.$items.push(t[e]);return this.refresh(),this},getSelectedData:function(){var t,e,i,s=[],n=this.$Elm.getElements("input:checked");for(t=0,e=n.length;e>t;t++)i=n[t].getParent(".qui-elements-list-item").get("data-id"),i in this.$items&&s.push(this.$items[i]);return s},clear:function(){this.$items=[],this.$Elm.set("html","")},$itemClick:function(t){var e=t.get("data-id");"undefined"!=typeof this.$items[e]&&this.fireEvent("click",[this,this.$items[e],t])}})});
//# sourceMappingURL=List.js.map