//>>built
define("dgrid/ColumnSet",["dojo/_base/kernel","dojo/_base/declare","dojo/_base/Deferred","dojo/on","dojo/aspect","dojo/query","dojo/has","put-selector/put","xstyle/has-class","./Grid","dojo/_base/sniff","xstyle/css!./css/columnset.css"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a){_7.add("event-mousewheel",function(_b,_c,_d){return typeof _d.onmousewheel!=="undefined";});_7.add("event-wheel",function(_e,_f,_10){var _11=false;try{WheelEvent("wheel");_11=true;}catch(e){}finally{return _11;}});var _12="data-dgrid-column-set-id";_9("safari","ie-7");function _13(_14){var _15=_14.domNode,_16=_14._columnSetScrollers,_17=_14._columnSetScrollerContents,_18=_14.columnSets,_19=0,_1a=0,i,l,_1b,_1c;for(i=0,l=_18.length;i<l;i++){_19+=_1a;_1b=_6(".dgrid-column-set["+_12+"=\""+i+"\"]",_15)[0];_1a=_1b.offsetWidth;_1c=_1b.firstChild.offsetWidth;_17[i].style.width=_1c+"px";_16[i].style.width=_1a+"px";_16[i].style.overflowX=_1c>_1a?"scroll":"auto";_16[i].style.left=_19+"px";}};function _1d(_1e,row){var _1f=_1e._columnSetScrollLefts;function _20(){_6(".dgrid-column-set",row).forEach(function(_21){_21.scrollLeft=_1f[_21.getAttribute(_12)];});};if(_7("ie")<8||_7("quirks")){setTimeout(_20,1);}else{_20();}};function _22(_23,_24,_25){var id=_24.getAttribute(_12),_26=_23._columnSetScrollers[id],_27=_26.scrollLeft+_25;_26.scrollLeft=_27<0?0:_27;};var _28;if(!_7("touch")){_28=_7("event-mousewheel")||_7("event-wheel")?function(_29){return function(_2a,_2b){return _4(_2a,_7("event-wheel")?"wheel":"mousewheel",function(_2c){var _2d=_2c.target,_2e;if(_2d.nodeType!==1){_2d=_2d.parentNode;}while(!_6.matches(_2d,".dgrid-column-set["+_12+"]",_2a)){if(_2d===_2a||!(_2d=_2d.parentNode)){return;}}_2e=_2c.deltaX||-_2c.wheelDeltaX/3;if(_2e){_2b.call(null,_29,_2d,_2e);}});};}:function(_2f){return function(_30,_31){return _4(_30,".dgrid-column-set["+_12+"]:MozMousePixelScroll",function(_32){if(_32.axis===1){_31.call(null,_2f,this,_32.detail);}});};};}return _2("dgrid.ColumnSet",null,{postCreate:function(){this.inherited(arguments);if(!_7("touch")){this.on(_28(this),function(_33,_34,_35){var id=_34.getAttribute(_12),_36=_33._columnSetScrollers[id],_37=_36.scrollLeft+_35;_36.scrollLeft=_37<0?0:_37;});}},columnSets:[],createRowCells:function(tag,_38){var row=_8("table.dgrid-row-table");var tr=_8(row,"tbody tr");for(var i=0,l=this.columnSets.length;i<l;i++){var _39=_8(tr,tag+".dgrid-column-set-cell.dgrid-column-set-"+i+" div.dgrid-column-set["+_12+"="+i+"]");_39.appendChild(this.inherited(arguments,[tag,_38,this.columnSets[i]]));}return row;},renderArray:function(){var _3a=this,_3b=this.inherited(arguments);_3.when(_3b,function(_3c){for(var i=0;i<_3c.length;i++){_1d(_3a,_3c[i]);}});return _3b;},renderHeader:function(){this.inherited(arguments);this.bodyNode.style.bottom="17px";var _3d=this.columnSets,_3e=this.domNode,_3f=this._columnSetScrollers,_40=this._columnSetScrollerContents={},_41=this._columnSetScrollLefts={},_42=this,i,l;function _43(){var _44=this.scrollLeft;var _45=this.getAttribute(_12);if(_41[_45]!=_44){_41[_45]=_44;_6(".dgrid-column-set["+_12+"=\""+_45+"\"],.dgrid-column-set-scroller["+_12+"=\""+_45+"\"]",_3e).forEach(function(_46){_46.scrollLeft=_44;});}};function _47(_48,i){var _49=_3f[i]=_8(_3e,"div.dgrid-column-set-scroller.dgrid-scrollbar-height.dgrid-column-set-scroller-"+i+"["+_12+"="+i+"]");_40[i]=_8(_49,"div.dgrid-column-set-scroller-content");_4(_49,"scroll",_43);};function _4a(){_13(_42);};if(_3f){for(i in _3f){_8(_3f[i],"!");}}else{_5.after(this,"resize",_4a,true);_5.after(this,"styleColumn",_4a,true);_4(_3e,".dgrid-column-set:dgrid-cellfocusin",_43);}_3f=this._columnSetScrollers={};for(i=0,l=_3d.length;i<l;i++){_47(_3d[i],i);}_13(this);},styleColumnSet:function(_4b,css){var _4c=this.addCssRule("#"+this.domNode.id+" .dgrid-column-set-"+_4b,css);_13(this);return _4c;},_destroyColumns:function(){var _4d=this.columnSets.length,i,j,k,_4e,len,_4f,_50,_51;for(i=0;i<_4d;i++){_4f=this.columnSets[i];for(j=0,_4e=_4f.length;j<_4e;j++){_50=_4f[j];for(k=0,len=_50.length;k<len;k++){_51=_50[k];if(typeof _51.destroy==="function"){_51.destroy();}}}}},configStructure:function(){this.columns={};for(var i=0,l=this.columnSets.length;i<l;i++){var _52=this.columnSets[i];for(var j=0;j<_52.length;j++){_52[j]=this._configColumns(i+"-"+j+"-",_52[j]);}}},_setColumnSets:function(_53){this._destroyColumns();this.columnSets=_53;this._updateColumns();},setColumnSets:function(_54){_1.deprecated("setColumnSets(...)","use set(\"columnSets\", ...) instead","dgrid 1.0");this.set("columnSets",_54);}});});