//>>built
define("dgrid/extensions/CompoundColumns",["dojo/_base/lang","dojo/_base/declare","dojo/sniff","dojo/query","../util/misc"],function(r,t,u,p,v){return t(null,{configStructure:function(){function b(c,n,l,k){var g=0,m=function(){},q,h;v.each(c,function(d,p){"string"===typeof d&&(d={label:d});c instanceof Array||d.field||(d.field=p);h=(q=d.children)&&!1!==d.showChildHeaders;d.parentColumn=k;q?null==d.id?d.id=(k&&k.id||n-1)+"-"+f.length:k&&k.id&&(d.id=k.id+"-"+d.id):(e.push(d),f.push(r.delegate(d,{renderHeaderCell:m})),
g++);h||(d=r.delegate(d,{rowSpan:-n}));q&&(g+=d.colSpan=b(q,n+1,h,d));l&&(a[n]||(a[n]=[])).push(d)},this);return g}var c=this.subRows&&this.subRows[0]||this.columns,a=[[]],f=a[0],e=[];a[0].className="dgrid-spacer-row";b(c,1,!0);var c=a.length,l,g,h,m;for(l=0;l<c;l++)for(h=a[l],g=0;g<h.length;g++)m=h[g],1>m.rowSpan&&(m.rowSpan+=c);e=[e];e.headerRows=a;this.subRows=e;this.inherited(arguments)},renderHeader:function(){var b,c=this.subRows[0],a=this.subRows.headerRows[0];this.inherited(arguments);for(b=
c.length;b--;)c[b].headerNode=a[b].headerNode},_findSortArrowParent:function(){var b=this.inherited(arguments),c=p(".dgrid-spacer-row",this.headerNode)[0];if(b&&c.contains(b))return b=b.columnId,b=p(".dgrid-column-"+b,this.headerNode),b[b.length-1]},_configColumn:function(b,c,a){var f=b.parentColumn,e=b.id;f&&(e=0===e.indexOf(a)?e.substring(a.length):e,a=f.id+"-",e=b.id=a+e);this.inherited(arguments,[b,c,a])},cell:function(b,c){if("object"!==typeof c){var a=this.column(c);a&&(c=a.id)}return this.inherited(arguments,
[b,c])},column:function(b){var c=this.inherited(arguments);if(null==c&&"object"!==typeof b){var a="-"+b,f=a.length,e;for(e in this.columns)if(-1!==e.indexOf(a,e.length-f))return this.columns[e]}return c},_updateCompoundHiddenStates:function(b,c){var a=this.columns[b],f;if(!a||a.hidden!==c)for(;a&&a.parentColumn;){a=a.parentColumn;if(f=a.colSpan+=c?-1:1)a.headerNode.colSpan=f;1!==f||c?!f&&c&&this._hideColumn(a.id):this._showColumn(a.id)}},_hideColumn:function(b){var c=this;this._updateCompoundHiddenStates(b,
!0);this.inherited(arguments);u("ff")&&(this.headerNode.style.display="none",setTimeout(function(){c.headerNode.style.display="";c.resize()},0))},_showColumn:function(b){this._updateCompoundHiddenStates(b,!1);this.inherited(arguments)},_getResizedColumnWidths:function(){var b=0,c=this.columns,a;for(a in c)b+=c[a].headerNode.offsetWidth;return{totalWidth:b,lastColId:this.subRows[0][this.subRows[0].length-1].id}}})});
//# sourceMappingURL=CompoundColumns.js.map