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.697-nightly.d20200714.t020249 to 5.20202.697-rc

4

es2015-commonjs.js
/*!
*
* Wijmo Library 5.20202.697-nightly.d20200714.t020249
* Wijmo Library 5.20202.697
* 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 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;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,h=n.format,w=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(h);n.setCssClass(w);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 _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 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,h=n.format,w=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(h);n.setCssClass(w);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);
/*!
*
* Wijmo Library 5.20202.697-nightly.d20200714.t020249
* Wijmo Library 5.20202.697
* 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 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;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,c=i.cssClass,u=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(c);i.setAlign(u)}}}}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{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 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,c=i.cssClass,u=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(c);i.setAlign(u)}}}}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);
/*!
*
* Wijmo Library 5.20202.697-nightly.d20200714.t020249
* Wijmo Library 5.20202.697
* http://wijmo.com/

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

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

@@ -5,0 +5,0 @@ *

/*!
*
* Wijmo Library 5.20202.697-nightly.d20200714.t020249
* Wijmo Library 5.20202.697
* http://wijmo.com/

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

"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(o,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,t){o.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])})(o,t)};return function(o,t){extendStatics(o,t);function __(){this.constructor=o}o.prototype=null===t?Object.create(t):(__.prototype=t.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(t){var e=o.call(this)||this;e._row=e._col=0;e._rowspan=e._colspan=1;t&&wijmo_1.copy(e,t);return e}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(t,e){var r=o.call(this,t)||this;r._idxData=e;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(t,e,r){if(this.cellType!=wijmo_grid_1.CellType.Cell)return o.prototype.getCellData.call(this,t,e,r);if(wijmo_1.isString(e)&&(e=this.columns.indexOf(e))<0)throw"Invalid column name or binding.";var n=this.grid,i=n.rows[t],l=i.format,a=null,s=this.findCell(n,t,e);i&&s&&i.setFormat(s.format);try{a=o.prototype.getCellData.call(this,t,e,r)}finally{i&&s&&i.setFormat(l)}return a};_GridPanel.prototype.findCell=function(o,t,e){for(var r=o._getGroupByRow(t),n=e%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==t&&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(t,e){var r=o.call(this,t)||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(e);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,t,e){var r=null;if(o==this.cells){r=this._getGroupByRow(t).getBindingColumn(o,t,e)}return r};Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},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(t){var e=this._rowInfo;if(e._dirty){e._dirty=!1;this._rowInfoChanged()}else o.prototype.refresh.call(this,t)};TransposedMultiRow.prototype.onLoadedRows=function(t){for(var e=this.columnHeaders.columns,r=0;r<e.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,a=this.rowHeaders.rows;for(r=0;r<a.length;r++){var s=a[r],u=a[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(s.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,t)};TransposedMultiRow.prototype._getGroupByRow=function(o){var t=this._layout._getGroupByRow(o);wijmo_1.assert(t instanceof _CellGroup,"Failed to get the group!");return t};TransposedMultiRow.prototype._addBoundRow=function(o,t){var e=o[t];this.rows.push(new _MultiRow(e,t))};TransposedMultiRow.prototype._updateColumnTypes=function(){o.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(wijmo_1.hasItems(t)&&this._layout){var e=t.items[0]._arr;e&&e.length>0&&this._layout._updateCellTypes(e[0])}};TransposedMultiRow.prototype._getBindingColumn=function(t,e,r){return this._layout?o.prototype._getBindingColumn.call(this,t,e,r):this.getBindingColumn(t,e,r.index)};TransposedMultiRow.prototype._getCollectionView=function(t){var e=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(t))t=this._transposeItemsSource(t);else if(t){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(t,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);t instanceof wijmo_1.CollectionView&&(e=t.getError);t=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;var r=o.prototype._getCollectionView.call(this,t);e&&r instanceof wijmo_1.CollectionView&&(r.getError=function(o,t){var r=o._keys.indexOf(t),n=r%o._bnd.length,i=Math.floor(r/o._bnd.length);return e(o._arr[i],o._bnd[n].path)});return r};TransposedMultiRow.prototype._rowInfoChanged=function(){var o=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;this.selection=o};TransposedMultiRow.prototype._formatItem=function(o,t){var e=this.columnsPerItem,r=t.panel,n=r.cellType,i=r.rows[t.range.row],l=(r.rows[t.range.row2],t.cell);n==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(l,"wj-group-header",0==t.range.row);if(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.RowHeader){var a=this._getGroupByRow(t.row);wijmo_1.toggleClass(l,"wj-group-start",a._rowstart==t.range.row);wijmo_1.toggleClass(l,"wj-group-end",a._rowstart+a._rowspan-1==t.range.row2)}if(e>1&&(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(l,"wj-record-start",t.range.col%e==0);wijmo_1.toggleClass(l,"wj-record-end",t.range.col2%e==e-1)}var s=this.alternatingRowStep;if(s&&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)%(s+1)==0;wijmo_1.toggleClass(l,"wj-alt",w)}};TransposedMultiRow.prototype._sourceViewChanged=function(o,t){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(o){var t=this,e=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(o).forEach((function(r,n){var i=t._createKeys(o);if(t._supportsProxies()){var l=t._createProxy(o,r,i);e.push(l)}else{var a=t._createTransposedObject(o,r,i);e.push(a)}}));o instanceof wijmo_1.ObservableArray&&o.collectionChanged.addHandler((function(){var o=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);e.onCollectionChanged(o);t._rowInfoChanged()}))}return e};TransposedMultiRow.prototype._createKeys=function(o){var t=this,e=Array.apply(null,{length:this.columnsPerItem}),r=o.map((function(o,r){return e.map((function(o,e){return t._keyPrefix+r+"_"+e}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(o,t,e){var r={_arr:o,_rowInfo:t,_bnd:t.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:e};return new Proxy(r,{ownKeys:function(o){return o._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(o,t){var e=o._keys.indexOf(t);if(e>-1){var r=o._bnd,n=o._arr,i=r.length,l=e%i,a=Math.floor(e/i);return r[l].getValue(n[a])}return o[t]},set:function(o,t,e){var r=o._keys.indexOf(t);if(r>-1){var n=o._bnd,i=o._arr,l=n.length,a=r%l,s=Math.floor(r/l);n[a].setValue(i[s],e);if(i instanceof wijmo_1.ObservableArray){var u=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,i[s],s);i.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(o,t,e){for(var r={_arr:o,_rowInfo:t,_bnd:t.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:e},_loop_1=function(t){var n=e[t];Object.defineProperty(r,n,{enumerable:!0,get:function(){var e=r._bnd,n=e.length,i=t%n,l=Math.floor(t/n);return e[i].getValue(o[l])},set:function(e){var n=r._bnd,i=n.length,l=t%i,a=Math.floor(t/i);n[l].setValue(o[a],e);if(o instanceof wijmo_1.ObservableArray){var s=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,o[a],a);o.onCollectionChanged(s)}return!0}})},n=0;n<e.length;n++)_loop_1(n);return r};TransposedMultiRow.prototype._getRowInfo=function(o){var t=[];if(this._layout){for(var e=this.rowHeaders.columns,r=this.columnsPerItem+1;e.length>r;)e.removeAt(e.length-1);for(;e.length<r;)e.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach((function(o){for(var e=0;e<o.rowspan;e++){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(e>=l.row&&e<l.row+l.rowspan&&n>=l.col&&n<l.col+l.colspan){r.bindings.push(l.binding);break}}t.push(r)}}))}return t};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(t,e,r,n,i,l){if(t.cellType==wijmo_grid_1.CellType.Cell){var a=t.grid,s=a.rows[e],u=a.columns[r],_=s.dataType,p=s.format,c=s.cssClass,w=s.align,g=s.dataMap,d=this.findCell(a,e,r);if(s){s.setDataType(wijmo_1.getType(s.dataItem[u.binding]));if(d){s.setDataMap(d.dataMap);s.setFormat(d.format);s.setCssClass(d.cssClass);s.setAlign(d.align)}}try{o.prototype.updateCell.call(this,t,e,r,n,i,l)}finally{if(s){s.setDataType(_);if(d){g&&s.setDataMap(g);s.setFormat(p);s.setCssClass(c);s.setAlign(w)}}}}else o.prototype.updateCell.call(this,t,e,r,n,i,l)};_CellFactory.prototype.findCell=function(o,t,e){for(var r=o._getGroupByRow(t),n=e%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==t&&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(t,e){var r=o.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=t;r._g=t._grid;e&&wijmo_1.copy(r,e);if(!r._cells)throw"Cell group with no cells?";var n=0,i=0;r._cells.forEach((function(o,t){for(;!r._cellFits(o,t,n,i);)0==(i=(i+1)%r.colspan)&&n++;o.row=n;o.col=i}));var l=1,a=1;r._cells.forEach((function(o){l=Math.max(l,o.row+o.rowspan);a=Math.max(a,o.col+o.colspan)}));r.rowspan=l;r.colspan=a;return r}_CellGroup.prototype._copy=function(o,t){var e=this;if("cells"==o){this._cells=[];wijmo_1.isArray(t)&&t.forEach((function(o){var t=new _Cell(o);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));e._cells.push(t);e.colspan=Math.max(e.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(o){var t=this;if(o>this.colspan){this._cells.forEach((function(e){e.col==t.colspan-1&&(e.colspan=o-e.col)}));this.colspan=o}this._cells.forEach((function(o){for(;o.col+o.colspan<t.colspan&&!t._slotTaken(o.row,o.col+o.colspan);)o.colspan++}));this._cells.forEach((function(o){for(;o.row+o.rowspan<t.rowspan&&!t._slotTaken(o.row+o.rowspan,o.col);)o.rowspan++}));for(var e=0;e<this.rowspan;e++)for(var r=0;r<this.colspan;r++)wijmo_1.assert(this._slotTaken(e,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 e=0;e<o.rowspan;e++)for(var r=0;r<o.colspan;r++){var n=(o.row+e)*t.colspan+(o.col+r);t._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);t._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,t,e){if(e<0)return this._rng[-1];var r=t-this._rowstart,n=e%this.colspan,i=this._rng[r*this.colspan+n];o.cellType==wijmo_grid_1.CellType.RowHeader&&e++;var l=t-r,a=e-n;return i?new wijmo_grid_1.CellRange(l+i.row,a+i.col,l+i.row2,a+i.col2):null};_CellGroup.prototype.getBindingColumn=function(o,t,e){if(e<0)return this;var r=t-this._rowstart,n=e%this.colspan;return this._cols[r*this.colspan+n]};_CellGroup.prototype._cellFits=function(o,t,e,r){if(r>0&&r+o.colspan>this.colspan)return!1;for(var n=0;n<o.colspan;n++)if(this._slotTaken(e,r+n,t))return!1;this.colspan=Math.max(this.colspan,r+o.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(o,t,e){void 0===e&&(e=this._cells.length);for(var r=0;r<e;r++){var n=this._cells[r];if(o>=n.row&&o<=n.row+n.rowspan-1&&t>=n.col&&t<=n.col+n.colspan-1)return!0}return!1};_CellGroup.prototype._updateCellTypes=function(o){this._cols.forEach((function(t){var e=t;null==e.dataType&&e._binding&&(e.dataType=wijmo_1.getType(e._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,t,e,r){void 0===r&&(r=!0);var n=o.grid;if(t<0||t>=o.rows.length||e<0||e>=o.columns.length)return null;switch(o.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:var i=e;o.cellType==wijmo_grid_1.CellType.RowHeader&&i--;var l=n._getGroupByRow(t);wijmo_1.assert(l instanceof _CellGroup,"Failed to get the group!");var a=l.getMergedRange(o,t,i);wijmo_1.assert(a&&a.contains(t,e),"Merged range must contain source cell");return a;case wijmo_grid_1.CellType.ColumnHeader:var s=n.columnsPerItem,u=e-e%s,_=Math.min(u+s-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,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=o;this._bindingGroups=this._parseCellGroups(t)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var o=this._bindingGroups;if(o&&o.length){var t=o[o.length-1];return t._rowstart+t.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(o){var t=[],e=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;e=Math.max(e,i._colspan);t.push(i)}t.forEach((function(o){o.closeGroup(e)}));this._columnsPerItem=e}return t};_MultiRowLayout.prototype._getGroupByRow=function(o){var t=this._getGroupIndexByRow(o);return t>-1?this._bindingGroups[t]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(o){var t=this._groupsByRow[o];if(t)return t;for(var e=this._bindingGroups,r=0;r<e.length;r++){var n=e[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(t){t._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,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,t){o.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])})(o,t)};return function(o,t){extendStatics(o,t);function __(){this.constructor=o}o.prototype=null===t?Object.create(t):(__.prototype=t.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(t){var e=o.call(this)||this;e._row=e._col=0;e._rowspan=e._colspan=1;t&&wijmo_1.copy(e,t);return e}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(t,e){var r=o.call(this,t)||this;r._idxData=e;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(t,e,r){if(this.cellType!=wijmo_grid_1.CellType.Cell)return o.prototype.getCellData.call(this,t,e,r);if(wijmo_1.isString(e)&&(e=this.columns.indexOf(e))<0)throw"Invalid column name or binding.";var n=this.grid,i=n.rows[t],l=i.format,a=null,s=this.findCell(n,t,e);i&&s&&i.setFormat(s.format);try{a=o.prototype.getCellData.call(this,t,e,r)}finally{i&&s&&i.setFormat(l)}return a};_GridPanel.prototype.findCell=function(o,t,e){for(var r=o._getGroupByRow(t),n=e%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==t&&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(t,e){var r=o.call(this,t)||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(e);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,t,e){var r=null;if(o==this.cells){r=this._getGroupByRow(t).getBindingColumn(o,t,e)}return r};Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},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(t){var e=this._rowInfo;if(e._dirty){e._dirty=!1;this._rowInfoChanged()}else o.prototype.refresh.call(this,t)};TransposedMultiRow.prototype.onLoadedRows=function(t){for(var e=this.columnHeaders.columns,r=0;r<e.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,a=this.rowHeaders.rows;for(r=0;r<a.length;r++){var s=a[r],u=a[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(s.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,t)};TransposedMultiRow.prototype._getGroupByRow=function(o){var t=this._layout._getGroupByRow(o);wijmo_1.assert(t instanceof _CellGroup,"Failed to get the group!");return t};TransposedMultiRow.prototype._addBoundRow=function(o,t){var e=o[t];this.rows.push(new _MultiRow(e,t))};TransposedMultiRow.prototype._updateColumnTypes=function(){o.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(wijmo_1.hasItems(t)&&this._layout){var e=t.items[0]._arr;e&&e.length>0&&this._layout._updateCellTypes(e[0])}};TransposedMultiRow.prototype._getBindingColumn=function(t,e,r){return this._layout?o.prototype._getBindingColumn.call(this,t,e,r):this.getBindingColumn(t,e,r.index)};TransposedMultiRow.prototype._getCollectionView=function(t){var e=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(t))t=this._transposeItemsSource(t);else if(t){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(t,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);t instanceof wijmo_1.CollectionView&&(e=t.getError);t=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;var r=o.prototype._getCollectionView.call(this,t);e&&r instanceof wijmo_1.CollectionView&&(r.getError=function(o,t){var r=o._keys.indexOf(t),n=r%o._bnd.length,i=Math.floor(r/o._bnd.length);return e(o._arr[i],o._bnd[n].path)});return r};TransposedMultiRow.prototype._rowInfoChanged=function(){var o=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;o&&o.isValid&&(this.selection=o)};TransposedMultiRow.prototype._formatItem=function(o,t){var e=this.columnsPerItem,r=t.panel,n=r.cellType,i=r.rows[t.range.row],l=(r.rows[t.range.row2],t.cell);n==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(l,"wj-group-header",0==t.range.row);if(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.RowHeader){var a=this._getGroupByRow(t.row);wijmo_1.toggleClass(l,"wj-group-start",a._rowstart==t.range.row);wijmo_1.toggleClass(l,"wj-group-end",a._rowstart+a._rowspan-1==t.range.row2)}if(e>1&&(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(l,"wj-record-start",t.range.col%e==0);wijmo_1.toggleClass(l,"wj-record-end",t.range.col2%e==e-1)}var s=this.alternatingRowStep;if(s&&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)%(s+1)==0;wijmo_1.toggleClass(l,"wj-alt",w)}};TransposedMultiRow.prototype._sourceViewChanged=function(o,t){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(o){var t=this,e=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(o).forEach((function(r,n){var i=t._createKeys(o);if(t._supportsProxies()){var l=t._createProxy(o,r,i);e.push(l)}else{var a=t._createTransposedObject(o,r,i);e.push(a)}}));o instanceof wijmo_1.ObservableArray&&o.collectionChanged.addHandler((function(){var o=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);e.onCollectionChanged(o);t._rowInfoChanged()}))}return e};TransposedMultiRow.prototype._createKeys=function(o){var t=this,e=Array.apply(null,{length:this.columnsPerItem}),r=o.map((function(o,r){return e.map((function(o,e){return t._keyPrefix+r+"_"+e}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(o,t,e){var r={_arr:o,_rowInfo:t,_bnd:t.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:e};return new Proxy(r,{ownKeys:function(o){return o._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(o,t){var e=o._keys.indexOf(t);if(e>-1){var r=o._bnd,n=o._arr,i=r.length,l=e%i,a=Math.floor(e/i);return r[l].getValue(n[a])}return o[t]},set:function(o,t,e){var r=o._keys.indexOf(t);if(r>-1){var n=o._bnd,i=o._arr,l=n.length,a=r%l,s=Math.floor(r/l);n[a].setValue(i[s],e);if(i instanceof wijmo_1.ObservableArray){var u=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,i[s],s);i.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(o,t,e){for(var r={_arr:o,_rowInfo:t,_bnd:t.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:e},_loop_1=function(t){var n=e[t];Object.defineProperty(r,n,{enumerable:!0,get:function(){var e=r._bnd,n=e.length,i=t%n,l=Math.floor(t/n);return e[i].getValue(o[l])},set:function(e){var n=r._bnd,i=n.length,l=t%i,a=Math.floor(t/i);n[l].setValue(o[a],e);if(o instanceof wijmo_1.ObservableArray){var s=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,o[a],a);o.onCollectionChanged(s)}return!0}})},n=0;n<e.length;n++)_loop_1(n);return r};TransposedMultiRow.prototype._getRowInfo=function(o){var t=[];if(this._layout){for(var e=this.rowHeaders.columns,r=this.columnsPerItem+1;e.length>r;)e.removeAt(e.length-1);for(;e.length<r;)e.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach((function(o){for(var e=0;e<o.rowspan;e++){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(e>=l.row&&e<l.row+l.rowspan&&n>=l.col&&n<l.col+l.colspan){r.bindings.push(l.binding);break}}t.push(r)}}))}return t};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(t,e,r,n,i,l){if(t.cellType==wijmo_grid_1.CellType.Cell){var a=t.grid,s=a.rows[e],u=a.columns[r],_=s.dataType,p=s.format,c=s.cssClass,w=s.align,g=s.dataMap,d=this.findCell(a,e,r);if(s){s.setDataType(wijmo_1.getType(s.dataItem[u.binding]));if(d){s.setDataMap(d.dataMap);s.setFormat(d.format);s.setCssClass(d.cssClass);s.setAlign(d.align)}}try{o.prototype.updateCell.call(this,t,e,r,n,i,l)}finally{if(s){s.setDataType(_);if(d){g&&s.setDataMap(g);s.setFormat(p);s.setCssClass(c);s.setAlign(w)}}}}else o.prototype.updateCell.call(this,t,e,r,n,i,l)};_CellFactory.prototype.findCell=function(o,t,e){for(var r=o._getGroupByRow(t),n=e%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==t&&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(t,e){var r=o.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=t;r._g=t._grid;e&&wijmo_1.copy(r,e);if(!r._cells)throw"Cell group with no cells?";var n=0,i=0;r._cells.forEach((function(o,t){for(;!r._cellFits(o,t,n,i);)0==(i=(i+1)%r.colspan)&&n++;o.row=n;o.col=i}));var l=1,a=1;r._cells.forEach((function(o){l=Math.max(l,o.row+o.rowspan);a=Math.max(a,o.col+o.colspan)}));r.rowspan=l;r.colspan=a;return r}_CellGroup.prototype._copy=function(o,t){var e=this;if("cells"==o){this._cells=[];wijmo_1.isArray(t)&&t.forEach((function(o){var t=new _Cell(o);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));e._cells.push(t);e.colspan=Math.max(e.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(o){var t=this;if(o>this.colspan){this._cells.forEach((function(e){e.col==t.colspan-1&&(e.colspan=o-e.col)}));this.colspan=o}this._cells.forEach((function(o){for(;o.col+o.colspan<t.colspan&&!t._slotTaken(o.row,o.col+o.colspan);)o.colspan++}));this._cells.forEach((function(o){for(;o.row+o.rowspan<t.rowspan&&!t._slotTaken(o.row+o.rowspan,o.col);)o.rowspan++}));for(var e=0;e<this.rowspan;e++)for(var r=0;r<this.colspan;r++)wijmo_1.assert(this._slotTaken(e,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 e=0;e<o.rowspan;e++)for(var r=0;r<o.colspan;r++){var n=(o.row+e)*t.colspan+(o.col+r);t._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);t._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,t,e){if(e<0)return this._rng[-1];var r=t-this._rowstart,n=e%this.colspan,i=this._rng[r*this.colspan+n];o.cellType==wijmo_grid_1.CellType.RowHeader&&e++;var l=t-r,a=e-n;return i?new wijmo_grid_1.CellRange(l+i.row,a+i.col,l+i.row2,a+i.col2):null};_CellGroup.prototype.getBindingColumn=function(o,t,e){if(e<0)return this;var r=t-this._rowstart,n=e%this.colspan;return this._cols[r*this.colspan+n]};_CellGroup.prototype._cellFits=function(o,t,e,r){if(r>0&&r+o.colspan>this.colspan)return!1;for(var n=0;n<o.colspan;n++)if(this._slotTaken(e,r+n,t))return!1;this.colspan=Math.max(this.colspan,r+o.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(o,t,e){void 0===e&&(e=this._cells.length);for(var r=0;r<e;r++){var n=this._cells[r];if(o>=n.row&&o<=n.row+n.rowspan-1&&t>=n.col&&t<=n.col+n.colspan-1)return!0}return!1};_CellGroup.prototype._updateCellTypes=function(o){this._cols.forEach((function(t){var e=t;null==e.dataType&&e._binding&&(e.dataType=wijmo_1.getType(e._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,t,e,r){void 0===r&&(r=!0);var n=o.grid;if(t<0||t>=o.rows.length||e<0||e>=o.columns.length)return null;switch(o.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:var i=e;o.cellType==wijmo_grid_1.CellType.RowHeader&&i--;var l=n._getGroupByRow(t);wijmo_1.assert(l instanceof _CellGroup,"Failed to get the group!");var a=l.getMergedRange(o,t,i);wijmo_1.assert(a&&a.contains(t,e),"Merged range must contain source cell");return a;case wijmo_grid_1.CellType.ColumnHeader:var s=n.columnsPerItem,u=e-e%s,_=Math.min(u+s-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,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=o;this._bindingGroups=this._parseCellGroups(t)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var o=this._bindingGroups;if(o&&o.length){var t=o[o.length-1];return t._rowstart+t.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(o){var t=[],e=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;e=Math.max(e,i._colspan);t.push(i)}t.forEach((function(o){o.closeGroup(e)}));this._columnsPerItem=e}return t};_MultiRowLayout.prototype._getGroupByRow=function(o){var t=this._getGroupIndexByRow(o);return t>-1?this._bindingGroups[t]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(o){var t=this._groupsByRow[o];if(t)return t;for(var e=this._bindingGroups,r=0;r<e.length;r++){var n=e[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(t){t._updateCellTypes(o)}))};return _MultiRowLayout}();exports._MultiRowLayout=_MultiRowLayout;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
{
"name": "@grapecity/wijmo.grid.transposedmultirow",
"version": "5.20202.697-nightly.d20200714.t020249",
"version": "5.20202.697-rc",
"description": "UI library for pure JS, Angular, React, Vue and more...",

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

"dependencies": {
"@grapecity/wijmo": "5.20202.697-nightly.d20200714.t020249",
"@grapecity/wijmo.grid": "5.20202.697-nightly.d20200714.t020249"
"@grapecity/wijmo": "5.20202.697-rc",
"@grapecity/wijmo.grid": "5.20202.697-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