//>>built
define("dojox/grid/_Layout","dojo/_base/kernel ../main dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/dom-geometry ./cells ./_RowSelector".split(" "),function(v,p,t,r,l,u){return t("dojox.grid._Layout",null,{constructor:function(a){this.grid=a},cells:[],structure:null,defaultWidth:"6em",moveColumn:function(a,c,b,e,h){var k=this.structure[a].cells[0],g=this.structure[c].cells[0],d=null,f=d=0;a=0;for(var m;m=k[a];a++)if(m.index==b){d=a;break}d=k.splice(d,1)[0];d.view=this.grid.views.views[c];
a=0;for(m=null;m=g[a];a++)if(m.index==e){f=a;break}h||(f+=1);g.splice(f,0,d);if(b=this.grid.getCell(this.grid.getSortIndex()))b._currentlySorted=this.grid.getSortAsc();this.cells=[];for(a=b=0;c=this.structure[a];a++)for(e=0;h=c.cells[e];e++)for(k=0;m=h[k];k++)m.index=b,this.cells.push(m),"_currentlySorted"in m&&(g=b+1,g*=m._currentlySorted?1:-1,this.grid.sortInfo=g,delete m._currentlySorted),b++;r.forEach(this.cells,function(n){var q=n.markup[2].split(" ");parseInt(q[1].substring(5))!=n.index&&(q[1]=
'idx\x3d"'+n.index+'"',n.markup[2]=q.join(" "))});this.grid.setupHeaderMenu()},setColumnVisibility:function(a,c){var b=this.cells[a];if(b.hidden==c){b.hidden=!c;var e=b.view,h=e.viewWidth;h&&"auto"!=h&&(e._togglingColumn=u.getMarginBox(b.getHeaderNode()).w||0);e.update();return!0}return!1},addCellDef:function(a,c,b){var e=this,h=function(k){var g=0;1<k.colSpan?g=0:(g=k.width||e._defaultCellProps.width||e.defaultWidth,isNaN(g)||(g+="em"));return g};a={grid:this.grid,subrow:a,layoutIndex:c,index:this.cells.length};
if(b&&b instanceof p.grid.cells._Base)return c=l.clone(b),a.unitWidth=h(c._props),c=l.mixin(c,this._defaultCellProps,b._props,a);c=b.type||b.cellType||this._defaultCellProps.type||this._defaultCellProps.cellType||p.grid.cells.Cell;l.isString(c)&&(c=l.getObject(c));a.unitWidth=h(b);return new c(l.mixin({},this._defaultCellProps,b,a))},addRowDef:function(a,c){for(var b=[],e=0,h=0,k=!0,g=0,d;d=c[g];g++)d=this.addCellDef(a,g,d),b.push(d),this.cells.push(d),k&&d.relWidth?e+=d.relWidth:d.width&&(d=d.width,
"string"==typeof d&&"%"==d.slice(-1)?h+=window.parseInt(d,10):"auto"==d&&(k=!1));e&&k&&r.forEach(b,function(f){f.relWidth&&(f.width=f.unitWidth=f.relWidth/e*(100-h)+"%")});return b},addRowsDef:function(a){var c=[];if(l.isArray(a))if(l.isArrayLike(a[0]))for(var b=0,e;a&&(e=a[b]);b++)c.push(this.addRowDef(b,e));else c.push(this.addRowDef(0,a));return c},addViewDef:function(a){this._defaultCellProps=a.defaultCell||{};a.width&&"auto"==a.width&&delete a.width;return l.mixin({},a,{cells:this.addRowsDef(a.rows||
a.cells)})},setStructure:function(a){this.fieldIndex=0;this.cells=[];var c=this.structure=[];if(this.grid.rowSelector){var b={type:p._scopeName+".grid._RowSelector"};if(l.isString(this.grid.rowSelector)){var e=this.grid.rowSelector;"false"==e?b=null:"true"!=e&&(b.width=e)}else this.grid.rowSelector||(b=null);b&&c.push(this.addViewDef(b))}var h=function(f){return"name"in f||"field"in f||"get"in f};b=function(f){return l.isArray(f)&&(l.isArray(f[0])||h(f[0]))?!0:!1};e=function(f){return null!==f&&l.isObject(f)&&
("cells"in f||"rows"in f||"type"in f&&!h(f))};if(l.isArrayLike(a)){for(var k=!1,g=0,d;d=a[g];g++)if(e(d)){k=!0;break}if(k)for(g=0;d=a[g];g++)b(d)?c.push(this.addViewDef({cells:d})):e(d)&&c.push(this.addViewDef(d));else c.push(this.addViewDef({cells:a}))}else e(a)&&c.push(this.addViewDef(a));this.cellCount=this.cells.length;this.grid.setupHeaderMenu()}})});