Socket
Socket
Sign inDemoInstall

@grapecity/wijmo.grid.transposedmultirow

Package Overview
Dependencies
Maintainers
1
Versions
863
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grapecity/wijmo.grid.transposedmultirow - npm Package Compare versions

Comparing version 5.20202.698-nightly.d20200715.t020614 to 5.20202.698-rc

4

es2015-commonjs.js
/*!
*
* Wijmo Library 5.20202.698-nightly.d20200715.t020614
* Wijmo Library 5.20202.698
* http://wijmo.com/

@@ -14,2 +14,2 @@ *

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=require("@grapecity/wijmo.grid.transposedmultirow");class _Cell extends wijmo_grid_1.Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&wijmo_1.copy(this,e)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")}}exports._Cell=_Cell;class _MultiRow extends wijmo_grid_1.Row{constructor(e,t){super(e);this._idxData=t}setDataType(e){this._type=e}setDataMap(e){this._map=e}setFormat(e){this._fmt=e}setCssClass(e){this._cssClass=e}setAlign(e){this._align=e}}exports._MultiRow=_MultiRow;class _GridPanel extends wijmo_grid_1.GridPanel{getCellData(e,t,o){if(this.cellType!=wijmo_grid_1.CellType.Cell)return super.getCellData(e,t,o);if(wijmo_1.isString(t)&&(t=this.columns.indexOf(t))<0)throw"Invalid column name or binding.";let l=this.grid,s=l.rows[e],r=s.format,i=null,n=this.findCell(l,e,t);s&&n&&s.setFormat(n.format);try{i=super.getCellData(e,t,o)}finally{s&&n&&s.setFormat(r)}return i}findCell(e,t,o){let l=e._getGroupByRow(t),s=o%e.columnsPerItem;for(let e=0;e<l.cells.length;e++){let o=l.cells[e];if(l._rowstart+o._row==t&&s>=l._colstart+o.col&&s<l._colstart+o.col+o.colspan)return o}return null}}exports._GridPanel=_GridPanel;class TransposedMultiRow extends wijmo_grid_1.FlexGrid{constructor(e,t){super(e);this._keyPrefix="item";wijmo_1.addClass(this.hostElement,"wj-transposed-multirow");this._layout=new _MultiRowLayout(this,null);this.allowDragging=wijmo_grid_1.AllowDragging.None;this.allowSorting=wijmo_grid_1.AllowSorting.None;this.mergeManager=new _MergeManager(this);this.cellFactory=new _CellFactory;this._gpCells=new _GridPanel(this,wijmo_grid_1.CellType.Cell,this._rows,this._cols,this._eCt);this.formatItem.addHandler(this._formatItem,this);this._rowInfo=new wijmo_grid_1.ColumnCollection(this,this.columns.defaultSize);this.initialize(t);this._rowInfo.collectionChanged.addHandler(this._rowInfoChanged,this)}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this._layoutDef=wijmo_1.asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()}getBindingColumn(e,t,o){let l=null;if(e==this.cells){l=this._getGroupByRow(t).getBindingColumn(e,t,o)}return l}get columnsPerItem(){return this._layout._columnsPerItem}get allowAddNew(){return!1}set allowAddNew(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items addition.")}get allowDelete(){return!1}set allowDelete(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items deletion.")}get allowDragging(){return wijmo_grid_1.AllowDragging.None}set allowDragging(e){wijmo_1.assert(e===wijmo_grid_1.AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}}get allowPinning(){return!1}set allowPinning(e){wijmo_1.assert(!e,"TransposedMultiRow does not support pinning.")}get allowSorting(){return wijmo_grid_1.AllowSorting.None}set allowSorting(e){wijmo_1.assert(e===wijmo_grid_1.AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e}get columnLayout(){throw"TransposedMultiRow does not support column layout."}set columnLayout(e){throw"TransposedMultiRow does not support column layout."}refresh(e){let t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else super.refresh(e)}onLoadedRows(e){let t=this.columnHeaders.columns;for(let e=0;e<t.length;e++)this.columnHeaders.setCellData(0,e,"");let o=this.columns;for(let e=0;e<o.length;e++){let t=o[e];t.align=null;t.dataType=0}let l=this.rowHeaders.columns,s=this.rowHeaders.rows;for(let e=0;e<s.length;e++){let t=s[e],o=s[e].index,r=this._getGroupByRow(o);o-=r._rowstart;for(let e=l.length-2;e>=0;e--){let l="";for(let t=0;t<r.cells.length;t++){let s=r.cells[t];if(o>=s.row&&o<s.row+s.rowspan&&e>=s.col&&e<s.col+s.colspan){l=s.header;break}}this.rowHeaders.setCellData(t.index,e+1,l)}}l[0].visible=!1;for(let e=1;e<l.length;e++){l[e].align="left";l[e].visible=!0;l[e].width=this.columns.defaultSize}super.onLoadedRows(e)}_getGroupByRow(e){let t=this._layout._getGroupByRow(e);wijmo_1.assert(t instanceof _CellGroup,"Failed to get the group!");return t}_addBoundRow(e,t){let o=e[t];this.rows.push(new _MultiRow(o,t))}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(wijmo_1.hasItems(e)&&this._layout){let t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}}_getBindingColumn(e,t,o){return this._layout?super._getBindingColumn(e,t,o):this.getBindingColumn(e,t,o.index)}_getCollectionView(e){let t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof wijmo_1.CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;let o=super._getCollectionView(e);t&&o instanceof wijmo_1.CollectionView&&(o.getError=(e,o)=>{let l=e._keys.indexOf(o),s=l%e._bnd.length,r=Math.floor(l/e._bnd.length);return t(e._arr[r],e._bnd[s].path)});return o}_rowInfoChanged(){let e=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;e&&e.isValid&&(this.selection=e)}_formatItem(e,t){let o=this.columnsPerItem,l=t.panel,s=l.cellType,r=l.rows[t.range.row],i=(l.rows[t.range.row2],t.cell);s==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(i,"wj-group-header",0==t.range.row);if(s==wijmo_grid_1.CellType.Cell||s==wijmo_grid_1.CellType.RowHeader){let e=this._getGroupByRow(t.row);wijmo_1.toggleClass(i,"wj-group-start",e._rowstart==t.range.row);wijmo_1.toggleClass(i,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(o>1&&(s==wijmo_grid_1.CellType.Cell||s==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(i,"wj-record-start",t.range.col%o==0);wijmo_1.toggleClass(i,"wj-record-end",t.range.col2%o==o-1)}let n=this.alternatingRowStep;if(n&&s==wijmo_grid_1.CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,o=Math.floor(r.dataIndex/e)*t,l=r.dataIndex%e,s=(o+=this._layout._getGroupIndexByRow(l)+1)%(n+1)==0;wijmo_1.toggleClass(i,"wj-alt",s)}}_sourceViewChanged(e,t){this.activeEditor||this.invalidate()}_transposeItemsSource(e){let t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((o,l)=>{let s=this._createKeys(e);if(this._supportsProxies()){let l=this._createProxy(e,o,s);t.push(l)}else{let l=this._createTransposedObject(e,o,s);t.push(l)}});e instanceof wijmo_1.ObservableArray&&e.collectionChanged.addHandler(()=>{let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(e);this._rowInfoChanged()})}return t}_createKeys(e){let t=Array.apply(null,{length:this.columnsPerItem}),o=e.map((e,o)=>t.map((e,t)=>this._keyPrefix+o+"_"+t));return[].concat.apply([],o)}_supportsProxies(){return null!=window.Proxy}_createProxy(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};return new Proxy(l,{ownKeys:e=>e._keys,getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0,writable:!0}),get:(e,t)=>{let o=e._keys.indexOf(t);if(o>-1){let t=e._bnd,l=e._arr,s=t.length,r=o%s,i=Math.floor(o/s);return t[r].getValue(l[i])}return e[t]},set:(e,t,o)=>{let l=e._keys.indexOf(t);if(l>-1){let t=e._bnd,s=e._arr,r=t.length,i=l%r,n=Math.floor(l/r);t[i].setValue(s[n],o);if(s instanceof wijmo_1.ObservableArray){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,s[n],n);s.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};for(let t=0;t<o.length;t++){let s=o[t];Object.defineProperty(l,s,{enumerable:!0,get:()=>{let o=l._bnd,s=o.length,r=t%s,i=Math.floor(t/s);return o[r].getValue(e[i])},set:o=>{let s=l._bnd,r=s.length,i=t%r,n=Math.floor(t/r);s[i].setValue(e[n],o);if(e instanceof wijmo_1.ObservableArray){let t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e[n],n);e.onCollectionChanged(t)}return!0}})}return l}_getRowInfo(e){let t=[];if(this._layout){let e=this.rowHeaders.columns,o=this.columnsPerItem+1;for(;e.length>o;)e.removeAt(e.length-1);for(;e.length<o;)e.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach(e=>{for(let o=0;o<e.rowspan;o++){let l={bindings:[]};for(let t=0;t<e.colspan;t++)for(let s=0;s<e.cells.length;s++){let r=e.cells[s];if(o>=r.row&&o<r.row+r.rowspan&&t>=r.col&&t<r.col+r.colspan){l.bindings.push(r.binding);break}}t.push(l)}})}return t}}exports.TransposedMultiRow=TransposedMultiRow;class _CellFactory extends wijmo_grid_1.CellFactory{updateCell(e,t,o,l,s,r){if(e.cellType!=wijmo_grid_1.CellType.Cell){super.updateCell(e,t,o,l,s,r);return}let i=e.grid,n=i.rows[t],a=i.columns[o],_=n.dataType,w=n.format,h=n.cssClass,g=n.align,u=n.dataMap,c=this.findCell(i,t,o);if(n){n.setDataType(wijmo_1.getType(n.dataItem[a.binding]));if(c){n.setDataMap(c.dataMap);n.setFormat(c.format);n.setCssClass(c.cssClass);n.setAlign(c.align)}}try{super.updateCell(e,t,o,l,s,r)}finally{if(n){n.setDataType(_);if(c){u&&n.setDataMap(u);n.setFormat(w);n.setCssClass(h);n.setAlign(g)}}}}findCell(e,t,o){let l=e._getGroupByRow(t),s=o%e.columnsPerItem;for(let e=0;e<l.cells.length;e++){let o=l.cells[e];if(l._rowstart+o._row==t&&s>=l._colstart+o.col&&s<l._colstart+o.col+o.colspan)return o}return null}}exports._CellFactory=_CellFactory;class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;this._g=e._grid;t&&wijmo_1.copy(this,t);if(!this._cells)throw"Cell group with no cells?";let o=0,l=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,o,l);)0==(l=(l+1)%this.colspan)&&o++;e.row=o;e.col=l});let s=1,r=1;this._cells.forEach(e=>{s=Math.max(s,e.row+e.rowspan);r=Math.max(r,e.col+e.colspan)});this.rowspan=s;this.colspan=r}_copy(e,t){if("cells"==e){this._cells=[];wijmo_1.isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach(e=>{for(let t=0;t<e.rowspan;t++)for(let o=0;o<e.colspan;o++){let l=(e.row+t)*this.colspan+(e.col+o);this._cols.setAt(l,e);let s=new wijmo_grid_1.CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);this._rng[l]=s}});this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)}getMergedRange(e,t,o){if(o<0)return this._rng[-1];let l=t-this._rowstart,s=o%this.colspan,r=this._rng[l*this.colspan+s];e.cellType==wijmo_grid_1.CellType.RowHeader&&o++;let i=t-l,n=o-s;return r?new wijmo_grid_1.CellRange(i+r.row,n+r.col,i+r.row2,n+r.col2):null}getBindingColumn(e,t,o){if(o<0)return this;let l=t-this._rowstart,s=o%this.colspan;return this._cols[l*this.colspan+s]}_cellFits(e,t,o,l){if(l>0&&l+e.colspan>this.colspan)return!1;for(let s=0;s<e.colspan;s++)if(this._slotTaken(o,l+s,t))return!1;this.colspan=Math.max(this.colspan,l+e.colspan-1);return!0}_slotTaken(e,t,o=this._cells.length){for(let l=0;l<o;l++){let o=this._cells[l];if(e>=o.row&&e<=o.row+o.rowspan-1&&t>=o.col&&t<=o.col+o.colspan-1)return!0}return!1}_updateCellTypes(e){this._cols.forEach(t=>{let o=t;null==o.dataType&&o._binding&&(o.dataType=wijmo_1.getType(o._binding.getValue(e)))})}}exports._CellGroup=_CellGroup;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,l=!0){let s=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:let l=o;e.cellType==wijmo_grid_1.CellType.RowHeader&&l--;let r=s._getGroupByRow(t);wijmo_1.assert(r instanceof _CellGroup,"Failed to get the group!");let i=r.getMergedRange(e,t,l);wijmo_1.assert(i&&i.contains(t,o),"Merged range must contain source cell");return i;case wijmo_grid_1.CellType.ColumnHeader:let n=s.columnsPerItem,a=o-o%n,_=Math.min(a+n-1,e.columns.length-1);return new wijmo_grid_1.CellRange(0,a,e.rows.length-1,_);case wijmo_grid_1.CellType.TopLeft:return new wijmo_grid_1.CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}exports._MergeManager=_MergeManager;class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],o=1;if(e){for(let l=0,s=0;l<e.length;l++){let r=new _CellGroup(this,e[l]);r._rowstart=s;s+=r._rowspan;o=Math.max(o,r._colspan);t.push(r)}t.forEach(e=>{e.closeGroup(o)});this._columnsPerItem=o}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let o=this._bindingGroups;for(let t=0;t<o.length;t++){let l=o[t];if(e>=l._rowstart&&e<=l._rowstart+l._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._updateCellTypes(e)})}}exports._MultiRowLayout=_MultiRowLayout;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=require("@grapecity/wijmo.grid.transposedmultirow");class _MultiRow extends wijmo_grid_1.Row{constructor(e,t){super(e);this._idxData=t}}exports._MultiRow=_MultiRow;class _Cell extends wijmo_grid_1.Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&wijmo_1.copy(this,e)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")}}exports._Cell=_Cell;class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;this._g=e._grid;t&&wijmo_1.copy(this,t);if(!this._cells)throw"Cell group with no cells?";let o=0,l=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,o,l);)0==(l=(l+1)%this.colspan)&&o++;e.row=o;e.col=l});let r=1,s=1;this._cells.forEach(e=>{r=Math.max(r,e.row+e.rowspan);s=Math.max(s,e.col+e.colspan)});this.rowspan=r;this.colspan=s}_copy(e,t){if("cells"==e){this._cells=[];wijmo_1.isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach(e=>{for(let t=0;t<e.rowspan;t++)for(let o=0;o<e.colspan;o++){let l=(e.row+t)*this.colspan+(e.col+o);this._cols.setAt(l,e);let r=new wijmo_grid_1.CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);r.isSingleCell||(this._rng[l]=r)}});this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)}getMergedRange(e,t,o){if(o<0)return this._rng[-1];let l=t-this._rowstart,r=o%this.colspan,s=this._rng[l*this.colspan+r];e.cellType==wijmo_grid_1.CellType.RowHeader&&o++;let i=t-l,n=o-r;return s?new wijmo_grid_1.CellRange(i+s.row,n+s.col,i+s.row2,n+s.col2):null}getBindingColumn(e,t,o){if(o<0)return this;let l=t-this._rowstart,r=o%this.colspan;return this._cols[l*this.colspan+r]}_cellFits(e,t,o,l){if(l>0&&l+e.colspan>this.colspan)return!1;for(let r=0;r<e.colspan;r++)if(this._slotTaken(o,l+r,t))return!1;this.colspan=Math.max(this.colspan,l+e.colspan-1);return!0}_slotTaken(e,t,o=this._cells.length){for(let l=0;l<o;l++){let o=this._cells[l];if(e>=o.row&&e<=o.row+o.rowspan-1&&t>=o.col&&t<=o.col+o.colspan-1)return!0}return!1}_updateCellTypes(e){this._cols.forEach(t=>{let o=t;null==o.dataType&&o._binding&&(o.dataType=wijmo_1.getType(o._binding.getValue(e)))})}}exports._CellGroup=_CellGroup;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,l=!0){let r=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:let l=e.rows[t].dataItem._rowInfo.index,s=o;e.cellType==wijmo_grid_1.CellType.RowHeader&&s--;let i=r._getGroupByRow(t);wijmo_1.assert(i instanceof _CellGroup,"Failed to get the group!");let n=i.getMergedRange(e,l,s);if(n){let o=l,r=t;if(t>0){o=e.rows[t-1].dataItem._rowInfo.index;r=t-1}n.row<=o?n.row=r:n.row=t;let s=l,i=t;if(t<e.rows.length-1){s=e.rows[t+1].dataItem._rowInfo.index;i=t+1}n.row2>=s?n.row2=i:n.row2=t}wijmo_1.assert(!n||n.contains(t,o),"Merged range must contain source cell");return n;case wijmo_grid_1.CellType.ColumnHeader:let a=r.columnsPerItem,_=o-o%a,w=Math.min(_+a-1,e.columns.length-1);return new wijmo_grid_1.CellRange(0,_,e.rows.length-1,w);case wijmo_grid_1.CellType.TopLeft:return new wijmo_grid_1.CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}exports._MergeManager=_MergeManager;class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],o=1;if(e){for(let l=0,r=0;l<e.length;l++){let s=new _CellGroup(this,e[l]);s._rowstart=r;r+=s._rowspan;o=Math.max(o,s._colspan);t.push(s)}t.forEach(e=>{e.closeGroup(o)});this._columnsPerItem=o}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let o=this._bindingGroups;for(let t=0;t<o.length;t++){let l=o[t];if(e>=l._rowstart&&e<=l._rowstart+l._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._updateCellTypes(e)})}}exports._MultiRowLayout=_MultiRowLayout;class TransposedMultiRow extends wijmo_grid_1.FlexGrid{constructor(e,t){super(e);this._bindingColumns={};this._keyPrefix="item";wijmo_1.addClass(this.hostElement,"wj-transposed-multirow");this._layout=new _MultiRowLayout(this,null);this.allowDragging=wijmo_grid_1.AllowDragging.None;this.allowSorting=wijmo_grid_1.AllowSorting.None;this.mergeManager=new _MergeManager(this);this.formatItem.addHandler(this._formatItem,this);this._rowInfo=new wijmo_grid_1.ColumnCollection(this,this.columns.defaultSize);this.initialize(t);this._rowInfo.collectionChanged.addHandler(this._rowInfoChanged,this)}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this._layoutDef=wijmo_1.asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()}getBindingColumn(e,t,o){if(e.cellType!=wijmo_grid_1.CellType.Cell)return null;let l=e.rows[t].dataItem._rowInfo.index,r=l+"_"+o,s=this._bindingColumns[r];if(s)return s;let i=this._getGroupByRow(t).getBindingColumn(e,l,o);if(i){s=new wijmo_grid_1.Column;wijmo_grid_1.FlexGrid._getSerializableProperties(wijmo_grid_1.Column).forEach(e=>{null!=i[e]&&(s[e]=i[e])});let e=Math.floor(o/this.columnsPerItem),t=o%this.columnsPerItem;s.binding=this._keyPrefix+e+"_"+t;this._bindingColumns[r]=s}return s}get columnsPerItem(){return this._layout._columnsPerItem}get allowAddNew(){return!1}set allowAddNew(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items addition.")}get allowDelete(){return!1}set allowDelete(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items deletion.")}get allowDragging(){return wijmo_grid_1.AllowDragging.None}set allowDragging(e){wijmo_1.assert(e===wijmo_grid_1.AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}}get allowPinning(){return!1}set allowPinning(e){wijmo_1.assert(!e,"TransposedMultiRow does not support pinning.")}get allowSorting(){return wijmo_grid_1.AllowSorting.None}set allowSorting(e){wijmo_1.assert(e===wijmo_grid_1.AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e}get columnLayout(){throw"TransposedMultiRow does not support column layout."}set columnLayout(e){throw"TransposedMultiRow does not support column layout."}refresh(e){let t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else super.refresh(e)}onLoadedRows(e){let t=this.columnHeaders.columns;for(let e=0;e<t.length;e++)this.columnHeaders.setCellData(0,e,"");let o=this.columns;for(let e=0;e<o.length;e++){let t=o[e];t.align=null;t.dataType=0}let l=this.rowHeaders.columns;this.rows.forEach(e=>{let t=e.dataItem._rowInfo;if(t)for(let o=l.length-2;o>=0;o--){let l=t.headers[o]||wijmo_1.toHeaderCase(t.bindings[o]);this.rowHeaders.setCellData(e.index,o+1,l)}});l[0].visible=!1;for(let e=1;e<l.length;e++){l[e].align="left";l[e].visible=!0;l[e].width=this.columns.defaultSize}super.onLoadedRows(e)}_getGroupByRow(e){let t=this.cells.rows[e].dataItem._rowInfo.index,o=this._layout._getGroupByRow(t);wijmo_1.assert(o instanceof _CellGroup,"Failed to get the group!");return o}_addBoundRow(e,t){let o=e[t];this.rows.push(new _MultiRow(o,t))}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(wijmo_1.hasItems(e)&&this._layout){let t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}}_getBindingColumn(e,t,o){if(this._layout){e==this.cells&&(o=this.getBindingColumn(e,t,o.index));return o}return super._getBindingColumn(e,t,o)}_getCollectionView(e){let t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof wijmo_1.CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;let o=super._getCollectionView(e);t&&o instanceof wijmo_1.CollectionView&&(o.getError=(e,o)=>{let l=e._keys.indexOf(o),r=l%e._bnd.length,s=Math.floor(l/e._bnd.length);return t(e._arr[s],e._bnd[r].path)});return o}_rowInfoChanged(){let e=this.selection,t=this.itemsSource;this._bindingColumns={};this.itemsSource=null;this.itemsSource=t;e&&e.isValid&&(this.selection=e)}_formatItem(e,t){let o=this.columnsPerItem,l=t.panel,r=l.cellType,s=l.rows[t.range.row],i=(l.rows[t.range.row2],t.cell);r==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(i,"wj-group-header",0==t.range.row);if(r==wijmo_grid_1.CellType.Cell||r==wijmo_grid_1.CellType.RowHeader){let e=this._getGroupByRow(t.row);wijmo_1.toggleClass(i,"wj-group-start",e._rowstart==t.range.row);wijmo_1.toggleClass(i,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(o>1&&(r==wijmo_grid_1.CellType.Cell||r==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(i,"wj-record-start",t.range.col%o==0);wijmo_1.toggleClass(i,"wj-record-end",t.range.col2%o==o-1)}let n=this.alternatingRowStep;if(n&&r==wijmo_grid_1.CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,o=Math.floor(s.dataIndex/e)*t,l=s.dataIndex%e,r=(o+=this._layout._getGroupIndexByRow(l)+1)%(n+1)==0;wijmo_1.toggleClass(i,"wj-alt",r)}}_sourceViewChanged(e,t){this.activeEditor||this.invalidate()}_transposeItemsSource(e){let t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((o,l)=>{let r=this._createKeys(e);if(this._supportsProxies()){let l=this._createProxy(e,o,r);t.push(l)}else{let l=this._createTransposedObject(e,o,r);t.push(l)}});e instanceof wijmo_1.ObservableArray&&e.collectionChanged.addHandler(()=>{let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(e);this._rowInfoChanged()})}return t}_createKeys(e){let t=Array.apply(null,{length:this.columnsPerItem}),o=e.map((e,o)=>t.map((e,t)=>this._keyPrefix+o+"_"+t));return[].concat.apply([],o)}_supportsProxies(){return null!=window.Proxy}_createProxy(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};return new Proxy(l,{ownKeys:e=>e._keys,getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0,writable:!0}),get:(e,t)=>{let o=e._keys.indexOf(t);if(o>-1){let t=e._bnd,l=e._arr,r=t.length,s=o%r,i=Math.floor(o/r);return t[s].getValue(l[i])}return e[t]},set:(e,t,o)=>{let l=e._keys.indexOf(t);if(l>-1){let t=e._bnd,r=e._arr,s=t.length,i=l%s,n=Math.floor(l/s);t[i].setValue(r[n],o);if(r instanceof wijmo_1.ObservableArray){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,r[n],n);r.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};for(let t=0;t<o.length;t++){let r=o[t];Object.defineProperty(l,r,{enumerable:!0,get:()=>{let o=l._bnd,r=o.length,s=t%r,i=Math.floor(t/r);return o[s].getValue(e[i])},set:o=>{let r=l._bnd,s=r.length,i=t%s,n=Math.floor(t/s);r[i].setValue(e[n],o);if(e instanceof wijmo_1.ObservableArray){let t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e[n],n);e.onCollectionChanged(t)}return!0}})}return l}_getRowInfo(e){let t=[];if(this._layout){let e=this.rowHeaders.columns,o=this.columnsPerItem+1;for(;e.length>o;)e.removeAt(e.length-1);for(;e.length<o;)e.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach(e=>{for(let o=0;o<e.rowspan;o++){let l={index:e._rowstart+o,bindings:[],headers:[]};for(let t=0;t<e.colspan;t++)for(let r=0;r<e.cells.length;r++){let s=e.cells[r];if(o>=s.row&&o<s.row+s.rowspan&&t>=s.col&&t<s.col+s.colspan){l.bindings.push(s.binding);l.headers.push(s.header);break}}t.push(l)}})}return t}}exports.TransposedMultiRow=TransposedMultiRow;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
/*!
*
* Wijmo Library 5.20202.698-nightly.d20200715.t020614
* Wijmo Library 5.20202.698
* http://wijmo.com/

@@ -14,2 +14,2 @@ *

import{isString,copy,asInt,assert,getType,isArray,toHeaderCase,addClass,asArray,hasItems,toggleClass,tryCast,Binding,CollectionView,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,_registerModule}from"@grapecity/wijmo";import{Row,CellType,GridPanel,Column,CellRange,ColumnCollection,MergeManager,AllowDragging,AllowSorting,FlexGrid,CellFactory}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";export class _Cell extends Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&copy(this,e)}get row(){return this._row}set row(e){this._row=asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")}}export class _MultiRow extends Row{constructor(e,t){super(e);this._idxData=t}setDataType(e){this._type=e}setDataMap(e){this._map=e}setFormat(e){this._fmt=e}setCssClass(e){this._cssClass=e}setAlign(e){this._align=e}}export class _GridPanel extends GridPanel{getCellData(e,t,l){if(this.cellType!=CellType.Cell)return super.getCellData(e,t,l);if(isString(t)&&(t=this.columns.indexOf(t))<0)throw"Invalid column name or binding.";let s=this.grid,o=s.rows[e],r=o.format,n=null,i=this.findCell(s,e,t);o&&i&&o.setFormat(i.format);try{n=super.getCellData(e,t,l)}finally{o&&i&&o.setFormat(r)}return n}findCell(e,t,l){let s=e._getGroupByRow(t),o=l%e.columnsPerItem;for(let e=0;e<s.cells.length;e++){let l=s.cells[e];if(s._rowstart+l._row==t&&o>=s._colstart+l.col&&o<s._colstart+l.col+l.colspan)return l}return null}}export class TransposedMultiRow extends FlexGrid{constructor(e,t){super(e);this._keyPrefix="item";addClass(this.hostElement,"wj-transposed-multirow");this._layout=new _MultiRowLayout(this,null);this.allowDragging=AllowDragging.None;this.allowSorting=AllowSorting.None;this.mergeManager=new _MergeManager(this);this.cellFactory=new _CellFactory;this._gpCells=new _GridPanel(this,CellType.Cell,this._rows,this._cols,this._eCt);this.formatItem.addHandler(this._formatItem,this);this._rowInfo=new ColumnCollection(this,this.columns.defaultSize);this.initialize(t);this._rowInfo.collectionChanged.addHandler(this._rowInfoChanged,this)}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this._layoutDef=asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()}getBindingColumn(e,t,l){let s=null;if(e==this.cells){s=this._getGroupByRow(t).getBindingColumn(e,t,l)}return s}get columnsPerItem(){return this._layout._columnsPerItem}get allowAddNew(){return!1}set allowAddNew(e){assert(!e,"TransposedMultiRow does not support items addition.")}get allowDelete(){return!1}set allowDelete(e){assert(!e,"TransposedMultiRow does not support items deletion.")}get allowDragging(){return AllowDragging.None}set allowDragging(e){assert(e===AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}}get allowPinning(){return!1}set allowPinning(e){assert(!e,"TransposedMultiRow does not support pinning.")}get allowSorting(){return AllowSorting.None}set allowSorting(e){assert(e===AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e}get columnLayout(){throw"TransposedMultiRow does not support column layout."}set columnLayout(e){throw"TransposedMultiRow does not support column layout."}refresh(e){let t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else super.refresh(e)}onLoadedRows(e){let t=this.columnHeaders.columns;for(let e=0;e<t.length;e++)this.columnHeaders.setCellData(0,e,"");let l=this.columns;for(let e=0;e<l.length;e++){let t=l[e];t.align=null;t.dataType=0}let s=this.rowHeaders.columns,o=this.rowHeaders.rows;for(let e=0;e<o.length;e++){let t=o[e],l=o[e].index,r=this._getGroupByRow(l);l-=r._rowstart;for(let e=s.length-2;e>=0;e--){let s="";for(let t=0;t<r.cells.length;t++){let o=r.cells[t];if(l>=o.row&&l<o.row+o.rowspan&&e>=o.col&&e<o.col+o.colspan){s=o.header;break}}this.rowHeaders.setCellData(t.index,e+1,s)}}s[0].visible=!1;for(let e=1;e<s.length;e++){s[e].align="left";s[e].visible=!0;s[e].width=this.columns.defaultSize}super.onLoadedRows(e)}_getGroupByRow(e){let t=this._layout._getGroupByRow(e);assert(t instanceof _CellGroup,"Failed to get the group!");return t}_addBoundRow(e,t){let l=e[t];this.rows.push(new _MultiRow(l,t))}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(hasItems(e)&&this._layout){let t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}}_getBindingColumn(e,t,l){return this._layout?super._getBindingColumn(e,t,l):this.getBindingColumn(e,t,l.index)}_getCollectionView(e){let t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;let l=super._getCollectionView(e);t&&l instanceof CollectionView&&(l.getError=(e,l)=>{let s=e._keys.indexOf(l),o=s%e._bnd.length,r=Math.floor(s/e._bnd.length);return t(e._arr[r],e._bnd[o].path)});return l}_rowInfoChanged(){let e=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;e&&e.isValid&&(this.selection=e)}_formatItem(e,t){let l=this.columnsPerItem,s=t.panel,o=s.cellType,r=s.rows[t.range.row],n=(s.rows[t.range.row2],t.cell);o==CellType.RowHeader&&toggleClass(n,"wj-group-header",0==t.range.row);if(o==CellType.Cell||o==CellType.RowHeader){let e=this._getGroupByRow(t.row);toggleClass(n,"wj-group-start",e._rowstart==t.range.row);toggleClass(n,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(l>1&&(o==CellType.Cell||o==CellType.ColumnHeader)){toggleClass(n,"wj-record-start",t.range.col%l==0);toggleClass(n,"wj-record-end",t.range.col2%l==l-1)}let i=this.alternatingRowStep;if(i&&o==CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,l=Math.floor(r.dataIndex/e)*t,s=r.dataIndex%e;l+=this._layout._getGroupIndexByRow(s)+1;toggleClass(n,"wj-alt",l%(i+1)==0)}}_sourceViewChanged(e,t){this.activeEditor||this.invalidate()}_transposeItemsSource(e){let t=new ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((l,s)=>{let o=this._createKeys(e);if(this._supportsProxies()){let s=this._createProxy(e,l,o);t.push(s)}else{let s=this._createTransposedObject(e,l,o);t.push(s)}});e instanceof ObservableArray&&e.collectionChanged.addHandler(()=>{let e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);t.onCollectionChanged(e);this._rowInfoChanged()})}return t}_createKeys(e){let t=Array.apply(null,{length:this.columnsPerItem}),l=e.map((e,l)=>t.map((e,t)=>this._keyPrefix+l+"_"+t));return[].concat.apply([],l)}_supportsProxies(){return null!=window.Proxy}_createProxy(e,t,l){let s={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new Binding(e)),_keys:l};return new Proxy(s,{ownKeys:e=>e._keys,getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0,writable:!0}),get:(e,t)=>{let l=e._keys.indexOf(t);if(l>-1){let t=e._bnd,s=e._arr,o=t.length,r=l%o,n=Math.floor(l/o);return t[r].getValue(s[n])}return e[t]},set:(e,t,l)=>{let s=e._keys.indexOf(t);if(s>-1){let t=e._bnd,o=e._arr,r=t.length,n=s%r,i=Math.floor(s/r);t[n].setValue(o[i],l);if(o instanceof ObservableArray){let e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,o[i],i);o.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,l){let s={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new Binding(e)),_keys:l};for(let t=0;t<l.length;t++){let o=l[t];Object.defineProperty(s,o,{enumerable:!0,get:()=>{let l=s._bnd,o=l.length,r=t%o,n=Math.floor(t/o);return l[r].getValue(e[n])},set:l=>{let o=s._bnd,r=o.length,n=t%r,i=Math.floor(t/r);o[n].setValue(e[i],l);if(e instanceof ObservableArray){let t=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[i],i);e.onCollectionChanged(t)}return!0}})}return s}_getRowInfo(e){let t=[];if(this._layout){let e=this.rowHeaders.columns,l=this.columnsPerItem+1;for(;e.length>l;)e.removeAt(e.length-1);for(;e.length<l;)e.push(new Column);this._layout._bindingGroups.forEach(e=>{for(let l=0;l<e.rowspan;l++){let s={bindings:[]};for(let t=0;t<e.colspan;t++)for(let o=0;o<e.cells.length;o++){let r=e.cells[o];if(l>=r.row&&l<r.row+r.rowspan&&t>=r.col&&t<r.col+r.colspan){s.bindings.push(r.binding);break}}t.push(s)}})}return t}}export class _CellFactory extends CellFactory{updateCell(e,t,l,s,o,r){if(e.cellType!=CellType.Cell){super.updateCell(e,t,l,s,o,r);return}let n=e.grid,i=n.rows[t],a=n.columns[l],h=i.dataType,g=i.format,u=i.cssClass,c=i.align,p=i.dataMap,_=this.findCell(n,t,l);if(i){i.setDataType(getType(i.dataItem[a.binding]));if(_){i.setDataMap(_.dataMap);i.setFormat(_.format);i.setCssClass(_.cssClass);i.setAlign(_.align)}}try{super.updateCell(e,t,l,s,o,r)}finally{if(i){i.setDataType(h);if(_){p&&i.setDataMap(p);i.setFormat(g);i.setCssClass(u);i.setAlign(c)}}}}findCell(e,t,l){let s=e._getGroupByRow(t),o=l%e.columnsPerItem;for(let e=0;e<s.cells.length;e++){let l=s.cells[e];if(s._rowstart+l._row==t&&o>=s._colstart+l.col&&o<s._colstart+l.col+l.colspan)return l}return null}}export class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;this._g=e._grid;t&&copy(this,t);if(!this._cells)throw"Cell group with no cells?";let l=0,s=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,l,s);)0==(s=(s+1)%this.colspan)&&l++;e.row=l;e.col=s});let o=1,r=1;this._cells.forEach(e=>{o=Math.max(o,e.row+e.rowspan);r=Math.max(r,e.col+e.colspan)});this.rowspan=o;this.colspan=r}_copy(e,t){if("cells"==e){this._cells=[];isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach(e=>{for(let t=0;t<e.rowspan;t++)for(let l=0;l<e.colspan;l++){let s=(e.row+t)*this.colspan+(e.col+l);this._cols.setAt(s,e);let o=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);this._rng[s]=o}});this._rng[-1]=new CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)}getMergedRange(e,t,l){if(l<0)return this._rng[-1];let s=t-this._rowstart,o=l%this.colspan,r=this._rng[s*this.colspan+o];e.cellType==CellType.RowHeader&&l++;let n=t-s,i=l-o;return r?new CellRange(n+r.row,i+r.col,n+r.row2,i+r.col2):null}getBindingColumn(e,t,l){if(l<0)return this;let s=t-this._rowstart,o=l%this.colspan;return this._cols[s*this.colspan+o]}_cellFits(e,t,l,s){if(s>0&&s+e.colspan>this.colspan)return!1;for(let o=0;o<e.colspan;o++)if(this._slotTaken(l,s+o,t))return!1;this.colspan=Math.max(this.colspan,s+e.colspan-1);return!0}_slotTaken(e,t,l=this._cells.length){for(let s=0;s<l;s++){let l=this._cells[s];if(e>=l.row&&e<=l.row+l.rowspan-1&&t>=l.col&&t<=l.col+l.colspan-1)return!0}return!1}_updateCellTypes(e){this._cols.forEach(t=>{let l=t;null==l.dataType&&l._binding&&(l.dataType=getType(l._binding.getValue(e)))})}}export class _MergeManager extends MergeManager{getMergedRange(e,t,l,s=!0){let o=e.grid;if(t<0||t>=e.rows.length||l<0||l>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:let s=l;e.cellType==CellType.RowHeader&&s--;let r=o._getGroupByRow(t);assert(r instanceof _CellGroup,"Failed to get the group!");let n=r.getMergedRange(e,t,s);assert(n&&n.contains(t,l),"Merged range must contain source cell");return n;case CellType.ColumnHeader:let i=o.columnsPerItem,a=l-l%i,h=Math.min(a+i-1,e.columns.length-1);return new CellRange(0,a,e.rows.length-1,h);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}export class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],l=1;if(e){for(let s=0,o=0;s<e.length;s++){let r=new _CellGroup(this,e[s]);r._rowstart=o;o+=r._rowspan;l=Math.max(l,r._colspan);t.push(r)}t.forEach(e=>{e.closeGroup(l)});this._columnsPerItem=l}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let l=this._bindingGroups;for(let t=0;t<l.length;t++){let s=l[t];if(e>=s._rowstart&&e<=s._rowstart+s._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._updateCellTypes(e)})}}_registerModule("wijmo.grid.transposedmultirow",selfModule);
import{assert,copy,asInt,addClass,asArray,hasItems,isArray,toggleClass,toHeaderCase,tryCast,Binding,CollectionView,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,getType,_registerModule}from"@grapecity/wijmo";import{MergeManager,CellRange,CellType,Column,Row,AllowDragging,AllowSorting,ColumnCollection,FlexGrid}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";export class _MultiRow extends Row{constructor(e,t){super(e);this._idxData=t}}export class _Cell extends Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&copy(this,e)}get row(){return this._row}set row(e){this._row=asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")}}export class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;this._g=e._grid;t&&copy(this,t);if(!this._cells)throw"Cell group with no cells?";let o=0,l=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,o,l);)0==(l=(l+1)%this.colspan)&&o++;e.row=o;e.col=l});let s=1,r=1;this._cells.forEach(e=>{s=Math.max(s,e.row+e.rowspan);r=Math.max(r,e.col+e.colspan)});this.rowspan=s;this.colspan=r}_copy(e,t){if("cells"==e){this._cells=[];isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach(e=>{for(let t=0;t<e.rowspan;t++)for(let o=0;o<e.colspan;o++){let l=(e.row+t)*this.colspan+(e.col+o);this._cols.setAt(l,e);let s=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);s.isSingleCell||(this._rng[l]=s)}});this._rng[-1]=new CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)}getMergedRange(e,t,o){if(o<0)return this._rng[-1];let l=t-this._rowstart,s=o%this.colspan,r=this._rng[l*this.colspan+s];e.cellType==CellType.RowHeader&&o++;let n=t-l,i=o-s;return r?new CellRange(n+r.row,i+r.col,n+r.row2,i+r.col2):null}getBindingColumn(e,t,o){if(o<0)return this;let l=t-this._rowstart,s=o%this.colspan;return this._cols[l*this.colspan+s]}_cellFits(e,t,o,l){if(l>0&&l+e.colspan>this.colspan)return!1;for(let s=0;s<e.colspan;s++)if(this._slotTaken(o,l+s,t))return!1;this.colspan=Math.max(this.colspan,l+e.colspan-1);return!0}_slotTaken(e,t,o=this._cells.length){for(let l=0;l<o;l++){let o=this._cells[l];if(e>=o.row&&e<=o.row+o.rowspan-1&&t>=o.col&&t<=o.col+o.colspan-1)return!0}return!1}_updateCellTypes(e){this._cols.forEach(t=>{let o=t;null==o.dataType&&o._binding&&(o.dataType=getType(o._binding.getValue(e)))})}}export class _MergeManager extends MergeManager{getMergedRange(e,t,o,l=!0){let s=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:let l=e.rows[t].dataItem._rowInfo.index,r=o;e.cellType==CellType.RowHeader&&r--;let n=s._getGroupByRow(t);assert(n instanceof _CellGroup,"Failed to get the group!");let i=n.getMergedRange(e,l,r);if(i){let o=l,s=t;if(t>0){o=e.rows[t-1].dataItem._rowInfo.index;s=t-1}i.row<=o?i.row=s:i.row=t;let r=l,n=t;if(t<e.rows.length-1){r=e.rows[t+1].dataItem._rowInfo.index;n=t+1}i.row2>=r?i.row2=n:i.row2=t}assert(!i||i.contains(t,o),"Merged range must contain source cell");return i;case CellType.ColumnHeader:let a=s.columnsPerItem,h=o-o%a,u=Math.min(h+a-1,e.columns.length-1);return new CellRange(0,h,e.rows.length-1,u);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}export class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],o=1;if(e){for(let l=0,s=0;l<e.length;l++){let r=new _CellGroup(this,e[l]);r._rowstart=s;s+=r._rowspan;o=Math.max(o,r._colspan);t.push(r)}t.forEach(e=>{e.closeGroup(o)});this._columnsPerItem=o}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let o=this._bindingGroups;for(let t=0;t<o.length;t++){let l=o[t];if(e>=l._rowstart&&e<=l._rowstart+l._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._updateCellTypes(e)})}}export class TransposedMultiRow extends FlexGrid{constructor(e,t){super(e);this._bindingColumns={};this._keyPrefix="item";addClass(this.hostElement,"wj-transposed-multirow");this._layout=new _MultiRowLayout(this,null);this.allowDragging=AllowDragging.None;this.allowSorting=AllowSorting.None;this.mergeManager=new _MergeManager(this);this.formatItem.addHandler(this._formatItem,this);this._rowInfo=new ColumnCollection(this,this.columns.defaultSize);this.initialize(t);this._rowInfo.collectionChanged.addHandler(this._rowInfoChanged,this)}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this._layoutDef=asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()}getBindingColumn(e,t,o){if(e.cellType!=CellType.Cell)return null;let l=e.rows[t].dataItem._rowInfo.index,s=l+"_"+o,r=this._bindingColumns[s];if(r)return r;let n=this._getGroupByRow(t).getBindingColumn(e,l,o);if(n){r=new Column;FlexGrid._getSerializableProperties(Column).forEach(e=>{null!=n[e]&&(r[e]=n[e])});let e=Math.floor(o/this.columnsPerItem),t=o%this.columnsPerItem;r.binding=this._keyPrefix+e+"_"+t;this._bindingColumns[s]=r}return r}get columnsPerItem(){return this._layout._columnsPerItem}get allowAddNew(){return!1}set allowAddNew(e){assert(!e,"TransposedMultiRow does not support items addition.")}get allowDelete(){return!1}set allowDelete(e){assert(!e,"TransposedMultiRow does not support items deletion.")}get allowDragging(){return AllowDragging.None}set allowDragging(e){assert(e===AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}}get allowPinning(){return!1}set allowPinning(e){assert(!e,"TransposedMultiRow does not support pinning.")}get allowSorting(){return AllowSorting.None}set allowSorting(e){assert(e===AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e}get columnLayout(){throw"TransposedMultiRow does not support column layout."}set columnLayout(e){throw"TransposedMultiRow does not support column layout."}refresh(e){let t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else super.refresh(e)}onLoadedRows(e){let t=this.columnHeaders.columns;for(let e=0;e<t.length;e++)this.columnHeaders.setCellData(0,e,"");let o=this.columns;for(let e=0;e<o.length;e++){let t=o[e];t.align=null;t.dataType=0}let l=this.rowHeaders.columns;this.rows.forEach(e=>{let t=e.dataItem._rowInfo;if(t)for(let o=l.length-2;o>=0;o--){let l=t.headers[o]||toHeaderCase(t.bindings[o]);this.rowHeaders.setCellData(e.index,o+1,l)}});l[0].visible=!1;for(let e=1;e<l.length;e++){l[e].align="left";l[e].visible=!0;l[e].width=this.columns.defaultSize}super.onLoadedRows(e)}_getGroupByRow(e){let t=this.cells.rows[e].dataItem._rowInfo.index,o=this._layout._getGroupByRow(t);assert(o instanceof _CellGroup,"Failed to get the group!");return o}_addBoundRow(e,t){let o=e[t];this.rows.push(new _MultiRow(o,t))}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(hasItems(e)&&this._layout){let t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}}_getBindingColumn(e,t,o){if(this._layout){e==this.cells&&(o=this.getBindingColumn(e,t,o.index));return o}return super._getBindingColumn(e,t,o)}_getCollectionView(e){let t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;let o=super._getCollectionView(e);t&&o instanceof CollectionView&&(o.getError=(e,o)=>{let l=e._keys.indexOf(o),s=l%e._bnd.length,r=Math.floor(l/e._bnd.length);return t(e._arr[r],e._bnd[s].path)});return o}_rowInfoChanged(){let e=this.selection,t=this.itemsSource;this._bindingColumns={};this.itemsSource=null;this.itemsSource=t;e&&e.isValid&&(this.selection=e)}_formatItem(e,t){let o=this.columnsPerItem,l=t.panel,s=l.cellType,r=l.rows[t.range.row],n=(l.rows[t.range.row2],t.cell);s==CellType.RowHeader&&toggleClass(n,"wj-group-header",0==t.range.row);if(s==CellType.Cell||s==CellType.RowHeader){let e=this._getGroupByRow(t.row);toggleClass(n,"wj-group-start",e._rowstart==t.range.row);toggleClass(n,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(o>1&&(s==CellType.Cell||s==CellType.ColumnHeader)){toggleClass(n,"wj-record-start",t.range.col%o==0);toggleClass(n,"wj-record-end",t.range.col2%o==o-1)}let i=this.alternatingRowStep;if(i&&s==CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,o=Math.floor(r.dataIndex/e)*t,l=r.dataIndex%e;o+=this._layout._getGroupIndexByRow(l)+1;toggleClass(n,"wj-alt",o%(i+1)==0)}}_sourceViewChanged(e,t){this.activeEditor||this.invalidate()}_transposeItemsSource(e){let t=new ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((o,l)=>{let s=this._createKeys(e);if(this._supportsProxies()){let l=this._createProxy(e,o,s);t.push(l)}else{let l=this._createTransposedObject(e,o,s);t.push(l)}});e instanceof ObservableArray&&e.collectionChanged.addHandler(()=>{let e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);t.onCollectionChanged(e);this._rowInfoChanged()})}return t}_createKeys(e){let t=Array.apply(null,{length:this.columnsPerItem}),o=e.map((e,o)=>t.map((e,t)=>this._keyPrefix+o+"_"+t));return[].concat.apply([],o)}_supportsProxies(){return null!=window.Proxy}_createProxy(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new Binding(e)),_keys:o};return new Proxy(l,{ownKeys:e=>e._keys,getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0,writable:!0}),get:(e,t)=>{let o=e._keys.indexOf(t);if(o>-1){let t=e._bnd,l=e._arr,s=t.length,r=o%s,n=Math.floor(o/s);return t[r].getValue(l[n])}return e[t]},set:(e,t,o)=>{let l=e._keys.indexOf(t);if(l>-1){let t=e._bnd,s=e._arr,r=t.length,n=l%r,i=Math.floor(l/r);t[n].setValue(s[i],o);if(s instanceof ObservableArray){let e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,s[i],i);s.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new Binding(e)),_keys:o};for(let t=0;t<o.length;t++){let s=o[t];Object.defineProperty(l,s,{enumerable:!0,get:()=>{let o=l._bnd,s=o.length,r=t%s,n=Math.floor(t/s);return o[r].getValue(e[n])},set:o=>{let s=l._bnd,r=s.length,n=t%r,i=Math.floor(t/r);s[n].setValue(e[i],o);if(e instanceof ObservableArray){let t=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[i],i);e.onCollectionChanged(t)}return!0}})}return l}_getRowInfo(e){let t=[];if(this._layout){let e=this.rowHeaders.columns,o=this.columnsPerItem+1;for(;e.length>o;)e.removeAt(e.length-1);for(;e.length<o;)e.push(new Column);this._layout._bindingGroups.forEach(e=>{for(let o=0;o<e.rowspan;o++){let l={index:e._rowstart+o,bindings:[],headers:[]};for(let t=0;t<e.colspan;t++)for(let s=0;s<e.cells.length;s++){let r=e.cells[s];if(o>=r.row&&o<r.row+r.rowspan&&t>=r.col&&t<r.col+r.colspan){l.bindings.push(r.binding);l.headers.push(r.header);break}}t.push(l)}})}return t}}_registerModule("wijmo.grid.transposedmultirow",selfModule);
/*!
*
* Wijmo Library 5.20202.698-nightly.d20200715.t020614
* Wijmo Library 5.20202.698
* http://wijmo.com/

@@ -14,2 +14,2 @@ *

var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{isString,copy,asInt,assert,getType,isArray,toHeaderCase,addClass,asArray,hasItems,toggleClass,tryCast,Binding,CollectionView,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,_registerModule}from"@grapecity/wijmo";import{Row,CellType,GridPanel,Column,CellRange,ColumnCollection,MergeManager,AllowDragging,AllowSorting,FlexGrid,CellFactory}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";var _Cell=function(e){__extends(_Cell,e);function _Cell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;t&&copy(o,t);return o}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(e){this._row=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(e){this._col=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(Column);export{_Cell};var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o){var r=e.call(this,t)||this;r._idxData=o;return r}_MultiRow.prototype.setDataType=function(e){this._type=e};_MultiRow.prototype.setDataMap=function(e){this._map=e};_MultiRow.prototype.setFormat=function(e){this._fmt=e};_MultiRow.prototype.setCssClass=function(e){this._cssClass=e};_MultiRow.prototype.setAlign=function(e){this._align=e};return _MultiRow}(Row);export{_MultiRow};var _GridPanel=function(e){__extends(_GridPanel,e);function _GridPanel(){return null!==e&&e.apply(this,arguments)||this}_GridPanel.prototype.getCellData=function(t,o,r){if(this.cellType!=CellType.Cell)return e.prototype.getCellData.call(this,t,o,r);if(isString(o)&&(o=this.columns.indexOf(o))<0)throw"Invalid column name or binding.";var n=this.grid,l=n.rows[t],a=l.format,s=null,i=this.findCell(n,t,o);l&&i&&l.setFormat(i.format);try{s=e.prototype.getCellData.call(this,t,o,r)}finally{l&&i&&l.setFormat(a)}return s};_GridPanel.prototype.findCell=function(e,t,o){for(var r=e._getGroupByRow(t),n=o%e.columnsPerItem,l=0;l<r.cells.length;l++){var a=r.cells[l];if(r._rowstart+a._row==t&&n>=r._colstart+a.col&&n<r._colstart+a.col+a.colspan)return a}return null};return _GridPanel}(GridPanel);export{_GridPanel};var TransposedMultiRow=function(e){__extends(TransposedMultiRow,e);function TransposedMultiRow(t,o){var r=e.call(this,t)||this;r._keyPrefix="item";addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=AllowDragging.None;r.allowSorting=AllowSorting.None;r.mergeManager=new _MergeManager(r);r.cellFactory=new _CellFactory;r._gpCells=new _GridPanel(r,CellType.Cell,r._rows,r._cols,r._eCt);r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new ColumnCollection(r,r.columns.defaultSize);r.initialize(o);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){this._layoutDef=asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.getBindingColumn=function(e,t,o){var r=null;if(e==this.cells){r=this._getGroupByRow(t).getBindingColumn(e,t,o)}return r};Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowAddNew",{get:function(){return!1},set:function(e){assert(!e,"TransposedMultiRow does not support items addition.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDelete",{get:function(){return!1},set:function(e){assert(!e,"TransposedMultiRow does not support items deletion.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDragging",{get:function(){return AllowDragging.None},set:function(e){assert(e===AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(e){assert(!e,"TransposedMultiRow does not support pinning.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowSorting",{get:function(){return AllowSorting.None},set:function(e){assert(e===AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnLayout",{get:function(){throw"TransposedMultiRow does not support column layout."},set:function(e){throw"TransposedMultiRow does not support column layout."},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.refresh=function(t){var o=this._rowInfo;if(o._dirty){o._dirty=!1;this._rowInfoChanged()}else e.prototype.refresh.call(this,t)};TransposedMultiRow.prototype.onLoadedRows=function(t){for(var o=this.columnHeaders.columns,r=0;r<o.length;r++)this.columnHeaders.setCellData(0,r,"");var n=this.columns;for(r=0;r<n.length;r++){var l=n[r];l.align=null;l.dataType=0}var a=this.rowHeaders.columns,s=this.rowHeaders.rows;for(r=0;r<s.length;r++){var i=s[r],u=s[r].index,p=this._getGroupByRow(u);u-=p._rowstart;for(var c=a.length-2;c>=0;c--){for(var _="",g=0;g<p.cells.length;g++){var f=p.cells[g];if(u>=f.row&&u<f.row+f.rowspan&&c>=f.col&&c<f.col+f.colspan){_=f.header;break}}this.rowHeaders.setCellData(i.index,c+1,_)}}a[0].visible=!1;for(r=1;r<a.length;r++){a[r].align="left";a[r].visible=!0;a[r].width=this.columns.defaultSize}e.prototype.onLoadedRows.call(this,t)};TransposedMultiRow.prototype._getGroupByRow=function(e){var t=this._layout._getGroupByRow(e);assert(t instanceof _CellGroup,"Failed to get the group!");return t};TransposedMultiRow.prototype._addBoundRow=function(e,t){var o=e[t];this.rows.push(new _MultiRow(o,t))};TransposedMultiRow.prototype._updateColumnTypes=function(){e.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(hasItems(t)&&this._layout){var o=t.items[0]._arr;o&&o.length>0&&this._layout._updateCellTypes(o[0])}};TransposedMultiRow.prototype._getBindingColumn=function(t,o,r){return this._layout?e.prototype._getBindingColumn.call(this,t,o,r):this.getBindingColumn(t,o,r.index)};TransposedMultiRow.prototype._getCollectionView=function(t){var o=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(isArray(t))t=this._transposeItemsSource(t);else if(t){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=tryCast(t,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);t instanceof CollectionView&&(o=t.getError);t=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;var r=e.prototype._getCollectionView.call(this,t);o&&r instanceof CollectionView&&(r.getError=function(e,t){var r=e._keys.indexOf(t),n=r%e._bnd.length,l=Math.floor(r/e._bnd.length);return o(e._arr[l],e._bnd[n].path)});return r};TransposedMultiRow.prototype._rowInfoChanged=function(){var e=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;e&&e.isValid&&(this.selection=e)};TransposedMultiRow.prototype._formatItem=function(e,t){var o=this.columnsPerItem,r=t.panel,n=r.cellType,l=r.rows[t.range.row],a=(r.rows[t.range.row2],t.cell);n==CellType.RowHeader&&toggleClass(a,"wj-group-header",0==t.range.row);if(n==CellType.Cell||n==CellType.RowHeader){var s=this._getGroupByRow(t.row);toggleClass(a,"wj-group-start",s._rowstart==t.range.row);toggleClass(a,"wj-group-end",s._rowstart+s._rowspan-1==t.range.row2)}if(o>1&&(n==CellType.Cell||n==CellType.ColumnHeader)){toggleClass(a,"wj-record-start",t.range.col%o==0);toggleClass(a,"wj-record-end",t.range.col2%o==o-1)}var i=this.alternatingRowStep;if(i&&n==CellType.Cell){var u=this._layout.totalRowSpan,p=this._layout._bindingGroups.length,c=Math.floor(l.dataIndex/u)*p,_=l.dataIndex%u;c+=this._layout._getGroupIndexByRow(_)+1;toggleClass(a,"wj-alt",c%(i+1)==0)}};TransposedMultiRow.prototype._sourceViewChanged=function(e,t){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(e){var t=this,o=new ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((function(r,n){var l=t._createKeys(e);if(t._supportsProxies()){var a=t._createProxy(e,r,l);o.push(a)}else{var s=t._createTransposedObject(e,r,l);o.push(s)}}));e instanceof ObservableArray&&e.collectionChanged.addHandler((function(){var e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);o.onCollectionChanged(e);t._rowInfoChanged()}))}return o};TransposedMultiRow.prototype._createKeys=function(e){var t=this,o=Array.apply(null,{length:this.columnsPerItem}),r=e.map((function(e,r){return o.map((function(e,o){return t._keyPrefix+r+"_"+o}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(e,t,o){var r={_arr:e,_rowInfo:t,_bnd:t.bindings.map((function(e){return new Binding(e)})),_keys:o};return new Proxy(r,{ownKeys:function(e){return e._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(e,t){var o=e._keys.indexOf(t);if(o>-1){var r=e._bnd,n=e._arr,l=r.length,a=o%l,s=Math.floor(o/l);return r[a].getValue(n[s])}return e[t]},set:function(e,t,o){var r=e._keys.indexOf(t);if(r>-1){var n=e._bnd,l=e._arr,a=n.length,s=r%a,i=Math.floor(r/a);n[s].setValue(l[i],o);if(l instanceof ObservableArray){var u=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,l[i],i);l.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(e,t,o){for(var r={_arr:e,_rowInfo:t,_bnd:t.bindings.map((function(e){return new Binding(e)})),_keys:o},_loop_1=function(t){var n=o[t];Object.defineProperty(r,n,{enumerable:!0,get:function(){var o=r._bnd,n=o.length,l=t%n,a=Math.floor(t/n);return o[l].getValue(e[a])},set:function(o){var n=r._bnd,l=n.length,a=t%l,s=Math.floor(t/l);n[a].setValue(e[s],o);if(e instanceof ObservableArray){var i=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[s],s);e.onCollectionChanged(i)}return!0}})},n=0;n<o.length;n++)_loop_1(n);return r};TransposedMultiRow.prototype._getRowInfo=function(e){var t=[];if(this._layout){for(var o=this.rowHeaders.columns,r=this.columnsPerItem+1;o.length>r;)o.removeAt(o.length-1);for(;o.length<r;)o.push(new Column);this._layout._bindingGroups.forEach((function(e){for(var o=0;o<e.rowspan;o++){for(var r={bindings:[]},n=0;n<e.colspan;n++)for(var l=0;l<e.cells.length;l++){var a=e.cells[l];if(o>=a.row&&o<a.row+a.rowspan&&n>=a.col&&n<a.col+a.colspan){r.bindings.push(a.binding);break}}t.push(r)}}))}return t};return TransposedMultiRow}(FlexGrid);export{TransposedMultiRow};var _CellFactory=function(e){__extends(_CellFactory,e);function _CellFactory(){return null!==e&&e.apply(this,arguments)||this}_CellFactory.prototype.updateCell=function(t,o,r,n,l,a){if(t.cellType==CellType.Cell){var s=t.grid,i=s.rows[o],u=s.columns[r],p=i.dataType,c=i.format,_=i.cssClass,g=i.align,f=i.dataMap,h=this.findCell(s,o,r);if(i){i.setDataType(getType(i.dataItem[u.binding]));if(h){i.setDataMap(h.dataMap);i.setFormat(h.format);i.setCssClass(h.cssClass);i.setAlign(h.align)}}try{e.prototype.updateCell.call(this,t,o,r,n,l,a)}finally{if(i){i.setDataType(p);if(h){f&&i.setDataMap(f);i.setFormat(c);i.setCssClass(_);i.setAlign(g)}}}}else e.prototype.updateCell.call(this,t,o,r,n,l,a)};_CellFactory.prototype.findCell=function(e,t,o){for(var r=e._getGroupByRow(t),n=o%e.columnsPerItem,l=0;l<r.cells.length;l++){var a=r.cells[l];if(r._rowstart+a._row==t&&n>=r._colstart+a.col&&n<r._colstart+a.col+a.colspan)return a}return null};return _CellFactory}(CellFactory);export{_CellFactory};var _CellGroup=function(e){__extends(_CellGroup,e);function _CellGroup(t,o){var r=e.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=t;r._g=t._grid;o&&copy(r,o);if(!r._cells)throw"Cell group with no cells?";var n=0,l=0;r._cells.forEach((function(e,t){for(;!r._cellFits(e,t,n,l);)0==(l=(l+1)%r.colspan)&&n++;e.row=n;e.col=l}));var a=1,s=1;r._cells.forEach((function(e){a=Math.max(a,e.row+e.rowspan);s=Math.max(s,e.col+e.colspan)}));r.rowspan=a;r.colspan=s;return r}_CellGroup.prototype._copy=function(e,t){var o=this;if("cells"==e){this._cells=[];isArray(t)&&t.forEach((function(e){var t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));o._cells.push(t);o.colspan=Math.max(o.colspan,t.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(e){var t=this;if(e>this.colspan){this._cells.forEach((function(o){o.col==t.colspan-1&&(o.colspan=e-o.col)}));this.colspan=e}this._cells.forEach((function(e){for(;e.col+e.colspan<t.colspan&&!t._slotTaken(e.row,e.col+e.colspan);)e.colspan++}));this._cells.forEach((function(e){for(;e.row+e.rowspan<t.rowspan&&!t._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++}));for(var o=0;o<this.rowspan;o++)for(var r=0;r<this.colspan;r++)assert(this._slotTaken(o,r),"Invalid layout (empty cells).");this._cols=new ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach((function(e){for(var o=0;o<e.rowspan;o++)for(var r=0;r<e.colspan;r++){var n=(e.row+o)*t.colspan+(e.col+r);t._cols.setAt(n,e);var l=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);t._rng[n]=l}}));this._rng[-1]=new CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(e,t,o){if(o<0)return this._rng[-1];var r=t-this._rowstart,n=o%this.colspan,l=this._rng[r*this.colspan+n];e.cellType==CellType.RowHeader&&o++;var a=t-r,s=o-n;return l?new CellRange(a+l.row,s+l.col,a+l.row2,s+l.col2):null};_CellGroup.prototype.getBindingColumn=function(e,t,o){if(o<0)return this;var r=t-this._rowstart,n=o%this.colspan;return this._cols[r*this.colspan+n]};_CellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e.colspan>this.colspan)return!1;for(var n=0;n<e.colspan;n++)if(this._slotTaken(o,r+n,t))return!1;this.colspan=Math.max(this.colspan,r+e.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var n=this._cells[r];if(e>=n.row&&e<=n.row+n.rowspan-1&&t>=n.col&&t<=n.col+n.colspan-1)return!0}return!1};_CellGroup.prototype._updateCellTypes=function(e){this._cols.forEach((function(t){var o=t;null==o.dataType&&o._binding&&(o.dataType=getType(o._binding.getValue(e)))}))};return _CellGroup}(_Cell);export{_CellGroup};var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var n=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:var l=o;e.cellType==CellType.RowHeader&&l--;var a=n._getGroupByRow(t);assert(a instanceof _CellGroup,"Failed to get the group!");var s=a.getMergedRange(e,t,l);assert(s&&s.contains(t,o),"Merged range must contain source cell");return s;case CellType.ColumnHeader:var i=n.columnsPerItem,u=o-o%i,p=Math.min(u+i-1,e.columns.length-1);return new CellRange(0,u,e.rows.length-1,p);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null};return _MergeManager}(MergeManager);export{_MergeManager};var _MultiRowLayout=function(){function _MultiRowLayout(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var e=this._bindingGroups;if(e&&e.length){var t=e[e.length-1];return t._rowstart+t.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(e){var t=[],o=1;if(e){for(var r=0,n=0;r<e.length;r++){var l=new _CellGroup(this,e[r]);l._rowstart=n;n+=l._rowspan;o=Math.max(o,l._colspan);t.push(l)}t.forEach((function(e){e.closeGroup(o)}));this._columnsPerItem=o}return t};_MultiRowLayout.prototype._getGroupByRow=function(e){var t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(e){var t=this._groupsByRow[e];if(t)return t;for(var o=this._bindingGroups,r=0;r<o.length;r++){var n=o[r];if(e>=n._rowstart&&e<=n._rowstart+n._rowspan-1){this._groupsByRow[e]=r;return r}}return-1};_MultiRowLayout.prototype._updateCellTypes=function(e){this._bindingGroups.forEach((function(t){t._updateCellTypes(e)}))};return _MultiRowLayout}();export{_MultiRowLayout};_registerModule("wijmo.grid.transposedmultirow",selfModule);
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{assert,copy,asInt,addClass,asArray,hasItems,isArray,toggleClass,toHeaderCase,tryCast,Binding,CollectionView,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,getType,_registerModule}from"@grapecity/wijmo";import{MergeManager,CellRange,CellType,Column,Row,AllowDragging,AllowSorting,ColumnCollection,FlexGrid}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o){var r=e.call(this,t)||this;r._idxData=o;return r}return _MultiRow}(Row);export{_MultiRow};var _Cell=function(e){__extends(_Cell,e);function _Cell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;t&&copy(o,t);return o}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(e){this._row=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(e){this._col=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(Column);export{_Cell};var _CellGroup=function(e){__extends(_CellGroup,e);function _CellGroup(t,o){var r=e.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=t;r._g=t._grid;o&&copy(r,o);if(!r._cells)throw"Cell group with no cells?";var n=0,l=0;r._cells.forEach((function(e,t){for(;!r._cellFits(e,t,n,l);)0==(l=(l+1)%r.colspan)&&n++;e.row=n;e.col=l}));var i=1,s=1;r._cells.forEach((function(e){i=Math.max(i,e.row+e.rowspan);s=Math.max(s,e.col+e.colspan)}));r.rowspan=i;r.colspan=s;return r}_CellGroup.prototype._copy=function(e,t){var o=this;if("cells"==e){this._cells=[];isArray(t)&&t.forEach((function(e){var t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));o._cells.push(t);o.colspan=Math.max(o.colspan,t.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(e){var t=this;if(e>this.colspan){this._cells.forEach((function(o){o.col==t.colspan-1&&(o.colspan=e-o.col)}));this.colspan=e}this._cells.forEach((function(e){for(;e.col+e.colspan<t.colspan&&!t._slotTaken(e.row,e.col+e.colspan);)e.colspan++}));this._cells.forEach((function(e){for(;e.row+e.rowspan<t.rowspan&&!t._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++}));for(var o=0;o<this.rowspan;o++)for(var r=0;r<this.colspan;r++)assert(this._slotTaken(o,r),"Invalid layout (empty cells).");this._cols=new ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach((function(e){for(var o=0;o<e.rowspan;o++)for(var r=0;r<e.colspan;r++){var n=(e.row+o)*t.colspan+(e.col+r);t._cols.setAt(n,e);var l=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);l.isSingleCell||(t._rng[n]=l)}}));this._rng[-1]=new CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(e,t,o){if(o<0)return this._rng[-1];var r=t-this._rowstart,n=o%this.colspan,l=this._rng[r*this.colspan+n];e.cellType==CellType.RowHeader&&o++;var i=t-r,s=o-n;return l?new CellRange(i+l.row,s+l.col,i+l.row2,s+l.col2):null};_CellGroup.prototype.getBindingColumn=function(e,t,o){if(o<0)return this;var r=t-this._rowstart,n=o%this.colspan;return this._cols[r*this.colspan+n]};_CellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e.colspan>this.colspan)return!1;for(var n=0;n<e.colspan;n++)if(this._slotTaken(o,r+n,t))return!1;this.colspan=Math.max(this.colspan,r+e.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var n=this._cells[r];if(e>=n.row&&e<=n.row+n.rowspan-1&&t>=n.col&&t<=n.col+n.colspan-1)return!0}return!1};_CellGroup.prototype._updateCellTypes=function(e){this._cols.forEach((function(t){var o=t;null==o.dataType&&o._binding&&(o.dataType=getType(o._binding.getValue(e)))}))};return _CellGroup}(_Cell);export{_CellGroup};var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var n=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:var l=e.rows[t].dataItem._rowInfo.index,i=o;e.cellType==CellType.RowHeader&&i--;var s=n._getGroupByRow(t);assert(s instanceof _CellGroup,"Failed to get the group!");var a=s.getMergedRange(e,l,i);if(a){var u=l,p=t;if(t>0){u=e.rows[t-1].dataItem._rowInfo.index;p=t-1}a.row<=u?a.row=p:a.row=t;var c=l,_=t;if(t<e.rows.length-1){c=e.rows[t+1].dataItem._rowInfo.index;_=t+1}a.row2>=c?a.row2=_:a.row2=t}assert(!a||a.contains(t,o),"Merged range must contain source cell");return a;case CellType.ColumnHeader:var g=n.columnsPerItem,h=o-o%g,f=Math.min(h+g-1,e.columns.length-1);return new CellRange(0,h,e.rows.length-1,f);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null};return _MergeManager}(MergeManager);export{_MergeManager};var _MultiRowLayout=function(){function _MultiRowLayout(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var e=this._bindingGroups;if(e&&e.length){var t=e[e.length-1];return t._rowstart+t.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(e){var t=[],o=1;if(e){for(var r=0,n=0;r<e.length;r++){var l=new _CellGroup(this,e[r]);l._rowstart=n;n+=l._rowspan;o=Math.max(o,l._colspan);t.push(l)}t.forEach((function(e){e.closeGroup(o)}));this._columnsPerItem=o}return t};_MultiRowLayout.prototype._getGroupByRow=function(e){var t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(e){var t=this._groupsByRow[e];if(t)return t;for(var o=this._bindingGroups,r=0;r<o.length;r++){var n=o[r];if(e>=n._rowstart&&e<=n._rowstart+n._rowspan-1){this._groupsByRow[e]=r;return r}}return-1};_MultiRowLayout.prototype._updateCellTypes=function(e){this._bindingGroups.forEach((function(t){t._updateCellTypes(e)}))};return _MultiRowLayout}();export{_MultiRowLayout};var TransposedMultiRow=function(e){__extends(TransposedMultiRow,e);function TransposedMultiRow(t,o){var r=e.call(this,t)||this;r._bindingColumns={};r._keyPrefix="item";addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=AllowDragging.None;r.allowSorting=AllowSorting.None;r.mergeManager=new _MergeManager(r);r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new ColumnCollection(r,r.columns.defaultSize);r.initialize(o);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){this._layoutDef=asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.getBindingColumn=function(e,t,o){if(e.cellType!=CellType.Cell)return null;var r=e.rows[t].dataItem._rowInfo.index,n=r+"_"+o,l=this._bindingColumns[n];if(l)return l;var i=this._getGroupByRow(t).getBindingColumn(e,r,o);if(i){l=new Column;FlexGrid._getSerializableProperties(Column).forEach((function(e){null!=i[e]&&(l[e]=i[e])}));var s=Math.floor(o/this.columnsPerItem),a=o%this.columnsPerItem;l.binding=this._keyPrefix+s+"_"+a;this._bindingColumns[n]=l}return l};Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowAddNew",{get:function(){return!1},set:function(e){assert(!e,"TransposedMultiRow does not support items addition.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDelete",{get:function(){return!1},set:function(e){assert(!e,"TransposedMultiRow does not support items deletion.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDragging",{get:function(){return AllowDragging.None},set:function(e){assert(e===AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(e){assert(!e,"TransposedMultiRow does not support pinning.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowSorting",{get:function(){return AllowSorting.None},set:function(e){assert(e===AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnLayout",{get:function(){throw"TransposedMultiRow does not support column layout."},set:function(e){throw"TransposedMultiRow does not support column layout."},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.refresh=function(t){var o=this._rowInfo;if(o._dirty){o._dirty=!1;this._rowInfoChanged()}else e.prototype.refresh.call(this,t)};TransposedMultiRow.prototype.onLoadedRows=function(t){for(var o=this,r=this.columnHeaders.columns,n=0;n<r.length;n++)this.columnHeaders.setCellData(0,n,"");var l=this.columns;for(n=0;n<l.length;n++){var i=l[n];i.align=null;i.dataType=0}var s=this.rowHeaders.columns;this.rows.forEach((function(e){var t=e.dataItem._rowInfo;if(t)for(var r=s.length-2;r>=0;r--){var n=t.headers[r]||toHeaderCase(t.bindings[r]);o.rowHeaders.setCellData(e.index,r+1,n)}}));s[0].visible=!1;for(n=1;n<s.length;n++){s[n].align="left";s[n].visible=!0;s[n].width=this.columns.defaultSize}e.prototype.onLoadedRows.call(this,t)};TransposedMultiRow.prototype._getGroupByRow=function(e){var t=this.cells.rows[e].dataItem._rowInfo.index,o=this._layout._getGroupByRow(t);assert(o instanceof _CellGroup,"Failed to get the group!");return o};TransposedMultiRow.prototype._addBoundRow=function(e,t){var o=e[t];this.rows.push(new _MultiRow(o,t))};TransposedMultiRow.prototype._updateColumnTypes=function(){e.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(hasItems(t)&&this._layout){var o=t.items[0]._arr;o&&o.length>0&&this._layout._updateCellTypes(o[0])}};TransposedMultiRow.prototype._getBindingColumn=function(t,o,r){if(this._layout){t==this.cells&&(r=this.getBindingColumn(t,o,r.index));return r}return e.prototype._getBindingColumn.call(this,t,o,r)};TransposedMultiRow.prototype._getCollectionView=function(t){var o=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(isArray(t))t=this._transposeItemsSource(t);else if(t){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=tryCast(t,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);t instanceof CollectionView&&(o=t.getError);t=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;var r=e.prototype._getCollectionView.call(this,t);o&&r instanceof CollectionView&&(r.getError=function(e,t){var r=e._keys.indexOf(t),n=r%e._bnd.length,l=Math.floor(r/e._bnd.length);return o(e._arr[l],e._bnd[n].path)});return r};TransposedMultiRow.prototype._rowInfoChanged=function(){var e=this.selection,t=this.itemsSource;this._bindingColumns={};this.itemsSource=null;this.itemsSource=t;e&&e.isValid&&(this.selection=e)};TransposedMultiRow.prototype._formatItem=function(e,t){var o=this.columnsPerItem,r=t.panel,n=r.cellType,l=r.rows[t.range.row],i=(r.rows[t.range.row2],t.cell);n==CellType.RowHeader&&toggleClass(i,"wj-group-header",0==t.range.row);if(n==CellType.Cell||n==CellType.RowHeader){var s=this._getGroupByRow(t.row);toggleClass(i,"wj-group-start",s._rowstart==t.range.row);toggleClass(i,"wj-group-end",s._rowstart+s._rowspan-1==t.range.row2)}if(o>1&&(n==CellType.Cell||n==CellType.ColumnHeader)){toggleClass(i,"wj-record-start",t.range.col%o==0);toggleClass(i,"wj-record-end",t.range.col2%o==o-1)}var a=this.alternatingRowStep;if(a&&n==CellType.Cell){var u=this._layout.totalRowSpan,p=this._layout._bindingGroups.length,c=Math.floor(l.dataIndex/u)*p,_=l.dataIndex%u;c+=this._layout._getGroupIndexByRow(_)+1;toggleClass(i,"wj-alt",c%(a+1)==0)}};TransposedMultiRow.prototype._sourceViewChanged=function(e,t){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(e){var t=this,o=new ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((function(r,n){var l=t._createKeys(e);if(t._supportsProxies()){var i=t._createProxy(e,r,l);o.push(i)}else{var s=t._createTransposedObject(e,r,l);o.push(s)}}));e instanceof ObservableArray&&e.collectionChanged.addHandler((function(){var e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);o.onCollectionChanged(e);t._rowInfoChanged()}))}return o};TransposedMultiRow.prototype._createKeys=function(e){var t=this,o=Array.apply(null,{length:this.columnsPerItem}),r=e.map((function(e,r){return o.map((function(e,o){return t._keyPrefix+r+"_"+o}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(e,t,o){var r={_arr:e,_rowInfo:t,_bnd:t.bindings.map((function(e){return new Binding(e)})),_keys:o};return new Proxy(r,{ownKeys:function(e){return e._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(e,t){var o=e._keys.indexOf(t);if(o>-1){var r=e._bnd,n=e._arr,l=r.length,i=o%l,s=Math.floor(o/l);return r[i].getValue(n[s])}return e[t]},set:function(e,t,o){var r=e._keys.indexOf(t);if(r>-1){var n=e._bnd,l=e._arr,i=n.length,s=r%i,a=Math.floor(r/i);n[s].setValue(l[a],o);if(l instanceof ObservableArray){var u=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,l[a],a);l.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(e,t,o){for(var r={_arr:e,_rowInfo:t,_bnd:t.bindings.map((function(e){return new Binding(e)})),_keys:o},_loop_1=function(t){var n=o[t];Object.defineProperty(r,n,{enumerable:!0,get:function(){var o=r._bnd,n=o.length,l=t%n,i=Math.floor(t/n);return o[l].getValue(e[i])},set:function(o){var n=r._bnd,l=n.length,i=t%l,s=Math.floor(t/l);n[i].setValue(e[s],o);if(e instanceof ObservableArray){var a=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[s],s);e.onCollectionChanged(a)}return!0}})},n=0;n<o.length;n++)_loop_1(n);return r};TransposedMultiRow.prototype._getRowInfo=function(e){var t=[];if(this._layout){for(var o=this.rowHeaders.columns,r=this.columnsPerItem+1;o.length>r;)o.removeAt(o.length-1);for(;o.length<r;)o.push(new Column);this._layout._bindingGroups.forEach((function(e){for(var o=0;o<e.rowspan;o++){for(var r={index:e._rowstart+o,bindings:[],headers:[]},n=0;n<e.colspan;n++)for(var l=0;l<e.cells.length;l++){var i=e.cells[l];if(o>=i.row&&o<i.row+i.rowspan&&n>=i.col&&n<i.col+i.colspan){r.bindings.push(i.binding);r.headers.push(i.header);break}}t.push(r)}}))}return t};return TransposedMultiRow}(FlexGrid);export{TransposedMultiRow};_registerModule("wijmo.grid.transposedmultirow",selfModule);
/*!
*
* Wijmo Library 5.20202.698-nightly.d20200715.t020614
* Wijmo Library 5.20202.698
* http://wijmo.com/

@@ -21,6 +21,19 @@ *

export declare var ___keepComment: any;
import { DataType, EventArgs, ICollectionView } from '@grapecity/wijmo';
import { DataMap, Row, GridPanel, Column, CellRange, ColumnCollection, MergeManager, AllowDragging, AllowSorting, FlexGrid, CellFactory } from '@grapecity/wijmo.grid';
import { EventArgs, ICollectionView } from '@grapecity/wijmo';
import { MergeManager, GridPanel, CellRange, Column, Row, AllowDragging, AllowSorting, ColumnCollection, FlexGrid } from '@grapecity/wijmo.grid';
import * as selfModule from '@grapecity/wijmo.grid.transposedmultirow';
/**
* Extends the {@link Row} class to provide additional API for multi-row records.
*/
export declare class _MultiRow extends Row {
_idxData: number;
/**
* Initializes a new instance of the {@link Row} class.
*
* @param dataItem The data item this row is bound to.
* @param dataIndex The index of the record within the items source.
*/
constructor(dataItem: any, dataIndex: number);
}
/**
* Extends the {@link Column} class with <b>colspan</b> property to

@@ -58,28 +71,66 @@ * describe a cell in a {@link _CellGroup}.

/**
* Extends the {@link Row} class to provide additional API for multi-row records.
* Describes a group of cells that may span multiple rows and columns.
*/
export declare class _MultiRow extends Row {
_idxRecord: number;
export declare class _CellGroup extends _Cell {
_g: TransposedMultiRow;
_layout: _MultiRowLayout;
_colstart: number;
_rowstart: number;
_cells: _Cell[];
_cols: ColumnCollection;
_rng: CellRange[];
/**
* Initializes a new instance of the {@link Row} class.
* Initializes a new instance of the {@link _CellGroup} class.
*
* @param dataItem The data item this row is bound to.
* @param dataIndex The index of the record within the items source.
* @param layout {@link _Layout} that owns the {@link _CellGroup}.
* @param options JavaScript object containing initialization data for the new {@link _CellGroup}.
*/
constructor(dataItem: any, dataIndex: number);
setDataType(type: DataType): void;
setDataMap(map: DataMap): void;
setFormat(fmt: string): void;
setCssClass(cssClass: string): void;
setAlign(align: string): void;
constructor(layout: _MultiRowLayout, options?: any);
_copy(key: string, value: any): boolean;
readonly cells: _Cell[];
closeGroup(columnsPerItem: number): void;
getMergedRange(p: GridPanel, r: number, c: number): CellRange;
getBindingColumn(p: GridPanel, r: number, c: number): Column;
_cellFits(cell: _Cell, index: number, r: number, c: number): boolean;
_slotTaken(r: number, c: number, index?: number): boolean;
_updateCellTypes(item: any): void;
}
/**
* Represents a logical part of the grid, such as the column headers, row headers,
* and scrollable data part.
* Provides custom merging for {@link TransposedMultiRow} controls.
*/
export declare class _GridPanel extends GridPanel {
getCellData(r: number, c: number | string, formatted: boolean): any;
private findCell;
export declare class _MergeManager extends MergeManager {
/**
* Gets a {@link CellRange} that specifies the merged extent of a cell
* in a {@link GridPanel}.
*
* @param p The {@link GridPanel} that contains the range.
* @param r The index of the row that contains the cell.
* @param c The index of the column that contains the cell.
* @param clip Specifies whether to clip the merged range to the grid's current view range.
* @return A {@link CellRange} that specifies the merged range, or null if the cell is not merged.
*/
getMergedRange(p: GridPanel, r: number, c: number, clip?: boolean): CellRange;
}
/**
* Class that parses {@link TransposedMultiRow} layout definitions.
*/
export declare class _MultiRowLayout {
_grid: TransposedMultiRow;
_columnsPerItem: number;
_bindingGroups: _CellGroup[];
_groupsByRow: any;
/**
* Initializes a new instance of the {@link _LayoutDef} class.
*
* @param grid {@link TransposedMultiRow} that owns this layout.
* @param layoutDef Array that contains the layout definition.
*/
constructor(grid: TransposedMultiRow, layoutDef: any[]);
readonly totalRowSpan: number;
private _parseCellGroups;
_getGroupByRow(r: number): _CellGroup;
_getGroupIndexByRow(r: number): any;
_updateCellTypes(item: any): void;
}
/**
* Extends the {@link FlexGrid} control to display data using a transposed

@@ -100,3 +151,3 @@ * layout, where columns represent data items and rows represent item

* {@link FlexGrid.allowSorting}, {@link FlexGrid.columnLayout},
* {@link Column.width}, {@link Selector}.
* {@link Column.width}, {@link FlexGridFilter}, {@link Selector}.
*/

@@ -106,2 +157,3 @@ export declare class TransposedMultiRow extends FlexGrid {

_layout: _MultiRowLayout;
_bindingColumns: any;
protected _view: ICollectionView;

@@ -186,72 +238,1 @@ protected _keyPrefix: string;

}
/**
* Creates HTML elements that represent cells within a {@link TransposedMultiRow} control.
*/
export declare class _CellFactory extends CellFactory {
updateCell(p: GridPanel, r: number, c: number, cell: HTMLElement, rng?: CellRange, updateContent?: boolean): void;
private findCell;
}
/**
* Describes a group of cells that may span multiple rows and columns.
*/
export declare class _CellGroup extends _Cell {
_g: TransposedMultiRow;
_layout: _MultiRowLayout;
_colstart: number;
_rowstart: number;
_cells: _Cell[];
_cols: ColumnCollection;
_rng: CellRange[];
/**
* Initializes a new instance of the {@link _CellGroup} class.
*
* @param layout {@link _Layout} that owns the {@link _CellGroup}.
* @param options JavaScript object containing initialization data for the new {@link _CellGroup}.
*/
constructor(layout: _MultiRowLayout, options?: any);
_copy(key: string, value: any): boolean;
readonly cells: _Cell[];
closeGroup(columnsPerItem: number): void;
getMergedRange(p: GridPanel, r: number, c: number): CellRange;
getBindingColumn(p: GridPanel, r: number, c: number): Column;
_cellFits(cell: _Cell, index: number, r: number, c: number): boolean;
_slotTaken(r: number, c: number, index?: number): boolean;
_updateCellTypes(item: any): void;
}
/**
* Provides custom merging for {@link TransposedMultiRow} controls.
*/
export declare class _MergeManager extends MergeManager {
/**
* Gets a {@link CellRange} that specifies the merged extent of a cell
* in a {@link GridPanel}.
*
* @param p The {@link GridPanel} that contains the range.
* @param r The index of the row that contains the cell.
* @param c The index of the column that contains the cell.
* @param clip Specifies whether to clip the merged range to the grid's current view range.
* @return A {@link CellRange} that specifies the merged range, or null if the cell is not merged.
*/
getMergedRange(p: GridPanel, r: number, c: number, clip?: boolean): CellRange;
}
/**
* Class that parses {@link TransposedMultiRow} layout definitions.
*/
export declare class _MultiRowLayout {
_grid: TransposedMultiRow;
_columnsPerItem: number;
_bindingGroups: _CellGroup[];
_groupsByRow: any;
/**
* Initializes a new instance of the {@link _LayoutDef} class.
*
* @param grid {@link TransposedMultiRow} that owns this layout.
* @param layoutDef Array that contains the layout definition.
*/
constructor(grid: TransposedMultiRow, layoutDef: any[]);
readonly totalRowSpan: number;
private _parseCellGroups;
_getGroupByRow(r: number): _CellGroup;
_getGroupIndexByRow(r: number): any;
_updateCellTypes(item: any): void;
}
/*!
*
* Wijmo Library 5.20202.698-nightly.d20200715.t020614
* Wijmo Library 5.20202.698
* http://wijmo.com/

@@ -14,2 +14,2 @@ *

"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(o,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,e){o.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])})(o,e)};return function(o,e){extendStatics(o,e);function __(){this.constructor=o}o.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=require("@grapecity/wijmo.grid.transposedmultirow"),_Cell=function(o){__extends(_Cell,o);function _Cell(e){var t=o.call(this)||this;t._row=t._col=0;t._rowspan=t._colspan=1;e&&wijmo_1.copy(t,e);return t}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(o){this._row=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(o){this._col=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(o){this._colspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(o){this._rowspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(wijmo_grid_1.Column);exports._Cell=_Cell;var _MultiRow=function(o){__extends(_MultiRow,o);function _MultiRow(e,t){var r=o.call(this,e)||this;r._idxData=t;return r}_MultiRow.prototype.setDataType=function(o){this._type=o};_MultiRow.prototype.setDataMap=function(o){this._map=o};_MultiRow.prototype.setFormat=function(o){this._fmt=o};_MultiRow.prototype.setCssClass=function(o){this._cssClass=o};_MultiRow.prototype.setAlign=function(o){this._align=o};return _MultiRow}(wijmo_grid_1.Row);exports._MultiRow=_MultiRow;var _GridPanel=function(o){__extends(_GridPanel,o);function _GridPanel(){return null!==o&&o.apply(this,arguments)||this}_GridPanel.prototype.getCellData=function(e,t,r){if(this.cellType!=wijmo_grid_1.CellType.Cell)return o.prototype.getCellData.call(this,e,t,r);if(wijmo_1.isString(t)&&(t=this.columns.indexOf(t))<0)throw"Invalid column name or binding.";var n=this.grid,i=n.rows[e],l=i.format,s=null,a=this.findCell(n,e,t);i&&a&&i.setFormat(a.format);try{s=o.prototype.getCellData.call(this,e,t,r)}finally{i&&a&&i.setFormat(l)}return s};_GridPanel.prototype.findCell=function(o,e,t){for(var r=o._getGroupByRow(e),n=t%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==e&&n>=r._colstart+l.col&&n<r._colstart+l.col+l.colspan)return l}return null};return _GridPanel}(wijmo_grid_1.GridPanel);exports._GridPanel=_GridPanel;var TransposedMultiRow=function(o){__extends(TransposedMultiRow,o);function TransposedMultiRow(e,t){var r=o.call(this,e)||this;r._keyPrefix="item";wijmo_1.addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=wijmo_grid_1.AllowDragging.None;r.allowSorting=wijmo_grid_1.AllowSorting.None;r.mergeManager=new _MergeManager(r);r.cellFactory=new _CellFactory;r._gpCells=new _GridPanel(r,wijmo_grid_1.CellType.Cell,r._rows,r._cols,r._eCt);r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new wijmo_grid_1.ColumnCollection(r,r.columns.defaultSize);r.initialize(t);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(o){this._layoutDef=wijmo_1.asArray(o);this._layout=new _MultiRowLayout(this,o);this._rowInfoChanged()},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.getBindingColumn=function(o,e,t){var r=null;if(o==this.cells){r=this._getGroupByRow(e).getBindingColumn(o,e,t)}return r};Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowAddNew",{get:function(){return!1},set:function(o){wijmo_1.assert(!o,"TransposedMultiRow does not support items addition.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDelete",{get:function(){return!1},set:function(o){wijmo_1.assert(!o,"TransposedMultiRow does not support items deletion.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDragging",{get:function(){return wijmo_grid_1.AllowDragging.None},set:function(o){wijmo_1.assert(o===wijmo_grid_1.AllowDragging.None,"TransposedMultiRow does not support dragging.");if(o!==this._alDragging){this._alDragging=o;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(o){wijmo_1.assert(!o,"TransposedMultiRow does not support pinning.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowSorting",{get:function(){return wijmo_grid_1.AllowSorting.None},set:function(o){wijmo_1.assert(o===wijmo_grid_1.AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=o},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnLayout",{get:function(){throw"TransposedMultiRow does not support column layout."},set:function(o){throw"TransposedMultiRow does not support column layout."},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.refresh=function(e){var t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else o.prototype.refresh.call(this,e)};TransposedMultiRow.prototype.onLoadedRows=function(e){for(var t=this.columnHeaders.columns,r=0;r<t.length;r++)this.columnHeaders.setCellData(0,r,"");var n=this.columns;for(r=0;r<n.length;r++){var i=n[r];i.align=null;i.dataType=0}var l=this.rowHeaders.columns,s=this.rowHeaders.rows;for(r=0;r<s.length;r++){var a=s[r],u=s[r].index,_=this._getGroupByRow(u);u-=_._rowstart;for(var p=l.length-2;p>=0;p--){for(var c="",w=0;w<_.cells.length;w++){var g=_.cells[w];if(u>=g.row&&u<g.row+g.rowspan&&p>=g.col&&p<g.col+g.colspan){c=g.header;break}}this.rowHeaders.setCellData(a.index,p+1,c)}}l[0].visible=!1;for(r=1;r<l.length;r++){l[r].align="left";l[r].visible=!0;l[r].width=this.columns.defaultSize}o.prototype.onLoadedRows.call(this,e)};TransposedMultiRow.prototype._getGroupByRow=function(o){var e=this._layout._getGroupByRow(o);wijmo_1.assert(e instanceof _CellGroup,"Failed to get the group!");return e};TransposedMultiRow.prototype._addBoundRow=function(o,e){var t=o[e];this.rows.push(new _MultiRow(t,e))};TransposedMultiRow.prototype._updateColumnTypes=function(){o.prototype._updateColumnTypes.call(this);var e=this.collectionView;if(wijmo_1.hasItems(e)&&this._layout){var t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}};TransposedMultiRow.prototype._getBindingColumn=function(e,t,r){return this._layout?o.prototype._getBindingColumn.call(this,e,t,r):this.getBindingColumn(e,t,r.index)};TransposedMultiRow.prototype._getCollectionView=function(e){var t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof wijmo_1.CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;var r=o.prototype._getCollectionView.call(this,e);t&&r instanceof wijmo_1.CollectionView&&(r.getError=function(o,e){var r=o._keys.indexOf(e),n=r%o._bnd.length,i=Math.floor(r/o._bnd.length);return t(o._arr[i],o._bnd[n].path)});return r};TransposedMultiRow.prototype._rowInfoChanged=function(){var o=this.selection,e=this.itemsSource;this.itemsSource=null;this.itemsSource=e;o&&o.isValid&&(this.selection=o)};TransposedMultiRow.prototype._formatItem=function(o,e){var t=this.columnsPerItem,r=e.panel,n=r.cellType,i=r.rows[e.range.row],l=(r.rows[e.range.row2],e.cell);n==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(l,"wj-group-header",0==e.range.row);if(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.RowHeader){var s=this._getGroupByRow(e.row);wijmo_1.toggleClass(l,"wj-group-start",s._rowstart==e.range.row);wijmo_1.toggleClass(l,"wj-group-end",s._rowstart+s._rowspan-1==e.range.row2)}if(t>1&&(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(l,"wj-record-start",e.range.col%t==0);wijmo_1.toggleClass(l,"wj-record-end",e.range.col2%t==t-1)}var a=this.alternatingRowStep;if(a&&n==wijmo_grid_1.CellType.Cell){var u=this._layout.totalRowSpan,_=this._layout._bindingGroups.length,p=Math.floor(i.dataIndex/u)*_,c=i.dataIndex%u,w=(p+=this._layout._getGroupIndexByRow(c)+1)%(a+1)==0;wijmo_1.toggleClass(l,"wj-alt",w)}};TransposedMultiRow.prototype._sourceViewChanged=function(o,e){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(o){var e=this,t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(o).forEach((function(r,n){var i=e._createKeys(o);if(e._supportsProxies()){var l=e._createProxy(o,r,i);t.push(l)}else{var s=e._createTransposedObject(o,r,i);t.push(s)}}));o instanceof wijmo_1.ObservableArray&&o.collectionChanged.addHandler((function(){var o=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(o);e._rowInfoChanged()}))}return t};TransposedMultiRow.prototype._createKeys=function(o){var e=this,t=Array.apply(null,{length:this.columnsPerItem}),r=o.map((function(o,r){return t.map((function(o,t){return e._keyPrefix+r+"_"+t}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(o,e,t){var r={_arr:o,_rowInfo:e,_bnd:e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:t};return new Proxy(r,{ownKeys:function(o){return o._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(o,e){var t=o._keys.indexOf(e);if(t>-1){var r=o._bnd,n=o._arr,i=r.length,l=t%i,s=Math.floor(t/i);return r[l].getValue(n[s])}return o[e]},set:function(o,e,t){var r=o._keys.indexOf(e);if(r>-1){var n=o._bnd,i=o._arr,l=n.length,s=r%l,a=Math.floor(r/l);n[s].setValue(i[a],t);if(i instanceof wijmo_1.ObservableArray){var u=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,i[a],a);i.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(o,e,t){for(var r={_arr:o,_rowInfo:e,_bnd:e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:t},_loop_1=function(e){var n=t[e];Object.defineProperty(r,n,{enumerable:!0,get:function(){var t=r._bnd,n=t.length,i=e%n,l=Math.floor(e/n);return t[i].getValue(o[l])},set:function(t){var n=r._bnd,i=n.length,l=e%i,s=Math.floor(e/i);n[l].setValue(o[s],t);if(o instanceof wijmo_1.ObservableArray){var a=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,o[s],s);o.onCollectionChanged(a)}return!0}})},n=0;n<t.length;n++)_loop_1(n);return r};TransposedMultiRow.prototype._getRowInfo=function(o){var e=[];if(this._layout){for(var t=this.rowHeaders.columns,r=this.columnsPerItem+1;t.length>r;)t.removeAt(t.length-1);for(;t.length<r;)t.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach((function(o){for(var t=0;t<o.rowspan;t++){for(var r={bindings:[]},n=0;n<o.colspan;n++)for(var i=0;i<o.cells.length;i++){var l=o.cells[i];if(t>=l.row&&t<l.row+l.rowspan&&n>=l.col&&n<l.col+l.colspan){r.bindings.push(l.binding);break}}e.push(r)}}))}return e};return TransposedMultiRow}(wijmo_grid_1.FlexGrid);exports.TransposedMultiRow=TransposedMultiRow;var _CellFactory=function(o){__extends(_CellFactory,o);function _CellFactory(){return null!==o&&o.apply(this,arguments)||this}_CellFactory.prototype.updateCell=function(e,t,r,n,i,l){if(e.cellType==wijmo_grid_1.CellType.Cell){var s=e.grid,a=s.rows[t],u=s.columns[r],_=a.dataType,p=a.format,c=a.cssClass,w=a.align,g=a.dataMap,d=this.findCell(s,t,r);if(a){a.setDataType(wijmo_1.getType(a.dataItem[u.binding]));if(d){a.setDataMap(d.dataMap);a.setFormat(d.format);a.setCssClass(d.cssClass);a.setAlign(d.align)}}try{o.prototype.updateCell.call(this,e,t,r,n,i,l)}finally{if(a){a.setDataType(_);if(d){g&&a.setDataMap(g);a.setFormat(p);a.setCssClass(c);a.setAlign(w)}}}}else o.prototype.updateCell.call(this,e,t,r,n,i,l)};_CellFactory.prototype.findCell=function(o,e,t){for(var r=o._getGroupByRow(e),n=t%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==e&&n>=r._colstart+l.col&&n<r._colstart+l.col+l.colspan)return l}return null};return _CellFactory}(wijmo_grid_1.CellFactory);exports._CellFactory=_CellFactory;var _CellGroup=function(o){__extends(_CellGroup,o);function _CellGroup(e,t){var r=o.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=e;r._g=e._grid;t&&wijmo_1.copy(r,t);if(!r._cells)throw"Cell group with no cells?";var n=0,i=0;r._cells.forEach((function(o,e){for(;!r._cellFits(o,e,n,i);)0==(i=(i+1)%r.colspan)&&n++;o.row=n;o.col=i}));var l=1,s=1;r._cells.forEach((function(o){l=Math.max(l,o.row+o.rowspan);s=Math.max(s,o.col+o.colspan)}));r.rowspan=l;r.colspan=s;return r}_CellGroup.prototype._copy=function(o,e){var t=this;if("cells"==o){this._cells=[];wijmo_1.isArray(e)&&e.forEach((function(o){var e=new _Cell(o);e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding));t._cells.push(e);t.colspan=Math.max(t.colspan,e.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(o){var e=this;if(o>this.colspan){this._cells.forEach((function(t){t.col==e.colspan-1&&(t.colspan=o-t.col)}));this.colspan=o}this._cells.forEach((function(o){for(;o.col+o.colspan<e.colspan&&!e._slotTaken(o.row,o.col+o.colspan);)o.colspan++}));this._cells.forEach((function(o){for(;o.row+o.rowspan<e.rowspan&&!e._slotTaken(o.row+o.rowspan,o.col);)o.rowspan++}));for(var t=0;t<this.rowspan;t++)for(var r=0;r<this.colspan;r++)wijmo_1.assert(this._slotTaken(t,r),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(o*this.rowspan);this._cells.forEach((function(o){for(var t=0;t<o.rowspan;t++)for(var r=0;r<o.colspan;r++){var n=(o.row+t)*e.colspan+(o.col+r);e._cols.setAt(n,o);var i=new wijmo_grid_1.CellRange(o.row,o.col,o.row+o.rowspan-1,o.col+o.colspan-1);e._rng[n]=i}}));this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(o,e,t){if(t<0)return this._rng[-1];var r=e-this._rowstart,n=t%this.colspan,i=this._rng[r*this.colspan+n];o.cellType==wijmo_grid_1.CellType.RowHeader&&t++;var l=e-r,s=t-n;return i?new wijmo_grid_1.CellRange(l+i.row,s+i.col,l+i.row2,s+i.col2):null};_CellGroup.prototype.getBindingColumn=function(o,e,t){if(t<0)return this;var r=e-this._rowstart,n=t%this.colspan;return this._cols[r*this.colspan+n]};_CellGroup.prototype._cellFits=function(o,e,t,r){if(r>0&&r+o.colspan>this.colspan)return!1;for(var n=0;n<o.colspan;n++)if(this._slotTaken(t,r+n,e))return!1;this.colspan=Math.max(this.colspan,r+o.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(o,e,t){void 0===t&&(t=this._cells.length);for(var r=0;r<t;r++){var n=this._cells[r];if(o>=n.row&&o<=n.row+n.rowspan-1&&e>=n.col&&e<=n.col+n.colspan-1)return!0}return!1};_CellGroup.prototype._updateCellTypes=function(o){this._cols.forEach((function(e){var t=e;null==t.dataType&&t._binding&&(t.dataType=wijmo_1.getType(t._binding.getValue(o)))}))};return _CellGroup}(_Cell);exports._CellGroup=_CellGroup;var _MergeManager=function(o){__extends(_MergeManager,o);function _MergeManager(){return null!==o&&o.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(o,e,t,r){void 0===r&&(r=!0);var n=o.grid;if(e<0||e>=o.rows.length||t<0||t>=o.columns.length)return null;switch(o.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:var i=t;o.cellType==wijmo_grid_1.CellType.RowHeader&&i--;var l=n._getGroupByRow(e);wijmo_1.assert(l instanceof _CellGroup,"Failed to get the group!");var s=l.getMergedRange(o,e,i);wijmo_1.assert(s&&s.contains(e,t),"Merged range must contain source cell");return s;case wijmo_grid_1.CellType.ColumnHeader:var a=n.columnsPerItem,u=t-t%a,_=Math.min(u+a-1,o.columns.length-1);return new wijmo_grid_1.CellRange(0,u,o.rows.length-1,_);case wijmo_grid_1.CellType.TopLeft:return new wijmo_grid_1.CellRange(0,0,o.rows.length-1,o.columns.length-1)}return null};return _MergeManager}(wijmo_grid_1.MergeManager);exports._MergeManager=_MergeManager;var _MultiRowLayout=function(){function _MultiRowLayout(o,e){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=o;this._bindingGroups=this._parseCellGroups(e)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var o=this._bindingGroups;if(o&&o.length){var e=o[o.length-1];return e._rowstart+e.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(o){var e=[],t=1;if(o){for(var r=0,n=0;r<o.length;r++){var i=new _CellGroup(this,o[r]);i._rowstart=n;n+=i._rowspan;t=Math.max(t,i._colspan);e.push(i)}e.forEach((function(o){o.closeGroup(t)}));this._columnsPerItem=t}return e};_MultiRowLayout.prototype._getGroupByRow=function(o){var e=this._getGroupIndexByRow(o);return e>-1?this._bindingGroups[e]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(o){var e=this._groupsByRow[o];if(e)return e;for(var t=this._bindingGroups,r=0;r<t.length;r++){var n=t[r];if(o>=n._rowstart&&o<=n._rowstart+n._rowspan-1){this._groupsByRow[o]=r;return r}}return-1};_MultiRowLayout.prototype._updateCellTypes=function(o){this._bindingGroups.forEach((function(e){e._updateCellTypes(o)}))};return _MultiRowLayout}();exports._MultiRowLayout=_MultiRowLayout;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(o,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,e){o.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])})(o,e)};return function(o,e){extendStatics(o,e);function __(){this.constructor=o}o.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=require("@grapecity/wijmo.grid.transposedmultirow"),_MultiRow=function(o){__extends(_MultiRow,o);function _MultiRow(e,t){var r=o.call(this,e)||this;r._idxData=t;return r}return _MultiRow}(wijmo_grid_1.Row);exports._MultiRow=_MultiRow;var _Cell=function(o){__extends(_Cell,o);function _Cell(e){var t=o.call(this)||this;t._row=t._col=0;t._rowspan=t._colspan=1;e&&wijmo_1.copy(t,e);return t}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(o){this._row=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(o){this._col=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(o){this._colspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(o){this._rowspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(wijmo_grid_1.Column);exports._Cell=_Cell;var _CellGroup=function(o){__extends(_CellGroup,o);function _CellGroup(e,t){var r=o.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=e;r._g=e._grid;t&&wijmo_1.copy(r,t);if(!r._cells)throw"Cell group with no cells?";var n=0,i=0;r._cells.forEach((function(o,e){for(;!r._cellFits(o,e,n,i);)0==(i=(i+1)%r.colspan)&&n++;o.row=n;o.col=i}));var l=1,s=1;r._cells.forEach((function(o){l=Math.max(l,o.row+o.rowspan);s=Math.max(s,o.col+o.colspan)}));r.rowspan=l;r.colspan=s;return r}_CellGroup.prototype._copy=function(o,e){var t=this;if("cells"==o){this._cells=[];wijmo_1.isArray(e)&&e.forEach((function(o){var e=new _Cell(o);e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding));t._cells.push(e);t.colspan=Math.max(t.colspan,e.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(o){var e=this;if(o>this.colspan){this._cells.forEach((function(t){t.col==e.colspan-1&&(t.colspan=o-t.col)}));this.colspan=o}this._cells.forEach((function(o){for(;o.col+o.colspan<e.colspan&&!e._slotTaken(o.row,o.col+o.colspan);)o.colspan++}));this._cells.forEach((function(o){for(;o.row+o.rowspan<e.rowspan&&!e._slotTaken(o.row+o.rowspan,o.col);)o.rowspan++}));for(var t=0;t<this.rowspan;t++)for(var r=0;r<this.colspan;r++)wijmo_1.assert(this._slotTaken(t,r),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(o*this.rowspan);this._cells.forEach((function(o){for(var t=0;t<o.rowspan;t++)for(var r=0;r<o.colspan;r++){var n=(o.row+t)*e.colspan+(o.col+r);e._cols.setAt(n,o);var i=new wijmo_grid_1.CellRange(o.row,o.col,o.row+o.rowspan-1,o.col+o.colspan-1);i.isSingleCell||(e._rng[n]=i)}}));this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(o,e,t){if(t<0)return this._rng[-1];var r=e-this._rowstart,n=t%this.colspan,i=this._rng[r*this.colspan+n];o.cellType==wijmo_grid_1.CellType.RowHeader&&t++;var l=e-r,s=t-n;return i?new wijmo_grid_1.CellRange(l+i.row,s+i.col,l+i.row2,s+i.col2):null};_CellGroup.prototype.getBindingColumn=function(o,e,t){if(t<0)return this;var r=e-this._rowstart,n=t%this.colspan;return this._cols[r*this.colspan+n]};_CellGroup.prototype._cellFits=function(o,e,t,r){if(r>0&&r+o.colspan>this.colspan)return!1;for(var n=0;n<o.colspan;n++)if(this._slotTaken(t,r+n,e))return!1;this.colspan=Math.max(this.colspan,r+o.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(o,e,t){void 0===t&&(t=this._cells.length);for(var r=0;r<t;r++){var n=this._cells[r];if(o>=n.row&&o<=n.row+n.rowspan-1&&e>=n.col&&e<=n.col+n.colspan-1)return!0}return!1};_CellGroup.prototype._updateCellTypes=function(o){this._cols.forEach((function(e){var t=e;null==t.dataType&&t._binding&&(t.dataType=wijmo_1.getType(t._binding.getValue(o)))}))};return _CellGroup}(_Cell);exports._CellGroup=_CellGroup;var _MergeManager=function(o){__extends(_MergeManager,o);function _MergeManager(){return null!==o&&o.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(o,e,t,r){void 0===r&&(r=!0);var n=o.grid;if(e<0||e>=o.rows.length||t<0||t>=o.columns.length)return null;switch(o.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:var i=o.rows[e].dataItem._rowInfo.index,l=t;o.cellType==wijmo_grid_1.CellType.RowHeader&&l--;var s=n._getGroupByRow(e);wijmo_1.assert(s instanceof _CellGroup,"Failed to get the group!");var a=s.getMergedRange(o,i,l);if(a){var u=i,_=e;if(e>0){u=o.rows[e-1].dataItem._rowInfo.index;_=e-1}a.row<=u?a.row=_:a.row=e;var p=i,c=e;if(e<o.rows.length-1){p=o.rows[e+1].dataItem._rowInfo.index;c=e+1}a.row2>=p?a.row2=c:a.row2=e}wijmo_1.assert(!a||a.contains(e,t),"Merged range must contain source cell");return a;case wijmo_grid_1.CellType.ColumnHeader:var w=n.columnsPerItem,g=t-t%w,d=Math.min(g+w-1,o.columns.length-1);return new wijmo_grid_1.CellRange(0,g,o.rows.length-1,d);case wijmo_grid_1.CellType.TopLeft:return new wijmo_grid_1.CellRange(0,0,o.rows.length-1,o.columns.length-1)}return null};return _MergeManager}(wijmo_grid_1.MergeManager);exports._MergeManager=_MergeManager;var _MultiRowLayout=function(){function _MultiRowLayout(o,e){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=o;this._bindingGroups=this._parseCellGroups(e)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var o=this._bindingGroups;if(o&&o.length){var e=o[o.length-1];return e._rowstart+e.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(o){var e=[],t=1;if(o){for(var r=0,n=0;r<o.length;r++){var i=new _CellGroup(this,o[r]);i._rowstart=n;n+=i._rowspan;t=Math.max(t,i._colspan);e.push(i)}e.forEach((function(o){o.closeGroup(t)}));this._columnsPerItem=t}return e};_MultiRowLayout.prototype._getGroupByRow=function(o){var e=this._getGroupIndexByRow(o);return e>-1?this._bindingGroups[e]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(o){var e=this._groupsByRow[o];if(e)return e;for(var t=this._bindingGroups,r=0;r<t.length;r++){var n=t[r];if(o>=n._rowstart&&o<=n._rowstart+n._rowspan-1){this._groupsByRow[o]=r;return r}}return-1};_MultiRowLayout.prototype._updateCellTypes=function(o){this._bindingGroups.forEach((function(e){e._updateCellTypes(o)}))};return _MultiRowLayout}();exports._MultiRowLayout=_MultiRowLayout;var TransposedMultiRow=function(o){__extends(TransposedMultiRow,o);function TransposedMultiRow(e,t){var r=o.call(this,e)||this;r._bindingColumns={};r._keyPrefix="item";wijmo_1.addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=wijmo_grid_1.AllowDragging.None;r.allowSorting=wijmo_grid_1.AllowSorting.None;r.mergeManager=new _MergeManager(r);r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new wijmo_grid_1.ColumnCollection(r,r.columns.defaultSize);r.initialize(t);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(o){this._layoutDef=wijmo_1.asArray(o);this._layout=new _MultiRowLayout(this,o);this._rowInfoChanged()},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.getBindingColumn=function(o,e,t){if(o.cellType!=wijmo_grid_1.CellType.Cell)return null;var r=o.rows[e].dataItem._rowInfo.index,n=r+"_"+t,i=this._bindingColumns[n];if(i)return i;var l=this._getGroupByRow(e).getBindingColumn(o,r,t);if(l){i=new wijmo_grid_1.Column;wijmo_grid_1.FlexGrid._getSerializableProperties(wijmo_grid_1.Column).forEach((function(o){null!=l[o]&&(i[o]=l[o])}));var s=Math.floor(t/this.columnsPerItem),a=t%this.columnsPerItem;i.binding=this._keyPrefix+s+"_"+a;this._bindingColumns[n]=i}return i};Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowAddNew",{get:function(){return!1},set:function(o){wijmo_1.assert(!o,"TransposedMultiRow does not support items addition.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDelete",{get:function(){return!1},set:function(o){wijmo_1.assert(!o,"TransposedMultiRow does not support items deletion.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowDragging",{get:function(){return wijmo_grid_1.AllowDragging.None},set:function(o){wijmo_1.assert(o===wijmo_grid_1.AllowDragging.None,"TransposedMultiRow does not support dragging.");if(o!==this._alDragging){this._alDragging=o;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(o){wijmo_1.assert(!o,"TransposedMultiRow does not support pinning.")},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"allowSorting",{get:function(){return wijmo_grid_1.AllowSorting.None},set:function(o){wijmo_1.assert(o===wijmo_grid_1.AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=o},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnLayout",{get:function(){throw"TransposedMultiRow does not support column layout."},set:function(o){throw"TransposedMultiRow does not support column layout."},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.refresh=function(e){var t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else o.prototype.refresh.call(this,e)};TransposedMultiRow.prototype.onLoadedRows=function(e){for(var t=this,r=this.columnHeaders.columns,n=0;n<r.length;n++)this.columnHeaders.setCellData(0,n,"");var i=this.columns;for(n=0;n<i.length;n++){var l=i[n];l.align=null;l.dataType=0}var s=this.rowHeaders.columns;this.rows.forEach((function(o){var e=o.dataItem._rowInfo;if(e)for(var r=s.length-2;r>=0;r--){var n=e.headers[r]||wijmo_1.toHeaderCase(e.bindings[r]);t.rowHeaders.setCellData(o.index,r+1,n)}}));s[0].visible=!1;for(n=1;n<s.length;n++){s[n].align="left";s[n].visible=!0;s[n].width=this.columns.defaultSize}o.prototype.onLoadedRows.call(this,e)};TransposedMultiRow.prototype._getGroupByRow=function(o){var e=this.cells.rows[o].dataItem._rowInfo.index,t=this._layout._getGroupByRow(e);wijmo_1.assert(t instanceof _CellGroup,"Failed to get the group!");return t};TransposedMultiRow.prototype._addBoundRow=function(o,e){var t=o[e];this.rows.push(new _MultiRow(t,e))};TransposedMultiRow.prototype._updateColumnTypes=function(){o.prototype._updateColumnTypes.call(this);var e=this.collectionView;if(wijmo_1.hasItems(e)&&this._layout){var t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}};TransposedMultiRow.prototype._getBindingColumn=function(e,t,r){if(this._layout){e==this.cells&&(r=this.getBindingColumn(e,t,r.index));return r}return o.prototype._getBindingColumn.call(this,e,t,r)};TransposedMultiRow.prototype._getCollectionView=function(e){var t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof wijmo_1.CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;var r=o.prototype._getCollectionView.call(this,e);t&&r instanceof wijmo_1.CollectionView&&(r.getError=function(o,e){var r=o._keys.indexOf(e),n=r%o._bnd.length,i=Math.floor(r/o._bnd.length);return t(o._arr[i],o._bnd[n].path)});return r};TransposedMultiRow.prototype._rowInfoChanged=function(){var o=this.selection,e=this.itemsSource;this._bindingColumns={};this.itemsSource=null;this.itemsSource=e;o&&o.isValid&&(this.selection=o)};TransposedMultiRow.prototype._formatItem=function(o,e){var t=this.columnsPerItem,r=e.panel,n=r.cellType,i=r.rows[e.range.row],l=(r.rows[e.range.row2],e.cell);n==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(l,"wj-group-header",0==e.range.row);if(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.RowHeader){var s=this._getGroupByRow(e.row);wijmo_1.toggleClass(l,"wj-group-start",s._rowstart==e.range.row);wijmo_1.toggleClass(l,"wj-group-end",s._rowstart+s._rowspan-1==e.range.row2)}if(t>1&&(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(l,"wj-record-start",e.range.col%t==0);wijmo_1.toggleClass(l,"wj-record-end",e.range.col2%t==t-1)}var a=this.alternatingRowStep;if(a&&n==wijmo_grid_1.CellType.Cell){var u=this._layout.totalRowSpan,_=this._layout._bindingGroups.length,p=Math.floor(i.dataIndex/u)*_,c=i.dataIndex%u,w=(p+=this._layout._getGroupIndexByRow(c)+1)%(a+1)==0;wijmo_1.toggleClass(l,"wj-alt",w)}};TransposedMultiRow.prototype._sourceViewChanged=function(o,e){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(o){var e=this,t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(o).forEach((function(r,n){var i=e._createKeys(o);if(e._supportsProxies()){var l=e._createProxy(o,r,i);t.push(l)}else{var s=e._createTransposedObject(o,r,i);t.push(s)}}));o instanceof wijmo_1.ObservableArray&&o.collectionChanged.addHandler((function(){var o=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(o);e._rowInfoChanged()}))}return t};TransposedMultiRow.prototype._createKeys=function(o){var e=this,t=Array.apply(null,{length:this.columnsPerItem}),r=o.map((function(o,r){return t.map((function(o,t){return e._keyPrefix+r+"_"+t}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(o,e,t){var r={_arr:o,_rowInfo:e,_bnd:e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:t};return new Proxy(r,{ownKeys:function(o){return o._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(o,e){var t=o._keys.indexOf(e);if(t>-1){var r=o._bnd,n=o._arr,i=r.length,l=t%i,s=Math.floor(t/i);return r[l].getValue(n[s])}return o[e]},set:function(o,e,t){var r=o._keys.indexOf(e);if(r>-1){var n=o._bnd,i=o._arr,l=n.length,s=r%l,a=Math.floor(r/l);n[s].setValue(i[a],t);if(i instanceof wijmo_1.ObservableArray){var u=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,i[a],a);i.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(o,e,t){for(var r={_arr:o,_rowInfo:e,_bnd:e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:t},_loop_1=function(e){var n=t[e];Object.defineProperty(r,n,{enumerable:!0,get:function(){var t=r._bnd,n=t.length,i=e%n,l=Math.floor(e/n);return t[i].getValue(o[l])},set:function(t){var n=r._bnd,i=n.length,l=e%i,s=Math.floor(e/i);n[l].setValue(o[s],t);if(o instanceof wijmo_1.ObservableArray){var a=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,o[s],s);o.onCollectionChanged(a)}return!0}})},n=0;n<t.length;n++)_loop_1(n);return r};TransposedMultiRow.prototype._getRowInfo=function(o){var e=[];if(this._layout){for(var t=this.rowHeaders.columns,r=this.columnsPerItem+1;t.length>r;)t.removeAt(t.length-1);for(;t.length<r;)t.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach((function(o){for(var t=0;t<o.rowspan;t++){for(var r={index:o._rowstart+t,bindings:[],headers:[]},n=0;n<o.colspan;n++)for(var i=0;i<o.cells.length;i++){var l=o.cells[i];if(t>=l.row&&t<l.row+l.rowspan&&n>=l.col&&n<l.col+l.colspan){r.bindings.push(l.binding);r.headers.push(l.header);break}}e.push(r)}}))}return e};return TransposedMultiRow}(wijmo_grid_1.FlexGrid);exports.TransposedMultiRow=TransposedMultiRow;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
{
"name": "@grapecity/wijmo.grid.transposedmultirow",
"version": "5.20202.698-nightly.d20200715.t020614",
"version": "5.20202.698-rc",
"description": "UI library for pure JS, Angular, React, Vue and more...",

@@ -10,4 +10,4 @@ "author": "GrapeCity, Inc",

"dependencies": {
"@grapecity/wijmo": "5.20202.698-nightly.d20200715.t020614",
"@grapecity/wijmo.grid": "5.20202.698-nightly.d20200715.t020614"
"@grapecity/wijmo": "5.20202.698-rc",
"@grapecity/wijmo.grid": "5.20202.698-rc"
},

@@ -14,0 +14,0 @@ "homepage": "https://www.grapecity.com/wijmo",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc