Socket
Socket
Sign inDemoInstall

@grapecity/wijmo.grid.transposedmultirow

Package Overview
Dependencies
2
Maintainers
1
Versions
862
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.20201.681-nightly.d20200616.t020140 to 5.20201.681-nightly.d20200617.t020400

4

es2015-commonjs.js
/*!
*
* Wijmo Library 5.20201.681-nightly.d20200616.t020140
* Wijmo Library 5.20201.681-nightly.d20200617.t020400
* 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 _MultiRow extends wijmo_grid_1.Row{constructor(e,t){super(e);this._idxData=t;this._idxData}setDataType(e){this._type=e}setDataMap(e){this._map=e}setFormat(e){this._fmt=e}}exports._MultiRow=_MultiRow;class _Cell extends wijmo_grid_1.Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&wijmo_1.copy(this,e)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")}}exports._Cell=_Cell;class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;t&&wijmo_1.copy(this,t);if(!this._cells)throw"Cell group with no cells?";let o=0,l=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,o,l);)0==(l=(l+1)%this.colspan)&&o++;e.row=o;e.col=l});let r=1,s=1;this._cells.forEach(e=>{r=Math.max(r,e.row+e.rowspan);s=Math.max(s,e.col+e.colspan)});this.rowspan=r;this.colspan=s}_copy(e,t){if("cells"==e){this._cells=[];wijmo_1.isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._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),r=new wijmo_grid_1.CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);this._rng[l]=r}});this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)}getMergedRange(e,t,o){if(o<0)return this._rng[-1];let l=t-this._rowstart,r=o%this.colspan,s=this._rng[l*this.colspan+r];e.cellType==wijmo_grid_1.CellType.RowHeader&&o++;let i=t-l,n=o-r;return s?new wijmo_grid_1.CellRange(i+s.row,n+s.col,i+s.row2,n+s.col2):null}_cellFits(e,t,o,l){if(l>0&&l+e.colspan>this.colspan)return!1;for(let r=0;r<e.colspan;r++)if(this._slotTaken(o,l+r,t))return!1;this.colspan=Math.max(this.colspan,l+e.colspan-1);return!0}_slotTaken(e,t,o=this._cells.length){for(let l=0;l<o;l++){let o=this._cells[l];if(e>=o.row&&e<=o.row+o.rowspan-1&&t>=o.col&&t<=o.col+o.colspan-1)return!0}return!1}}exports._CellGroup=_CellGroup;class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],o=1;if(e){for(let l=0,r=0;l<e.length;l++){let s=new _CellGroup(this,e[l]);s._rowstart=r;r+=s._rowspan;o=Math.max(o,s._colspan);t.push(s)}t.forEach(e=>{e.closeGroup(o)});this._columnsPerItem=o}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let o=this._bindingGroups;for(let t=0;t<o.length;t++){let l=o[t];if(e>=l._rowstart&&e<=l._rowstart+l._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}}exports._MultiRowLayout=_MultiRowLayout;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.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()}get columnsPerItem(){return this._layout._columnsPerItem}_getGroupByRow(e){let t=this._layout._getGroupByRow(e);wijmo_1.assert(t instanceof _CellGroup,"Failed to get the group!");return t}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,r=this.rowHeaders.rows;for(let e=0;e<r.length;e++){let t=r[e],o=r[e].index,s=this._getGroupByRow(o);o-=s._rowstart;for(let e=l.length-2;e>=0;e--){let l="";for(let t=0;t<s.cells.length;t++){let r=s.cells[t];if(o>=r.row&&o<r.row+r.rowspan&&e>=r.col&&e<r.col+r.colspan){l=r.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}this.autoSizeColumns(0,l.length-1,!0);super.onLoadedRows(e)}_addBoundRow(e,t){let o=e[t];this.rows.push(new _MultiRow(o,t))}_getCollectionView(e){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=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return super._getCollectionView(e)}_rowInfoChanged(){this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout(()=>{let e=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;this.selection=e},wijmo_1.Control._REFRESH_INTERVAL)}_formatItem(e,t){let o=this.columnsPerItem,l=t.panel,r=l.cellType,s=l.rows[t.range.row],i=(l.rows[t.range.row2],t.cell);r==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(i,"wj-group-header",0==t.range.row);if(r==wijmo_grid_1.CellType.Cell||r==wijmo_grid_1.CellType.RowHeader){let e=this._getGroupByRow(t.row);wijmo_1.toggleClass(i,"wj-group-start",e._rowstart==t.range.row);wijmo_1.toggleClass(i,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(o>1&&(r==wijmo_grid_1.CellType.Cell||r==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(i,"wj-record-start",t.range.col%o==0);wijmo_1.toggleClass(i,"wj-record-end",t.range.col2%o==o-1)}let n=this.alternatingRowStep;if(n&&r==wijmo_grid_1.CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,o=Math.floor(s.dataIndex/e)*t,l=s.dataIndex%e,r=(o+=this._layout._getGroupIndexByRow(l)+1)%(n+1)==0;wijmo_1.toggleClass(i,"wj-alt",r)}}_sourceViewChanged(e,t){this.activeEditor||this.invalidate()}_transposeItemsSource(e){let t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((o,l)=>{let r=this._createKeys(e);if(this._supportsProxies()){let l=this._createProxy(e,o,r);t.push(l)}else{let l=this._createTransposedObject(e,o,r);t.push(l)}});e instanceof wijmo_1.ObservableArray&&e.collectionChanged.addHandler(()=>{let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(e);this._rowInfoChanged()})}return t}_createKeys(e){let t=Array.apply(null,{length:this.columnsPerItem}),o=e.map((e,o)=>t.map((e,t)=>this._keyPrefix+o+"_"+t));return[].concat.apply([],o)}_supportsProxies(){return null!=window.Proxy}_createProxy(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};return new Proxy(l,{ownKeys:e=>e._keys,getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0,writable:!0}),get:(e,t)=>{let o=e._keys.indexOf(t);if(o>-1){let t=e._bnd,l=e._arr,r=t.length,s=o%r,i=Math.floor(o/r);return t[s].getValue(l[i])}return e[t]},set:(e,t,o)=>{let l=e._keys.indexOf(t);if(l>-1){let t=e._bnd,r=e._arr,s=t.length,i=l%s,n=Math.floor(l/s);t[i].setValue(r[n],o);if(r instanceof wijmo_1.ObservableArray){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,r[n],n);r.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,o){let l={_arr:e,_rowInfo:t},r=t.bindings.map(e=>new wijmo_1.Binding(e));for(let t=0;t<o.length;t++){let s=o[t];Object.defineProperty(l,s,{enumerable:!0,get:()=>{let o=r.length,l=t%o,s=Math.floor(t/o);return r[l].getValue(e[s])},set:o=>{let l=r.length,s=t%l,i=Math.floor(t/l);r[s].setValue(e[i],o);if(e instanceof wijmo_1.ObservableArray){let t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e[i],i);e.onCollectionChanged(t)}return!0}})}return l}_getRowInfo(e){let t=[];if(this._layout){let e=this.rowHeaders.columns,o=this.columnsPerItem+1;for(;e.length>o;)e.removeAt(e.length-1);for(;e.length<o;)e.push(new 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 r=0;r<e.cells.length;r++){let s=e.cells[r];if(o>=s.row&&o<s.row+s.rowspan&&t>=s.col&&t<s.col+s.colspan){l.bindings.push(s.binding);break}}t.push(l)}})}return t}}exports.TransposedMultiRow=TransposedMultiRow;class _CellFactory extends wijmo_grid_1.CellFactory{updateCell(e,t,o,l,r,s){if(e.cellType!=wijmo_grid_1.CellType.Cell){super.updateCell(e,t,o,l,r,s);return}let i=e.grid,n=i.rows[t],a=i.columns[o],_=n.dataType,h=n.format,w=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)}}try{super.updateCell(e,t,o,l,r,s)}finally{if(n){n.setDataType(_);if(c){w&&n.setDataMap(w);n.setFormat(h)}}}}findCell(e,t,o){let l=e._getGroupByRow(t),r=o%e.columnsPerItem;for(let e=0;e<l.cells.length;e++){let o=l.cells[e];if(l._rowstart+o._row==t&&r>=l._colstart+o.col&&r<l._colstart+o.col+o.colspan)return o}return null}}exports._CellFactory=_CellFactory;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,l=!0){let r=e.grid;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 s=r._getGroupByRow(t);wijmo_1.assert(s instanceof _CellGroup,"Failed to get the group!");let i=s.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=r.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;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=require("@grapecity/wijmo.grid.transposedmultirow");class _MultiRow extends wijmo_grid_1.Row{constructor(e,t){super(e);this._idxData=t;this._idxData}setDataType(e){this._type=e}setDataMap(e){this._map=e}setFormat(e){this._fmt=e}}exports._MultiRow=_MultiRow;class _Cell extends wijmo_grid_1.Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&wijmo_1.copy(this,e)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")}}exports._Cell=_Cell;class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;t&&wijmo_1.copy(this,t);if(!this._cells)throw"Cell group with no cells?";let o=0,l=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,o,l);)0==(l=(l+1)%this.colspan)&&o++;e.row=o;e.col=l});let r=1,s=1;this._cells.forEach(e=>{r=Math.max(r,e.row+e.rowspan);s=Math.max(s,e.col+e.colspan)});this.rowspan=r;this.colspan=s}_copy(e,t){if("cells"==e){this._cells=[];wijmo_1.isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._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),r=new wijmo_grid_1.CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);this._rng[l]=r}});this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)}getMergedRange(e,t,o){if(o<0)return this._rng[-1];let l=t-this._rowstart,r=o%this.colspan,s=this._rng[l*this.colspan+r];e.cellType==wijmo_grid_1.CellType.RowHeader&&o++;let i=t-l,n=o-r;return s?new wijmo_grid_1.CellRange(i+s.row,n+s.col,i+s.row2,n+s.col2):null}_cellFits(e,t,o,l){if(l>0&&l+e.colspan>this.colspan)return!1;for(let r=0;r<e.colspan;r++)if(this._slotTaken(o,l+r,t))return!1;this.colspan=Math.max(this.colspan,l+e.colspan-1);return!0}_slotTaken(e,t,o=this._cells.length){for(let l=0;l<o;l++){let o=this._cells[l];if(e>=o.row&&e<=o.row+o.rowspan-1&&t>=o.col&&t<=o.col+o.colspan-1)return!0}return!1}}exports._CellGroup=_CellGroup;class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],o=1;if(e){for(let l=0,r=0;l<e.length;l++){let s=new _CellGroup(this,e[l]);s._rowstart=r;r+=s._rowspan;o=Math.max(o,s._colspan);t.push(s)}t.forEach(e=>{e.closeGroup(o)});this._columnsPerItem=o}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let o=this._bindingGroups;for(let t=0;t<o.length;t++){let l=o[t];if(e>=l._rowstart&&e<=l._rowstart+l._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}}exports._MultiRowLayout=_MultiRowLayout;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.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()}get columnsPerItem(){return this._layout._columnsPerItem}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,r=this.rowHeaders.rows;for(let e=0;e<r.length;e++){let t=r[e],o=r[e].index,s=this._getGroupByRow(o);o-=s._rowstart;for(let e=l.length-2;e>=0;e--){let l="";for(let t=0;t<s.cells.length;t++){let r=s.cells[t];if(o>=r.row&&o<r.row+r.rowspan&&e>=r.col&&e<r.col+r.colspan){l=r.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}this.autoSizeColumns(0,l.length-1,!0);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))}_getCollectionView(e){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=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return super._getCollectionView(e)}_rowInfoChanged(){this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout(()=>{let e=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;this.selection=e},wijmo_1.Control._REFRESH_INTERVAL)}_formatItem(e,t){let o=this.columnsPerItem,l=t.panel,r=l.cellType,s=l.rows[t.range.row],i=(l.rows[t.range.row2],t.cell);r==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(i,"wj-group-header",0==t.range.row);if(r==wijmo_grid_1.CellType.Cell||r==wijmo_grid_1.CellType.RowHeader){let e=this._getGroupByRow(t.row);wijmo_1.toggleClass(i,"wj-group-start",e._rowstart==t.range.row);wijmo_1.toggleClass(i,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(o>1&&(r==wijmo_grid_1.CellType.Cell||r==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(i,"wj-record-start",t.range.col%o==0);wijmo_1.toggleClass(i,"wj-record-end",t.range.col2%o==o-1)}let n=this.alternatingRowStep;if(n&&r==wijmo_grid_1.CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,o=Math.floor(s.dataIndex/e)*t,l=s.dataIndex%e,r=(o+=this._layout._getGroupIndexByRow(l)+1)%(n+1)==0;wijmo_1.toggleClass(i,"wj-alt",r)}}_sourceViewChanged(e,t){this.activeEditor||this.invalidate()}_transposeItemsSource(e){let t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((o,l)=>{let r=this._createKeys(e);if(this._supportsProxies()){let l=this._createProxy(e,o,r);t.push(l)}else{let l=this._createTransposedObject(e,o,r);t.push(l)}});e instanceof wijmo_1.ObservableArray&&e.collectionChanged.addHandler(()=>{let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(e);this._rowInfoChanged()})}return t}_createKeys(e){let t=Array.apply(null,{length:this.columnsPerItem}),o=e.map((e,o)=>t.map((e,t)=>this._keyPrefix+o+"_"+t));return[].concat.apply([],o)}_supportsProxies(){return null!=window.Proxy}_createProxy(e,t,o){let l={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};return new Proxy(l,{ownKeys:e=>e._keys,getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0,writable:!0}),get:(e,t)=>{let o=e._keys.indexOf(t);if(o>-1){let t=e._bnd,l=e._arr,r=t.length,s=o%r,i=Math.floor(o/r);return t[s].getValue(l[i])}return e[t]},set:(e,t,o)=>{let l=e._keys.indexOf(t);if(l>-1){let t=e._bnd,r=e._arr,s=t.length,i=l%s,n=Math.floor(l/s);t[i].setValue(r[n],o);if(r instanceof wijmo_1.ObservableArray){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,r[n],n);r.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,o){let l={_arr:e,_rowInfo:t},r=t.bindings.map(e=>new wijmo_1.Binding(e));for(let t=0;t<o.length;t++){let s=o[t];Object.defineProperty(l,s,{enumerable:!0,get:()=>{let o=r.length,l=t%o,s=Math.floor(t/o);return r[l].getValue(e[s])},set:o=>{let l=r.length,s=t%l,i=Math.floor(t/l);r[s].setValue(e[i],o);if(e instanceof wijmo_1.ObservableArray){let t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e[i],i);e.onCollectionChanged(t)}return!0}})}return l}_getRowInfo(e){let t=[];if(this._layout){let e=this.rowHeaders.columns,o=this.columnsPerItem+1;for(;e.length>o;)e.removeAt(e.length-1);for(;e.length<o;)e.push(new 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 r=0;r<e.cells.length;r++){let s=e.cells[r];if(o>=s.row&&o<s.row+s.rowspan&&t>=s.col&&t<s.col+s.colspan){l.bindings.push(s.binding);break}}t.push(l)}})}return t}}exports.TransposedMultiRow=TransposedMultiRow;class _CellFactory extends wijmo_grid_1.CellFactory{updateCell(e,t,o,l,r,s){if(e.cellType!=wijmo_grid_1.CellType.Cell){super.updateCell(e,t,o,l,r,s);return}let i=e.grid,n=i.rows[t],a=i.columns[o],_=n.dataType,h=n.format,w=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)}}try{super.updateCell(e,t,o,l,r,s)}finally{if(n){n.setDataType(_);if(c){w&&n.setDataMap(w);n.setFormat(h)}}}}findCell(e,t,o){let l=e._getGroupByRow(t),r=o%e.columnsPerItem;for(let e=0;e<l.cells.length;e++){let o=l.cells[e];if(l._rowstart+o._row==t&&r>=l._colstart+o.col&&r<l._colstart+o.col+o.colspan)return o}return null}}exports._CellFactory=_CellFactory;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,l=!0){let r=e.grid;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 s=r._getGroupByRow(t);wijmo_1.assert(s instanceof _CellGroup,"Failed to get the group!");let i=s.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=r.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;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
/*!
*
* Wijmo Library 5.20201.681-nightly.d20200616.t020140
* Wijmo Library 5.20201.681-nightly.d20200617.t020400
* http://wijmo.com/

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

import{copy,asInt,assert,isArray,toHeaderCase,addClass,asArray,toggleClass,tryCast,Binding,Control,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,getType,_registerModule}from"@grapecity/wijmo";import{Column,Row,CellType,CellRange,MergeManager,AllowDragging,AllowSorting,ColumnCollection,FlexGrid,CellFactory}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";export class _MultiRow extends Row{constructor(e,t){super(e);this._idxData=t;this._idxData}setDataType(e){this._type=e}setDataMap(e){this._map=e}setFormat(e){this._fmt=e}}export class _Cell extends Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&copy(this,e)}get row(){return this._row}set row(e){this._row=asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")}}export class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;t&&copy(this,t);if(!this._cells)throw"Cell group with no cells?";let l=0,o=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,l,o);)0==(o=(o+1)%this.colspan)&&l++;e.row=l;e.col=o});let s=1,r=1;this._cells.forEach(e=>{s=Math.max(s,e.row+e.rowspan);r=Math.max(r,e.col+e.colspan)});this.rowspan=s;this.colspan=r}_copy(e,t){if("cells"==e){this._cells=[];isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._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 o=(e.row+t)*this.colspan+(e.col+l),s=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);this._rng[o]=s}});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 o=t-this._rowstart,s=l%this.colspan,r=this._rng[o*this.colspan+s];e.cellType==CellType.RowHeader&&l++;let n=t-o,a=l-s;return r?new CellRange(n+r.row,a+r.col,n+r.row2,a+r.col2):null}_cellFits(e,t,l,o){if(o>0&&o+e.colspan>this.colspan)return!1;for(let s=0;s<e.colspan;s++)if(this._slotTaken(l,o+s,t))return!1;this.colspan=Math.max(this.colspan,o+e.colspan-1);return!0}_slotTaken(e,t,l=this._cells.length){for(let o=0;o<l;o++){let l=this._cells[o];if(e>=l.row&&e<=l.row+l.rowspan-1&&t>=l.col&&t<=l.col+l.colspan-1)return!0}return!1}}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 o=0,s=0;o<e.length;o++){let r=new _CellGroup(this,e[o]);r._rowstart=s;s+=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 o=l[t];if(e>=o._rowstart&&e<=o._rowstart+o._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}}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.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()}get columnsPerItem(){return this._layout._columnsPerItem}_getGroupByRow(e){let t=this._layout._getGroupByRow(e);assert(t instanceof _CellGroup,"Failed to get the group!");return t}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 o=this.rowHeaders.columns,s=this.rowHeaders.rows;for(let e=0;e<s.length;e++){let t=s[e],l=s[e].index,r=this._getGroupByRow(l);l-=r._rowstart;for(let e=o.length-2;e>=0;e--){let o="";for(let t=0;t<r.cells.length;t++){let s=r.cells[t];if(l>=s.row&&l<s.row+s.rowspan&&e>=s.col&&e<s.col+s.colspan){o=s.header;break}}this.rowHeaders.setCellData(t.index,e+1,o)}}o[0].visible=!1;for(let e=1;e<o.length;e++){o[e].align="left";o[e].visible=!0;o[e].width=this.columns.defaultSize}this.autoSizeColumns(0,o.length-1,!0);super.onLoadedRows(e)}_addBoundRow(e,t){let l=e[t];this.rows.push(new _MultiRow(l,t))}_getCollectionView(e){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=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return super._getCollectionView(e)}_rowInfoChanged(){this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout(()=>{let e=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;this.selection=e},Control._REFRESH_INTERVAL)}_formatItem(e,t){let l=this.columnsPerItem,o=t.panel,s=o.cellType,r=o.rows[t.range.row],n=(o.rows[t.range.row2],t.cell);s==CellType.RowHeader&&toggleClass(n,"wj-group-header",0==t.range.row);if(s==CellType.Cell||s==CellType.RowHeader){let e=this._getGroupByRow(t.row);toggleClass(n,"wj-group-start",e._rowstart==t.range.row);toggleClass(n,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(l>1&&(s==CellType.Cell||s==CellType.ColumnHeader)){toggleClass(n,"wj-record-start",t.range.col%l==0);toggleClass(n,"wj-record-end",t.range.col2%l==l-1)}let a=this.alternatingRowStep;if(a&&s==CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,l=Math.floor(r.dataIndex/e)*t,o=r.dataIndex%e;l+=this._layout._getGroupIndexByRow(o)+1;toggleClass(n,"wj-alt",l%(a+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,o)=>{let s=this._createKeys(e);if(this._supportsProxies()){let o=this._createProxy(e,l,s);t.push(o)}else{let o=this._createTransposedObject(e,l,s);t.push(o)}});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 o={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new Binding(e)),_keys:l};return new Proxy(o,{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,o=e._arr,s=t.length,r=l%s,n=Math.floor(l/s);return t[r].getValue(o[n])}return e[t]},set:(e,t,l)=>{let o=e._keys.indexOf(t);if(o>-1){let t=e._bnd,s=e._arr,r=t.length,n=o%r,a=Math.floor(o/r);t[n].setValue(s[a],l);if(s instanceof ObservableArray){let e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,s[a],a);s.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,l){let o={_arr:e,_rowInfo:t},s=t.bindings.map(e=>new Binding(e));for(let t=0;t<l.length;t++){let r=l[t];Object.defineProperty(o,r,{enumerable:!0,get:()=>{let l=s.length,o=t%l,r=Math.floor(t/l);return s[o].getValue(e[r])},set:l=>{let o=s.length,r=t%o,n=Math.floor(t/o);s[r].setValue(e[n],l);if(e instanceof ObservableArray){let t=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[n],n);e.onCollectionChanged(t)}return!0}})}return o}_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 o={bindings:[]};for(let t=0;t<e.colspan;t++)for(let s=0;s<e.cells.length;s++){let r=e.cells[s];if(l>=r.row&&l<r.row+r.rowspan&&t>=r.col&&t<r.col+r.colspan){o.bindings.push(r.binding);break}}t.push(o)}})}return t}}export class _CellFactory extends CellFactory{updateCell(e,t,l,o,s,r){if(e.cellType!=CellType.Cell){super.updateCell(e,t,l,o,s,r);return}let n=e.grid,a=n.rows[t],i=n.columns[l],h=a.dataType,c=a.format,u=a.dataMap,p=this.findCell(n,t,l);if(a){a.setDataType(getType(a.dataItem[i.binding]));if(p){a.setDataMap(p.dataMap);a.setFormat(p.format)}}try{super.updateCell(e,t,l,o,s,r)}finally{if(a){a.setDataType(h);if(p){u&&a.setDataMap(u);a.setFormat(c)}}}}findCell(e,t,l){let o=e._getGroupByRow(t),s=l%e.columnsPerItem;for(let e=0;e<o.cells.length;e++){let l=o.cells[e];if(o._rowstart+l._row==t&&s>=o._colstart+l.col&&s<o._colstart+l.col+l.colspan)return l}return null}}export class _MergeManager extends MergeManager{getMergedRange(e,t,l,o=!0){let s=e.grid;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:let o=l;e.cellType==CellType.RowHeader&&o--;let r=s._getGroupByRow(t);assert(r instanceof _CellGroup,"Failed to get the group!");let n=r.getMergedRange(e,t,o);assert(n&&n.contains(t,l),"Merged range must contain source cell");return n;case CellType.ColumnHeader:let a=s.columnsPerItem,i=l-l%a,h=Math.min(i+a-1,e.columns.length-1);return new CellRange(0,i,e.rows.length-1,h);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}_registerModule("wijmo.grid.transposedmultirow",selfModule);
import{copy,asInt,assert,isArray,toHeaderCase,addClass,asArray,toggleClass,tryCast,Binding,Control,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,getType,_registerModule}from"@grapecity/wijmo";import{Column,Row,CellType,CellRange,MergeManager,AllowDragging,AllowSorting,ColumnCollection,FlexGrid,CellFactory}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";export class _MultiRow extends Row{constructor(e,t){super(e);this._idxData=t;this._idxData}setDataType(e){this._type=e}setDataMap(e){this._map=e}setFormat(e){this._fmt=e}}export class _Cell extends Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;e&&copy(this,e)}get row(){return this._row}set row(e){this._row=asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")}}export class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;t&&copy(this,t);if(!this._cells)throw"Cell group with no cells?";let l=0,o=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,l,o);)0==(o=(o+1)%this.colspan)&&l++;e.row=l;e.col=o});let s=1,r=1;this._cells.forEach(e=>{s=Math.max(s,e.row+e.rowspan);r=Math.max(r,e.col+e.colspan)});this.rowspan=s;this.colspan=r}_copy(e,t){if("cells"==e){this._cells=[];isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._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 o=(e.row+t)*this.colspan+(e.col+l),s=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);this._rng[o]=s}});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 o=t-this._rowstart,s=l%this.colspan,r=this._rng[o*this.colspan+s];e.cellType==CellType.RowHeader&&l++;let n=t-o,a=l-s;return r?new CellRange(n+r.row,a+r.col,n+r.row2,a+r.col2):null}_cellFits(e,t,l,o){if(o>0&&o+e.colspan>this.colspan)return!1;for(let s=0;s<e.colspan;s++)if(this._slotTaken(l,o+s,t))return!1;this.colspan=Math.max(this.colspan,o+e.colspan-1);return!0}_slotTaken(e,t,l=this._cells.length){for(let o=0;o<l;o++){let l=this._cells[o];if(e>=l.row&&e<=l.row+l.rowspan-1&&t>=l.col&&t<=l.col+l.colspan-1)return!0}return!1}}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 o=0,s=0;o<e.length;o++){let r=new _CellGroup(this,e[o]);r._rowstart=s;s+=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 o=l[t];if(e>=o._rowstart&&e<=o._rowstart+o._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}}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.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()}get columnsPerItem(){return this._layout._columnsPerItem}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 o=this.rowHeaders.columns,s=this.rowHeaders.rows;for(let e=0;e<s.length;e++){let t=s[e],l=s[e].index,r=this._getGroupByRow(l);l-=r._rowstart;for(let e=o.length-2;e>=0;e--){let o="";for(let t=0;t<r.cells.length;t++){let s=r.cells[t];if(l>=s.row&&l<s.row+s.rowspan&&e>=s.col&&e<s.col+s.colspan){o=s.header;break}}this.rowHeaders.setCellData(t.index,e+1,o)}}o[0].visible=!1;for(let e=1;e<o.length;e++){o[e].align="left";o[e].visible=!0;o[e].width=this.columns.defaultSize}this.autoSizeColumns(0,o.length-1,!0);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))}_getCollectionView(e){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=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return super._getCollectionView(e)}_rowInfoChanged(){this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout(()=>{let e=this.selection,t=this.itemsSource;this.itemsSource=null;this.itemsSource=t;this.selection=e},Control._REFRESH_INTERVAL)}_formatItem(e,t){let l=this.columnsPerItem,o=t.panel,s=o.cellType,r=o.rows[t.range.row],n=(o.rows[t.range.row2],t.cell);s==CellType.RowHeader&&toggleClass(n,"wj-group-header",0==t.range.row);if(s==CellType.Cell||s==CellType.RowHeader){let e=this._getGroupByRow(t.row);toggleClass(n,"wj-group-start",e._rowstart==t.range.row);toggleClass(n,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(l>1&&(s==CellType.Cell||s==CellType.ColumnHeader)){toggleClass(n,"wj-record-start",t.range.col%l==0);toggleClass(n,"wj-record-end",t.range.col2%l==l-1)}let a=this.alternatingRowStep;if(a&&s==CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,l=Math.floor(r.dataIndex/e)*t,o=r.dataIndex%e;l+=this._layout._getGroupIndexByRow(o)+1;toggleClass(n,"wj-alt",l%(a+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,o)=>{let s=this._createKeys(e);if(this._supportsProxies()){let o=this._createProxy(e,l,s);t.push(o)}else{let o=this._createTransposedObject(e,l,s);t.push(o)}});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 o={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new Binding(e)),_keys:l};return new Proxy(o,{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,o=e._arr,s=t.length,r=l%s,n=Math.floor(l/s);return t[r].getValue(o[n])}return e[t]},set:(e,t,l)=>{let o=e._keys.indexOf(t);if(o>-1){let t=e._bnd,s=e._arr,r=t.length,n=o%r,a=Math.floor(o/r);t[n].setValue(s[a],l);if(s instanceof ObservableArray){let e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,s[a],a);s.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,l){let o={_arr:e,_rowInfo:t},s=t.bindings.map(e=>new Binding(e));for(let t=0;t<l.length;t++){let r=l[t];Object.defineProperty(o,r,{enumerable:!0,get:()=>{let l=s.length,o=t%l,r=Math.floor(t/l);return s[o].getValue(e[r])},set:l=>{let o=s.length,r=t%o,n=Math.floor(t/o);s[r].setValue(e[n],l);if(e instanceof ObservableArray){let t=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[n],n);e.onCollectionChanged(t)}return!0}})}return o}_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 o={bindings:[]};for(let t=0;t<e.colspan;t++)for(let s=0;s<e.cells.length;s++){let r=e.cells[s];if(l>=r.row&&l<r.row+r.rowspan&&t>=r.col&&t<r.col+r.colspan){o.bindings.push(r.binding);break}}t.push(o)}})}return t}}export class _CellFactory extends CellFactory{updateCell(e,t,l,o,s,r){if(e.cellType!=CellType.Cell){super.updateCell(e,t,l,o,s,r);return}let n=e.grid,a=n.rows[t],i=n.columns[l],h=a.dataType,c=a.format,u=a.dataMap,p=this.findCell(n,t,l);if(a){a.setDataType(getType(a.dataItem[i.binding]));if(p){a.setDataMap(p.dataMap);a.setFormat(p.format)}}try{super.updateCell(e,t,l,o,s,r)}finally{if(a){a.setDataType(h);if(p){u&&a.setDataMap(u);a.setFormat(c)}}}}findCell(e,t,l){let o=e._getGroupByRow(t),s=l%e.columnsPerItem;for(let e=0;e<o.cells.length;e++){let l=o.cells[e];if(o._rowstart+l._row==t&&s>=o._colstart+l.col&&s<o._colstart+l.col+l.colspan)return l}return null}}export class _MergeManager extends MergeManager{getMergedRange(e,t,l,o=!0){let s=e.grid;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:let o=l;e.cellType==CellType.RowHeader&&o--;let r=s._getGroupByRow(t);assert(r instanceof _CellGroup,"Failed to get the group!");let n=r.getMergedRange(e,t,o);assert(n&&n.contains(t,l),"Merged range must contain source cell");return n;case CellType.ColumnHeader:let a=s.columnsPerItem,i=l-l%a,h=Math.min(i+a-1,e.columns.length-1);return new CellRange(0,i,e.rows.length-1,h);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}_registerModule("wijmo.grid.transposedmultirow",selfModule);
/*!
*
* Wijmo Library 5.20201.681-nightly.d20200616.t020140
* Wijmo Library 5.20201.681-nightly.d20200617.t020400
* http://wijmo.com/

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

var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{copy,asInt,assert,isArray,toHeaderCase,addClass,asArray,toggleClass,tryCast,Binding,Control,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,getType,_registerModule}from"@grapecity/wijmo";import{Column,Row,CellType,CellRange,MergeManager,AllowDragging,AllowSorting,ColumnCollection,FlexGrid,CellFactory}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o){var r=e.call(this,t)||this;r._idxData=o;r._idxData;return r}_MultiRow.prototype.setDataType=function(e){this._type=e};_MultiRow.prototype.setDataMap=function(e){this._map=e};_MultiRow.prototype.setFormat=function(e){this._fmt=e};return _MultiRow}(Row);export{_MultiRow};var _Cell=function(e){__extends(_Cell,e);function _Cell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;t&&copy(o,t);return o}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(e){this._row=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(e){this._col=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(Column);export{_Cell};var _CellGroup=function(e){__extends(_CellGroup,e);function _CellGroup(t,o){var r=e.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=t;o&&copy(r,o);if(!r._cells)throw"Cell group with no cells?";var n=0,l=0;r._cells.forEach((function(e,t){for(;!r._cellFits(e,t,n,l);)0==(l=(l+1)%r.colspan)&&n++;e.row=n;e.col=l}));var a=1,s=1;r._cells.forEach((function(e){a=Math.max(a,e.row+e.rowspan);s=Math.max(s,e.col+e.colspan)}));r.rowspan=a;r.colspan=s;return r}_CellGroup.prototype._copy=function(e,t){var o=this;if("cells"==e){this._cells=[];isArray(t)&&t.forEach((function(e){var t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));o._cells.push(t);o.colspan=Math.max(o.colspan,t.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(e){var t=this;if(e>this.colspan){this._cells.forEach((function(o){o.col==t.colspan-1&&(o.colspan=e-o.col)}));this.colspan=e}this._cells.forEach((function(e){for(;e.col+e.colspan<t.colspan&&!t._slotTaken(e.row,e.col+e.colspan);)e.colspan++}));this._cells.forEach((function(e){for(;e.row+e.rowspan<t.rowspan&&!t._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++}));for(var o=0;o<this.rowspan;o++)for(var r=0;r<this.colspan;r++)assert(this._slotTaken(o,r),"Invalid layout (empty cells).");this._rng=new Array(e*this.rowspan);this._cells.forEach((function(e){for(var o=0;o<e.rowspan;o++)for(var r=0;r<e.colspan;r++){var n=(e.row+o)*t.colspan+(e.col+r),l=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);t._rng[n]=l}}));this._rng[-1]=new CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(e,t,o){if(o<0)return this._rng[-1];var r=t-this._rowstart,n=o%this.colspan,l=this._rng[r*this.colspan+n];e.cellType==CellType.RowHeader&&o++;var a=t-r,s=o-n;return l?new CellRange(a+l.row,s+l.col,a+l.row2,s+l.col2):null};_CellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e.colspan>this.colspan)return!1;for(var n=0;n<e.colspan;n++)if(this._slotTaken(o,r+n,t))return!1;this.colspan=Math.max(this.colspan,r+e.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var n=this._cells[r];if(e>=n.row&&e<=n.row+n.rowspan-1&&t>=n.col&&t<=n.col+n.colspan-1)return!0}return!1};return _CellGroup}(_Cell);export{_CellGroup};var _MultiRowLayout=function(){function _MultiRowLayout(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var e=this._bindingGroups;if(e&&e.length){var t=e[e.length-1];return t._rowstart+t.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(e){var t=[],o=1;if(e){for(var r=0,n=0;r<e.length;r++){var l=new _CellGroup(this,e[r]);l._rowstart=n;n+=l._rowspan;o=Math.max(o,l._colspan);t.push(l)}t.forEach((function(e){e.closeGroup(o)}));this._columnsPerItem=o}return t};_MultiRowLayout.prototype._getGroupByRow=function(e){var t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(e){var t=this._groupsByRow[e];if(t)return t;for(var o=this._bindingGroups,r=0;r<o.length;r++){var n=o[r];if(e>=n._rowstart&&e<=n._rowstart+n._rowspan-1){this._groupsByRow[e]=r;return r}}return-1};return _MultiRowLayout}();export{_MultiRowLayout};var TransposedMultiRow=function(e){__extends(TransposedMultiRow,e);function TransposedMultiRow(t,o){var r=e.call(this,t)||this;r._keyPrefix="item";addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=AllowDragging.None;r.allowSorting=AllowSorting.None;r.mergeManager=new _MergeManager(r);r.cellFactory=new _CellFactory;r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new ColumnCollection(r,r.columns.defaultSize);r.initialize(o);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){this._layoutDef=asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});TransposedMultiRow.prototype._getGroupByRow=function(e){var t=this._layout._getGroupByRow(e);assert(t instanceof _CellGroup,"Failed to get the group!");return t};TransposedMultiRow.prototype.refresh=function(t){var o=this._rowInfo;if(o._dirty){o._dirty=!1;this._rowInfoChanged()}else e.prototype.refresh.call(this,t)};TransposedMultiRow.prototype.onLoadedRows=function(t){for(var o=this.columnHeaders.columns,r=0;r<o.length;r++)this.columnHeaders.setCellData(0,r,"");var n=this.columns;for(r=0;r<n.length;r++){var l=n[r];l.align=null;l.dataType=0}var a=this.rowHeaders.columns,s=this.rowHeaders.rows;for(r=0;r<s.length;r++){var i=s[r],u=s[r].index,c=this._getGroupByRow(u);u-=c._rowstart;for(var p=a.length-2;p>=0;p--){for(var _="",h=0;h<c.cells.length;h++){var f=c.cells[h];if(u>=f.row&&u<f.row+f.rowspan&&p>=f.col&&p<f.col+f.colspan){_=f.header;break}}this.rowHeaders.setCellData(i.index,p+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}this.autoSizeColumns(0,a.length-1,!0);e.prototype.onLoadedRows.call(this,t)};TransposedMultiRow.prototype._addBoundRow=function(e,t){var o=e[t];this.rows.push(new _MultiRow(o,t))};TransposedMultiRow.prototype._getCollectionView=function(t){null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(isArray(t))t=this._transposeItemsSource(t);else if(t){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=tryCast(t,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);t=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return e.prototype._getCollectionView.call(this,t)};TransposedMultiRow.prototype._rowInfoChanged=function(){var e=this;this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout((function(){var t=e.selection,o=e.itemsSource;e.itemsSource=null;e.itemsSource=o;e.selection=t}),Control._REFRESH_INTERVAL)};TransposedMultiRow.prototype._formatItem=function(e,t){var o=this.columnsPerItem,r=t.panel,n=r.cellType,l=r.rows[t.range.row],a=(r.rows[t.range.row2],t.cell);n==CellType.RowHeader&&toggleClass(a,"wj-group-header",0==t.range.row);if(n==CellType.Cell||n==CellType.RowHeader){var s=this._getGroupByRow(t.row);toggleClass(a,"wj-group-start",s._rowstart==t.range.row);toggleClass(a,"wj-group-end",s._rowstart+s._rowspan-1==t.range.row2)}if(o>1&&(n==CellType.Cell||n==CellType.ColumnHeader)){toggleClass(a,"wj-record-start",t.range.col%o==0);toggleClass(a,"wj-record-end",t.range.col2%o==o-1)}var i=this.alternatingRowStep;if(i&&n==CellType.Cell){var u=this._layout.totalRowSpan,c=this._layout._bindingGroups.length,p=Math.floor(l.dataIndex/u)*c,_=l.dataIndex%u;p+=this._layout._getGroupIndexByRow(_)+1;toggleClass(a,"wj-alt",p%(i+1)==0)}};TransposedMultiRow.prototype._sourceViewChanged=function(e,t){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(e){var t=this,o=new ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((function(r,n){var l=t._createKeys(e);if(t._supportsProxies()){var a=t._createProxy(e,r,l);o.push(a)}else{var s=t._createTransposedObject(e,r,l);o.push(s)}}));e instanceof ObservableArray&&e.collectionChanged.addHandler((function(){var e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);o.onCollectionChanged(e);t._rowInfoChanged()}))}return o};TransposedMultiRow.prototype._createKeys=function(e){var t=this,o=Array.apply(null,{length:this.columnsPerItem}),r=e.map((function(e,r){return o.map((function(e,o){return t._keyPrefix+r+"_"+o}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(e,t,o){var r={_arr:e,_rowInfo:t,_bnd:t.bindings.map((function(e){return new Binding(e)})),_keys:o};return new Proxy(r,{ownKeys:function(e){return e._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(e,t){var o=e._keys.indexOf(t);if(o>-1){var r=e._bnd,n=e._arr,l=r.length,a=o%l,s=Math.floor(o/l);return r[a].getValue(n[s])}return e[t]},set:function(e,t,o){var r=e._keys.indexOf(t);if(r>-1){var n=e._bnd,l=e._arr,a=n.length,s=r%a,i=Math.floor(r/a);n[s].setValue(l[i],o);if(l instanceof ObservableArray){var u=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,l[i],i);l.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(e,t,o){for(var r={_arr:e,_rowInfo:t},n=t.bindings.map((function(e){return new Binding(e)})),_loop_1=function(t){var l=o[t];Object.defineProperty(r,l,{enumerable:!0,get:function(){var o=n.length,r=t%o,l=Math.floor(t/o);return n[r].getValue(e[l])},set:function(o){var r=n.length,l=t%r,a=Math.floor(t/r);n[l].setValue(e[a],o);if(e instanceof ObservableArray){var s=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[a],a);e.onCollectionChanged(s)}return!0}})},l=0;l<o.length;l++)_loop_1(l);return r};TransposedMultiRow.prototype._getRowInfo=function(e){var t=[];if(this._layout){for(var o=this.rowHeaders.columns,r=this.columnsPerItem+1;o.length>r;)o.removeAt(o.length-1);for(;o.length<r;)o.push(new Column);this._layout._bindingGroups.forEach((function(e){for(var o=0;o<e.rowspan;o++){for(var r={bindings:[]},n=0;n<e.colspan;n++)for(var l=0;l<e.cells.length;l++){var a=e.cells[l];if(o>=a.row&&o<a.row+a.rowspan&&n>=a.col&&n<a.col+a.colspan){r.bindings.push(a.binding);break}}t.push(r)}}))}return t};return TransposedMultiRow}(FlexGrid);export{TransposedMultiRow};var _CellFactory=function(e){__extends(_CellFactory,e);function _CellFactory(){return null!==e&&e.apply(this,arguments)||this}_CellFactory.prototype.updateCell=function(t,o,r,n,l,a){if(t.cellType==CellType.Cell){var s=t.grid,i=s.rows[o],u=s.columns[r],c=i.dataType,p=i.format,_=i.dataMap,h=this.findCell(s,o,r);if(i){i.setDataType(getType(i.dataItem[u.binding]));if(h){i.setDataMap(h.dataMap);i.setFormat(h.format)}}try{e.prototype.updateCell.call(this,t,o,r,n,l,a)}finally{if(i){i.setDataType(c);if(h){_&&i.setDataMap(_);i.setFormat(p)}}}}else e.prototype.updateCell.call(this,t,o,r,n,l,a)};_CellFactory.prototype.findCell=function(e,t,o){for(var r=e._getGroupByRow(t),n=o%e.columnsPerItem,l=0;l<r.cells.length;l++){var a=r.cells[l];if(r._rowstart+a._row==t&&n>=r._colstart+a.col&&n<r._colstart+a.col+a.colspan)return a}return null};return _CellFactory}(CellFactory);export{_CellFactory};var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var n=e.grid;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:var l=o;e.cellType==CellType.RowHeader&&l--;var a=n._getGroupByRow(t);assert(a instanceof _CellGroup,"Failed to get the group!");var s=a.getMergedRange(e,t,l);assert(s&&s.contains(t,o),"Merged range must contain source cell");return s;case CellType.ColumnHeader:var i=n.columnsPerItem,u=o-o%i,c=Math.min(u+i-1,e.columns.length-1);return new CellRange(0,u,e.rows.length-1,c);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null};return _MergeManager}(MergeManager);export{_MergeManager};_registerModule("wijmo.grid.transposedmultirow",selfModule);
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{copy,asInt,assert,isArray,toHeaderCase,addClass,asArray,toggleClass,tryCast,Binding,Control,ObservableArray,NotifyCollectionChangedEventArgs,NotifyCollectionChangedAction,getType,_registerModule}from"@grapecity/wijmo";import{Column,Row,CellType,CellRange,MergeManager,AllowDragging,AllowSorting,ColumnCollection,FlexGrid,CellFactory}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.transposedmultirow";var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o){var r=e.call(this,t)||this;r._idxData=o;r._idxData;return r}_MultiRow.prototype.setDataType=function(e){this._type=e};_MultiRow.prototype.setDataMap=function(e){this._map=e};_MultiRow.prototype.setFormat=function(e){this._fmt=e};return _MultiRow}(Row);export{_MultiRow};var _Cell=function(e){__extends(_Cell,e);function _Cell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;t&&copy(o,t);return o}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(e){this._row=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(e){this._col=asInt(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){this._colspan=asInt(e,!1,!0);assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){this._rowspan=asInt(e,!1,!0);assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(Column);export{_Cell};var _CellGroup=function(e){__extends(_CellGroup,e);function _CellGroup(t,o){var r=e.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=t;o&&copy(r,o);if(!r._cells)throw"Cell group with no cells?";var n=0,l=0;r._cells.forEach((function(e,t){for(;!r._cellFits(e,t,n,l);)0==(l=(l+1)%r.colspan)&&n++;e.row=n;e.col=l}));var a=1,s=1;r._cells.forEach((function(e){a=Math.max(a,e.row+e.rowspan);s=Math.max(s,e.col+e.colspan)}));r.rowspan=a;r.colspan=s;return r}_CellGroup.prototype._copy=function(e,t){var o=this;if("cells"==e){this._cells=[];isArray(t)&&t.forEach((function(e){var t=new _Cell(e);t.binding&&!t.header&&(t.header=toHeaderCase(t.binding));o._cells.push(t);o.colspan=Math.max(o.colspan,t.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(e){var t=this;if(e>this.colspan){this._cells.forEach((function(o){o.col==t.colspan-1&&(o.colspan=e-o.col)}));this.colspan=e}this._cells.forEach((function(e){for(;e.col+e.colspan<t.colspan&&!t._slotTaken(e.row,e.col+e.colspan);)e.colspan++}));this._cells.forEach((function(e){for(;e.row+e.rowspan<t.rowspan&&!t._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++}));for(var o=0;o<this.rowspan;o++)for(var r=0;r<this.colspan;r++)assert(this._slotTaken(o,r),"Invalid layout (empty cells).");this._rng=new Array(e*this.rowspan);this._cells.forEach((function(e){for(var o=0;o<e.rowspan;o++)for(var r=0;r<e.colspan;r++){var n=(e.row+o)*t.colspan+(e.col+r),l=new CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);t._rng[n]=l}}));this._rng[-1]=new CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(e,t,o){if(o<0)return this._rng[-1];var r=t-this._rowstart,n=o%this.colspan,l=this._rng[r*this.colspan+n];e.cellType==CellType.RowHeader&&o++;var a=t-r,s=o-n;return l?new CellRange(a+l.row,s+l.col,a+l.row2,s+l.col2):null};_CellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e.colspan>this.colspan)return!1;for(var n=0;n<e.colspan;n++)if(this._slotTaken(o,r+n,t))return!1;this.colspan=Math.max(this.colspan,r+e.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var n=this._cells[r];if(e>=n.row&&e<=n.row+n.rowspan-1&&t>=n.col&&t<=n.col+n.colspan-1)return!0}return!1};return _CellGroup}(_Cell);export{_CellGroup};var _MultiRowLayout=function(){function _MultiRowLayout(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var e=this._bindingGroups;if(e&&e.length){var t=e[e.length-1];return t._rowstart+t.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(e){var t=[],o=1;if(e){for(var r=0,n=0;r<e.length;r++){var l=new _CellGroup(this,e[r]);l._rowstart=n;n+=l._rowspan;o=Math.max(o,l._colspan);t.push(l)}t.forEach((function(e){e.closeGroup(o)}));this._columnsPerItem=o}return t};_MultiRowLayout.prototype._getGroupByRow=function(e){var t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(e){var t=this._groupsByRow[e];if(t)return t;for(var o=this._bindingGroups,r=0;r<o.length;r++){var n=o[r];if(e>=n._rowstart&&e<=n._rowstart+n._rowspan-1){this._groupsByRow[e]=r;return r}}return-1};return _MultiRowLayout}();export{_MultiRowLayout};var TransposedMultiRow=function(e){__extends(TransposedMultiRow,e);function TransposedMultiRow(t,o){var r=e.call(this,t)||this;r._keyPrefix="item";addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=AllowDragging.None;r.allowSorting=AllowSorting.None;r.mergeManager=new _MergeManager(r);r.cellFactory=new _CellFactory;r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new ColumnCollection(r,r.columns.defaultSize);r.initialize(o);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){this._layoutDef=asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.refresh=function(t){var o=this._rowInfo;if(o._dirty){o._dirty=!1;this._rowInfoChanged()}else e.prototype.refresh.call(this,t)};TransposedMultiRow.prototype.onLoadedRows=function(t){for(var o=this.columnHeaders.columns,r=0;r<o.length;r++)this.columnHeaders.setCellData(0,r,"");var n=this.columns;for(r=0;r<n.length;r++){var l=n[r];l.align=null;l.dataType=0}var a=this.rowHeaders.columns,s=this.rowHeaders.rows;for(r=0;r<s.length;r++){var i=s[r],u=s[r].index,c=this._getGroupByRow(u);u-=c._rowstart;for(var p=a.length-2;p>=0;p--){for(var _="",h=0;h<c.cells.length;h++){var f=c.cells[h];if(u>=f.row&&u<f.row+f.rowspan&&p>=f.col&&p<f.col+f.colspan){_=f.header;break}}this.rowHeaders.setCellData(i.index,p+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}this.autoSizeColumns(0,a.length-1,!0);e.prototype.onLoadedRows.call(this,t)};TransposedMultiRow.prototype._getGroupByRow=function(e){var t=this._layout._getGroupByRow(e);assert(t instanceof _CellGroup,"Failed to get the group!");return t};TransposedMultiRow.prototype._addBoundRow=function(e,t){var o=e[t];this.rows.push(new _MultiRow(o,t))};TransposedMultiRow.prototype._getCollectionView=function(t){null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(isArray(t))t=this._transposeItemsSource(t);else if(t){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=tryCast(t,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);t=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return e.prototype._getCollectionView.call(this,t)};TransposedMultiRow.prototype._rowInfoChanged=function(){var e=this;this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout((function(){var t=e.selection,o=e.itemsSource;e.itemsSource=null;e.itemsSource=o;e.selection=t}),Control._REFRESH_INTERVAL)};TransposedMultiRow.prototype._formatItem=function(e,t){var o=this.columnsPerItem,r=t.panel,n=r.cellType,l=r.rows[t.range.row],a=(r.rows[t.range.row2],t.cell);n==CellType.RowHeader&&toggleClass(a,"wj-group-header",0==t.range.row);if(n==CellType.Cell||n==CellType.RowHeader){var s=this._getGroupByRow(t.row);toggleClass(a,"wj-group-start",s._rowstart==t.range.row);toggleClass(a,"wj-group-end",s._rowstart+s._rowspan-1==t.range.row2)}if(o>1&&(n==CellType.Cell||n==CellType.ColumnHeader)){toggleClass(a,"wj-record-start",t.range.col%o==0);toggleClass(a,"wj-record-end",t.range.col2%o==o-1)}var i=this.alternatingRowStep;if(i&&n==CellType.Cell){var u=this._layout.totalRowSpan,c=this._layout._bindingGroups.length,p=Math.floor(l.dataIndex/u)*c,_=l.dataIndex%u;p+=this._layout._getGroupIndexByRow(_)+1;toggleClass(a,"wj-alt",p%(i+1)==0)}};TransposedMultiRow.prototype._sourceViewChanged=function(e,t){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(e){var t=this,o=new ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(e).forEach((function(r,n){var l=t._createKeys(e);if(t._supportsProxies()){var a=t._createProxy(e,r,l);o.push(a)}else{var s=t._createTransposedObject(e,r,l);o.push(s)}}));e instanceof ObservableArray&&e.collectionChanged.addHandler((function(){var e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);o.onCollectionChanged(e);t._rowInfoChanged()}))}return o};TransposedMultiRow.prototype._createKeys=function(e){var t=this,o=Array.apply(null,{length:this.columnsPerItem}),r=e.map((function(e,r){return o.map((function(e,o){return t._keyPrefix+r+"_"+o}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(e,t,o){var r={_arr:e,_rowInfo:t,_bnd:t.bindings.map((function(e){return new Binding(e)})),_keys:o};return new Proxy(r,{ownKeys:function(e){return e._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(e,t){var o=e._keys.indexOf(t);if(o>-1){var r=e._bnd,n=e._arr,l=r.length,a=o%l,s=Math.floor(o/l);return r[a].getValue(n[s])}return e[t]},set:function(e,t,o){var r=e._keys.indexOf(t);if(r>-1){var n=e._bnd,l=e._arr,a=n.length,s=r%a,i=Math.floor(r/a);n[s].setValue(l[i],o);if(l instanceof ObservableArray){var u=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,l[i],i);l.onCollectionChanged(u)}return!0}return!1}})};TransposedMultiRow.prototype._createTransposedObject=function(e,t,o){for(var r={_arr:e,_rowInfo:t},n=t.bindings.map((function(e){return new Binding(e)})),_loop_1=function(t){var l=o[t];Object.defineProperty(r,l,{enumerable:!0,get:function(){var o=n.length,r=t%o,l=Math.floor(t/o);return n[r].getValue(e[l])},set:function(o){var r=n.length,l=t%r,a=Math.floor(t/r);n[l].setValue(e[a],o);if(e instanceof ObservableArray){var s=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,e[a],a);e.onCollectionChanged(s)}return!0}})},l=0;l<o.length;l++)_loop_1(l);return r};TransposedMultiRow.prototype._getRowInfo=function(e){var t=[];if(this._layout){for(var o=this.rowHeaders.columns,r=this.columnsPerItem+1;o.length>r;)o.removeAt(o.length-1);for(;o.length<r;)o.push(new Column);this._layout._bindingGroups.forEach((function(e){for(var o=0;o<e.rowspan;o++){for(var r={bindings:[]},n=0;n<e.colspan;n++)for(var l=0;l<e.cells.length;l++){var a=e.cells[l];if(o>=a.row&&o<a.row+a.rowspan&&n>=a.col&&n<a.col+a.colspan){r.bindings.push(a.binding);break}}t.push(r)}}))}return t};return TransposedMultiRow}(FlexGrid);export{TransposedMultiRow};var _CellFactory=function(e){__extends(_CellFactory,e);function _CellFactory(){return null!==e&&e.apply(this,arguments)||this}_CellFactory.prototype.updateCell=function(t,o,r,n,l,a){if(t.cellType==CellType.Cell){var s=t.grid,i=s.rows[o],u=s.columns[r],c=i.dataType,p=i.format,_=i.dataMap,h=this.findCell(s,o,r);if(i){i.setDataType(getType(i.dataItem[u.binding]));if(h){i.setDataMap(h.dataMap);i.setFormat(h.format)}}try{e.prototype.updateCell.call(this,t,o,r,n,l,a)}finally{if(i){i.setDataType(c);if(h){_&&i.setDataMap(_);i.setFormat(p)}}}}else e.prototype.updateCell.call(this,t,o,r,n,l,a)};_CellFactory.prototype.findCell=function(e,t,o){for(var r=e._getGroupByRow(t),n=o%e.columnsPerItem,l=0;l<r.cells.length;l++){var a=r.cells[l];if(r._rowstart+a._row==t&&n>=r._colstart+a.col&&n<r._colstart+a.col+a.colspan)return a}return null};return _CellFactory}(CellFactory);export{_CellFactory};var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var n=e.grid;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:var l=o;e.cellType==CellType.RowHeader&&l--;var a=n._getGroupByRow(t);assert(a instanceof _CellGroup,"Failed to get the group!");var s=a.getMergedRange(e,t,l);assert(s&&s.contains(t,o),"Merged range must contain source cell");return s;case CellType.ColumnHeader:var i=n.columnsPerItem,u=o-o%i,c=Math.min(u+i-1,e.columns.length-1);return new CellRange(0,u,e.rows.length-1,c);case CellType.TopLeft:return new CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null};return _MergeManager}(MergeManager);export{_MergeManager};_registerModule("wijmo.grid.transposedmultirow",selfModule);
/*!
*
* Wijmo Library 5.20201.681-nightly.d20200616.t020140
* Wijmo Library 5.20201.681-nightly.d20200617.t020400
* http://wijmo.com/

@@ -119,3 +119,6 @@ *

* layout, where columns represent data items and rows represent item
* properties.
* properties. Also this control allows to display each item in multiple columns.
*
* Use the {@link layoutDefinition} property to define the layout of the
* rows used to display each data item.
*/

@@ -136,7 +139,38 @@ export declare class TransposedMultiRow extends FlexGrid {

constructor(element: any, options?: any);
/**
* Gets or sets an array that defines the layout of each data item.
*
* The array contains a list of cell group objects which have the following properties:
*
* <ul>
* <li><b>header</b>: Group header (shown when the headers are collapsed).</li>
* <li><b>colspan</b>: Number of grid columns spanned by the group.</li>
* <li><b>cells</b>: Array of cell objects, which extend {@link Column} with a
* <b>colspan</b> property.</li>
* </ul>
*
* When the {@link layoutDefinition} property is set, the grid scans the cells in each
* group as follows:
*
* <ol>
* <li>The grid calculates the <b>colspan</b> of the group either as group's own <b>colspan</b>
* or as span of the widest cell in the group, whichever is wider.</li>
* <li>If the cell fits the current row within the group, it is added to the current row.</li>
* <li>If it doesn't fit, it is added to a new row.</li>
* </ol>
*
* When all groups are ready, the grid calculates the number of columns per record to the maximum
* <b>colspan</b> of all groups, and adds columns to each group to pad their width as needed.
*/
layoutDefinition: any[];
/**
* Gets the number of columns used to display each item.
*
* This value is calculated automatically based on the value
* of the <b>layoutDefinition</b> property.
*/
readonly columnsPerItem: number;
_getGroupByRow(r: number): _CellGroup;
refresh(fullUpdate?: boolean): void;
onLoadedRows(e?: EventArgs): void;
_getGroupByRow(r: number): _CellGroup;
_addBoundRow(items: any[], index: number): void;

@@ -149,8 +183,5 @@ protected _getCollectionView(value: any): ICollectionView;

private _createKeys;
_supportsProxies(): boolean;
private _supportsProxies;
private _createProxy;
_createTransposedObject(arr: any[], rowInfo: any, props: string[]): {
_arr: any[];
_rowInfo: any;
};
private _createTransposedObject;
private _getRowInfo;

@@ -157,0 +188,0 @@ }

/*!
*
* Wijmo Library 5.20201.681-nightly.d20200616.t020140
* Wijmo Library 5.20201.681-nightly.d20200617.t020400
* http://wijmo.com/

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

"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(o,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,e){o.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])})(o,e)};return function(o,e){extendStatics(o,e);function __(){this.constructor=o}o.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=require("@grapecity/wijmo.grid.transposedmultirow"),_MultiRow=function(o){__extends(_MultiRow,o);function _MultiRow(e,t){var r=o.call(this,e)||this;r._idxData=t;r._idxData;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};return _MultiRow}(wijmo_grid_1.Row);exports._MultiRow=_MultiRow;var _Cell=function(o){__extends(_Cell,o);function _Cell(e){var t=o.call(this)||this;t._row=t._col=0;t._rowspan=t._colspan=1;e&&wijmo_1.copy(t,e);return t}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(o){this._row=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(o){this._col=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(o){this._colspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(o){this._rowspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(wijmo_grid_1.Column);exports._Cell=_Cell;var _CellGroup=function(o){__extends(_CellGroup,o);function _CellGroup(e,t){var r=o.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=e;t&&wijmo_1.copy(r,t);if(!r._cells)throw"Cell group with no cells?";var n=0,i=0;r._cells.forEach((function(o,e){for(;!r._cellFits(o,e,n,i);)0==(i=(i+1)%r.colspan)&&n++;o.row=n;o.col=i}));var l=1,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,e){var t=this;if("cells"==o){this._cells=[];wijmo_1.isArray(e)&&e.forEach((function(o){var e=new _Cell(o);e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding));t._cells.push(e);t.colspan=Math.max(t.colspan,e.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(o){var e=this;if(o>this.colspan){this._cells.forEach((function(t){t.col==e.colspan-1&&(t.colspan=o-t.col)}));this.colspan=o}this._cells.forEach((function(o){for(;o.col+o.colspan<e.colspan&&!e._slotTaken(o.row,o.col+o.colspan);)o.colspan++}));this._cells.forEach((function(o){for(;o.row+o.rowspan<e.rowspan&&!e._slotTaken(o.row+o.rowspan,o.col);)o.rowspan++}));for(var t=0;t<this.rowspan;t++)for(var r=0;r<this.colspan;r++)wijmo_1.assert(this._slotTaken(t,r),"Invalid layout (empty cells).");this._rng=new Array(o*this.rowspan);this._cells.forEach((function(o){for(var t=0;t<o.rowspan;t++)for(var r=0;r<o.colspan;r++){var n=(o.row+t)*e.colspan+(o.col+r),i=new wijmo_grid_1.CellRange(o.row,o.col,o.row+o.rowspan-1,o.col+o.colspan-1);e._rng[n]=i}}));this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(o,e,t){if(t<0)return this._rng[-1];var r=e-this._rowstart,n=t%this.colspan,i=this._rng[r*this.colspan+n];o.cellType==wijmo_grid_1.CellType.RowHeader&&t++;var l=e-r,a=t-n;return i?new wijmo_grid_1.CellRange(l+i.row,a+i.col,l+i.row2,a+i.col2):null};_CellGroup.prototype._cellFits=function(o,e,t,r){if(r>0&&r+o.colspan>this.colspan)return!1;for(var n=0;n<o.colspan;n++)if(this._slotTaken(t,r+n,e))return!1;this.colspan=Math.max(this.colspan,r+o.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(o,e,t){void 0===t&&(t=this._cells.length);for(var r=0;r<t;r++){var n=this._cells[r];if(o>=n.row&&o<=n.row+n.rowspan-1&&e>=n.col&&e<=n.col+n.colspan-1)return!0}return!1};return _CellGroup}(_Cell);exports._CellGroup=_CellGroup;var _MultiRowLayout=function(){function _MultiRowLayout(o,e){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=o;this._bindingGroups=this._parseCellGroups(e)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var o=this._bindingGroups;if(o&&o.length){var e=o[o.length-1];return e._rowstart+e.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(o){var e=[],t=1;if(o){for(var r=0,n=0;r<o.length;r++){var i=new _CellGroup(this,o[r]);i._rowstart=n;n+=i._rowspan;t=Math.max(t,i._colspan);e.push(i)}e.forEach((function(o){o.closeGroup(t)}));this._columnsPerItem=t}return e};_MultiRowLayout.prototype._getGroupByRow=function(o){var e=this._getGroupIndexByRow(o);return e>-1?this._bindingGroups[e]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(o){var e=this._groupsByRow[o];if(e)return e;for(var t=this._bindingGroups,r=0;r<t.length;r++){var n=t[r];if(o>=n._rowstart&&o<=n._rowstart+n._rowspan-1){this._groupsByRow[o]=r;return r}}return-1};return _MultiRowLayout}();exports._MultiRowLayout=_MultiRowLayout;var TransposedMultiRow=function(o){__extends(TransposedMultiRow,o);function TransposedMultiRow(e,t){var r=o.call(this,e)||this;r._keyPrefix="item";wijmo_1.addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=wijmo_grid_1.AllowDragging.None;r.allowSorting=wijmo_grid_1.AllowSorting.None;r.mergeManager=new _MergeManager(r);r.cellFactory=new _CellFactory;r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new wijmo_grid_1.ColumnCollection(r,r.columns.defaultSize);r.initialize(t);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(o){this._layoutDef=wijmo_1.asArray(o);this._layout=new _MultiRowLayout(this,o);this._rowInfoChanged()},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});TransposedMultiRow.prototype._getGroupByRow=function(o){var e=this._layout._getGroupByRow(o);wijmo_1.assert(e instanceof _CellGroup,"Failed to get the group!");return e};TransposedMultiRow.prototype.refresh=function(e){var t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else o.prototype.refresh.call(this,e)};TransposedMultiRow.prototype.onLoadedRows=function(e){for(var t=this.columnHeaders.columns,r=0;r<t.length;r++)this.columnHeaders.setCellData(0,r,"");var n=this.columns;for(r=0;r<n.length;r++){var i=n[r];i.align=null;i.dataType=0}var l=this.rowHeaders.columns,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 c=l.length-2;c>=0;c--){for(var p="",w=0;w<_.cells.length;w++){var h=_.cells[w];if(u>=h.row&&u<h.row+h.rowspan&&c>=h.col&&c<h.col+h.colspan){p=h.header;break}}this.rowHeaders.setCellData(s.index,c+1,p)}}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}this.autoSizeColumns(0,l.length-1,!0);o.prototype.onLoadedRows.call(this,e)};TransposedMultiRow.prototype._addBoundRow=function(o,e){var t=o[e];this.rows.push(new _MultiRow(t,e))};TransposedMultiRow.prototype._getCollectionView=function(e){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=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return o.prototype._getCollectionView.call(this,e)};TransposedMultiRow.prototype._rowInfoChanged=function(){var o=this;this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout((function(){var e=o.selection,t=o.itemsSource;o.itemsSource=null;o.itemsSource=t;o.selection=e}),wijmo_1.Control._REFRESH_INTERVAL)};TransposedMultiRow.prototype._formatItem=function(o,e){var t=this.columnsPerItem,r=e.panel,n=r.cellType,i=r.rows[e.range.row],l=(r.rows[e.range.row2],e.cell);n==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(l,"wj-group-header",0==e.range.row);if(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.RowHeader){var a=this._getGroupByRow(e.row);wijmo_1.toggleClass(l,"wj-group-start",a._rowstart==e.range.row);wijmo_1.toggleClass(l,"wj-group-end",a._rowstart+a._rowspan-1==e.range.row2)}if(t>1&&(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(l,"wj-record-start",e.range.col%t==0);wijmo_1.toggleClass(l,"wj-record-end",e.range.col2%t==t-1)}var s=this.alternatingRowStep;if(s&&n==wijmo_grid_1.CellType.Cell){var u=this._layout.totalRowSpan,_=this._layout._bindingGroups.length,c=Math.floor(i.dataIndex/u)*_,p=i.dataIndex%u,w=(c+=this._layout._getGroupIndexByRow(p)+1)%(s+1)==0;wijmo_1.toggleClass(l,"wj-alt",w)}};TransposedMultiRow.prototype._sourceViewChanged=function(o,e){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(o){var e=this,t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(o).forEach((function(r,n){var i=e._createKeys(o);if(e._supportsProxies()){var l=e._createProxy(o,r,i);t.push(l)}else{var a=e._createTransposedObject(o,r,i);t.push(a)}}));o instanceof wijmo_1.ObservableArray&&o.collectionChanged.addHandler((function(){var o=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(o);e._rowInfoChanged()}))}return t};TransposedMultiRow.prototype._createKeys=function(o){var e=this,t=Array.apply(null,{length:this.columnsPerItem}),r=o.map((function(o,r){return t.map((function(o,t){return e._keyPrefix+r+"_"+t}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(o,e,t){var r={_arr:o,_rowInfo:e,_bnd:e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:t};return new Proxy(r,{ownKeys:function(o){return o._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(o,e){var t=o._keys.indexOf(e);if(t>-1){var r=o._bnd,n=o._arr,i=r.length,l=t%i,a=Math.floor(t/i);return r[l].getValue(n[a])}return o[e]},set:function(o,e,t){var r=o._keys.indexOf(e);if(r>-1){var n=o._bnd,i=o._arr,l=n.length,a=r%l,s=Math.floor(r/l);n[a].setValue(i[s],t);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,e,t){for(var r={_arr:o,_rowInfo:e},n=e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_loop_1=function(e){var i=t[e];Object.defineProperty(r,i,{enumerable:!0,get:function(){var t=n.length,r=e%t,i=Math.floor(e/t);return n[r].getValue(o[i])},set:function(t){var r=n.length,i=e%r,l=Math.floor(e/r);n[i].setValue(o[l],t);if(o instanceof wijmo_1.ObservableArray){var a=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,o[l],l);o.onCollectionChanged(a)}return!0}})},i=0;i<t.length;i++)_loop_1(i);return r};TransposedMultiRow.prototype._getRowInfo=function(o){var e=[];if(this._layout){for(var t=this.rowHeaders.columns,r=this.columnsPerItem+1;t.length>r;)t.removeAt(t.length-1);for(;t.length<r;)t.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach((function(o){for(var t=0;t<o.rowspan;t++){for(var r={bindings:[]},n=0;n<o.colspan;n++)for(var i=0;i<o.cells.length;i++){var l=o.cells[i];if(t>=l.row&&t<l.row+l.rowspan&&n>=l.col&&n<l.col+l.colspan){r.bindings.push(l.binding);break}}e.push(r)}}))}return e};return TransposedMultiRow}(wijmo_grid_1.FlexGrid);exports.TransposedMultiRow=TransposedMultiRow;var _CellFactory=function(o){__extends(_CellFactory,o);function _CellFactory(){return null!==o&&o.apply(this,arguments)||this}_CellFactory.prototype.updateCell=function(e,t,r,n,i,l){if(e.cellType==wijmo_grid_1.CellType.Cell){var a=e.grid,s=a.rows[t],u=a.columns[r],_=s.dataType,c=s.format,p=s.dataMap,w=this.findCell(a,t,r);if(s){s.setDataType(wijmo_1.getType(s.dataItem[u.binding]));if(w){s.setDataMap(w.dataMap);s.setFormat(w.format)}}try{o.prototype.updateCell.call(this,e,t,r,n,i,l)}finally{if(s){s.setDataType(_);if(w){p&&s.setDataMap(p);s.setFormat(c)}}}}else o.prototype.updateCell.call(this,e,t,r,n,i,l)};_CellFactory.prototype.findCell=function(o,e,t){for(var r=o._getGroupByRow(e),n=t%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==e&&n>=r._colstart+l.col&&n<r._colstart+l.col+l.colspan)return l}return null};return _CellFactory}(wijmo_grid_1.CellFactory);exports._CellFactory=_CellFactory;var _MergeManager=function(o){__extends(_MergeManager,o);function _MergeManager(){return null!==o&&o.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(o,e,t,r){void 0===r&&(r=!0);var n=o.grid;switch(o.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:var i=t;o.cellType==wijmo_grid_1.CellType.RowHeader&&i--;var l=n._getGroupByRow(e);wijmo_1.assert(l instanceof _CellGroup,"Failed to get the group!");var a=l.getMergedRange(o,e,i);wijmo_1.assert(a&&a.contains(e,t),"Merged range must contain source cell");return a;case wijmo_grid_1.CellType.ColumnHeader:var s=n.columnsPerItem,u=t-t%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;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(o,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,e){o.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])})(o,e)};return function(o,e){extendStatics(o,e);function __(){this.constructor=o}o.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=require("@grapecity/wijmo.grid.transposedmultirow"),_MultiRow=function(o){__extends(_MultiRow,o);function _MultiRow(e,t){var r=o.call(this,e)||this;r._idxData=t;r._idxData;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};return _MultiRow}(wijmo_grid_1.Row);exports._MultiRow=_MultiRow;var _Cell=function(o){__extends(_Cell,o);function _Cell(e){var t=o.call(this)||this;t._row=t._col=0;t._rowspan=t._colspan=1;e&&wijmo_1.copy(t,e);return t}Object.defineProperty(_Cell.prototype,"row",{get:function(){return this._row},set:function(o){this._row=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"col",{get:function(){return this._col},set:function(o){this._col=wijmo_1.asInt(o,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"colspan",{get:function(){return this._colspan},set:function(o){this._colspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});Object.defineProperty(_Cell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(o){this._rowspan=wijmo_1.asInt(o,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")},enumerable:!0,configurable:!0});return _Cell}(wijmo_grid_1.Column);exports._Cell=_Cell;var _CellGroup=function(o){__extends(_CellGroup,o);function _CellGroup(e,t){var r=o.call(this)||this;r._colstart=0;r._rowstart=0;r._layout=e;t&&wijmo_1.copy(r,t);if(!r._cells)throw"Cell group with no cells?";var n=0,i=0;r._cells.forEach((function(o,e){for(;!r._cellFits(o,e,n,i);)0==(i=(i+1)%r.colspan)&&n++;o.row=n;o.col=i}));var l=1,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,e){var t=this;if("cells"==o){this._cells=[];wijmo_1.isArray(e)&&e.forEach((function(o){var e=new _Cell(o);e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding));t._cells.push(e);t.colspan=Math.max(t.colspan,e.colspan)}));return!0}return!1};Object.defineProperty(_CellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});_CellGroup.prototype.closeGroup=function(o){var e=this;if(o>this.colspan){this._cells.forEach((function(t){t.col==e.colspan-1&&(t.colspan=o-t.col)}));this.colspan=o}this._cells.forEach((function(o){for(;o.col+o.colspan<e.colspan&&!e._slotTaken(o.row,o.col+o.colspan);)o.colspan++}));this._cells.forEach((function(o){for(;o.row+o.rowspan<e.rowspan&&!e._slotTaken(o.row+o.rowspan,o.col);)o.rowspan++}));for(var t=0;t<this.rowspan;t++)for(var r=0;r<this.colspan;r++)wijmo_1.assert(this._slotTaken(t,r),"Invalid layout (empty cells).");this._rng=new Array(o*this.rowspan);this._cells.forEach((function(o){for(var t=0;t<o.rowspan;t++)for(var r=0;r<o.colspan;r++){var n=(o.row+t)*e.colspan+(o.col+r),i=new wijmo_grid_1.CellRange(o.row,o.col,o.row+o.rowspan-1,o.col+o.colspan-1);e._rng[n]=i}}));this._rng[-1]=new wijmo_grid_1.CellRange(this._rowstart,this._colstart,this._rowstart+this._rowspan-1,this._colstart)};_CellGroup.prototype.getMergedRange=function(o,e,t){if(t<0)return this._rng[-1];var r=e-this._rowstart,n=t%this.colspan,i=this._rng[r*this.colspan+n];o.cellType==wijmo_grid_1.CellType.RowHeader&&t++;var l=e-r,a=t-n;return i?new wijmo_grid_1.CellRange(l+i.row,a+i.col,l+i.row2,a+i.col2):null};_CellGroup.prototype._cellFits=function(o,e,t,r){if(r>0&&r+o.colspan>this.colspan)return!1;for(var n=0;n<o.colspan;n++)if(this._slotTaken(t,r+n,e))return!1;this.colspan=Math.max(this.colspan,r+o.colspan-1);return!0};_CellGroup.prototype._slotTaken=function(o,e,t){void 0===t&&(t=this._cells.length);for(var r=0;r<t;r++){var n=this._cells[r];if(o>=n.row&&o<=n.row+n.rowspan-1&&e>=n.col&&e<=n.col+n.colspan-1)return!0}return!1};return _CellGroup}(_Cell);exports._CellGroup=_CellGroup;var _MultiRowLayout=function(){function _MultiRowLayout(o,e){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=o;this._bindingGroups=this._parseCellGroups(e)}Object.defineProperty(_MultiRowLayout.prototype,"totalRowSpan",{get:function(){var o=this._bindingGroups;if(o&&o.length){var e=o[o.length-1];return e._rowstart+e.rowspan}return 0},enumerable:!0,configurable:!0});_MultiRowLayout.prototype._parseCellGroups=function(o){var e=[],t=1;if(o){for(var r=0,n=0;r<o.length;r++){var i=new _CellGroup(this,o[r]);i._rowstart=n;n+=i._rowspan;t=Math.max(t,i._colspan);e.push(i)}e.forEach((function(o){o.closeGroup(t)}));this._columnsPerItem=t}return e};_MultiRowLayout.prototype._getGroupByRow=function(o){var e=this._getGroupIndexByRow(o);return e>-1?this._bindingGroups[e]:null};_MultiRowLayout.prototype._getGroupIndexByRow=function(o){var e=this._groupsByRow[o];if(e)return e;for(var t=this._bindingGroups,r=0;r<t.length;r++){var n=t[r];if(o>=n._rowstart&&o<=n._rowstart+n._rowspan-1){this._groupsByRow[o]=r;return r}}return-1};return _MultiRowLayout}();exports._MultiRowLayout=_MultiRowLayout;var TransposedMultiRow=function(o){__extends(TransposedMultiRow,o);function TransposedMultiRow(e,t){var r=o.call(this,e)||this;r._keyPrefix="item";wijmo_1.addClass(r.hostElement,"wj-transposed-multirow");r._layout=new _MultiRowLayout(r,null);r.allowDragging=wijmo_grid_1.AllowDragging.None;r.allowSorting=wijmo_grid_1.AllowSorting.None;r.mergeManager=new _MergeManager(r);r.cellFactory=new _CellFactory;r.formatItem.addHandler(r._formatItem,r);r._rowInfo=new wijmo_grid_1.ColumnCollection(r,r.columns.defaultSize);r.initialize(t);r._rowInfo.collectionChanged.addHandler(r._rowInfoChanged,r);return r}Object.defineProperty(TransposedMultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(o){this._layoutDef=wijmo_1.asArray(o);this._layout=new _MultiRowLayout(this,o);this._rowInfoChanged()},enumerable:!0,configurable:!0});Object.defineProperty(TransposedMultiRow.prototype,"columnsPerItem",{get:function(){return this._layout._columnsPerItem},enumerable:!0,configurable:!0});TransposedMultiRow.prototype.refresh=function(e){var t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else o.prototype.refresh.call(this,e)};TransposedMultiRow.prototype.onLoadedRows=function(e){for(var t=this.columnHeaders.columns,r=0;r<t.length;r++)this.columnHeaders.setCellData(0,r,"");var n=this.columns;for(r=0;r<n.length;r++){var i=n[r];i.align=null;i.dataType=0}var l=this.rowHeaders.columns,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 c=l.length-2;c>=0;c--){for(var p="",w=0;w<_.cells.length;w++){var h=_.cells[w];if(u>=h.row&&u<h.row+h.rowspan&&c>=h.col&&c<h.col+h.colspan){p=h.header;break}}this.rowHeaders.setCellData(s.index,c+1,p)}}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}this.autoSizeColumns(0,l.length-1,!0);o.prototype.onLoadedRows.call(this,e)};TransposedMultiRow.prototype._getGroupByRow=function(o){var e=this._layout._getGroupByRow(o);wijmo_1.assert(e instanceof _CellGroup,"Failed to get the group!");return e};TransposedMultiRow.prototype._addBoundRow=function(o,e){var t=o[e];this.rows.push(new _MultiRow(t,e))};TransposedMultiRow.prototype._getCollectionView=function(e){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=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;return o.prototype._getCollectionView.call(this,e)};TransposedMultiRow.prototype._rowInfoChanged=function(){var o=this;this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout((function(){var e=o.selection,t=o.itemsSource;o.itemsSource=null;o.itemsSource=t;o.selection=e}),wijmo_1.Control._REFRESH_INTERVAL)};TransposedMultiRow.prototype._formatItem=function(o,e){var t=this.columnsPerItem,r=e.panel,n=r.cellType,i=r.rows[e.range.row],l=(r.rows[e.range.row2],e.cell);n==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(l,"wj-group-header",0==e.range.row);if(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.RowHeader){var a=this._getGroupByRow(e.row);wijmo_1.toggleClass(l,"wj-group-start",a._rowstart==e.range.row);wijmo_1.toggleClass(l,"wj-group-end",a._rowstart+a._rowspan-1==e.range.row2)}if(t>1&&(n==wijmo_grid_1.CellType.Cell||n==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(l,"wj-record-start",e.range.col%t==0);wijmo_1.toggleClass(l,"wj-record-end",e.range.col2%t==t-1)}var s=this.alternatingRowStep;if(s&&n==wijmo_grid_1.CellType.Cell){var u=this._layout.totalRowSpan,_=this._layout._bindingGroups.length,c=Math.floor(i.dataIndex/u)*_,p=i.dataIndex%u,w=(c+=this._layout._getGroupIndexByRow(p)+1)%(s+1)==0;wijmo_1.toggleClass(l,"wj-alt",w)}};TransposedMultiRow.prototype._sourceViewChanged=function(o,e){this.activeEditor||this.invalidate()};TransposedMultiRow.prototype._transposeItemsSource=function(o){var e=this,t=new wijmo_1.ObservableArray;if(this._layout&&this._layout._bindingGroups.length){this._getRowInfo(o).forEach((function(r,n){var i=e._createKeys(o);if(e._supportsProxies()){var l=e._createProxy(o,r,i);t.push(l)}else{var a=e._createTransposedObject(o,r,i);t.push(a)}}));o instanceof wijmo_1.ObservableArray&&o.collectionChanged.addHandler((function(){var o=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);t.onCollectionChanged(o);e._rowInfoChanged()}))}return t};TransposedMultiRow.prototype._createKeys=function(o){var e=this,t=Array.apply(null,{length:this.columnsPerItem}),r=o.map((function(o,r){return t.map((function(o,t){return e._keyPrefix+r+"_"+t}))}));return[].concat.apply([],r)};TransposedMultiRow.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedMultiRow.prototype._createProxy=function(o,e,t){var r={_arr:o,_rowInfo:e,_bnd:e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_keys:t};return new Proxy(r,{ownKeys:function(o){return o._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(o,e){var t=o._keys.indexOf(e);if(t>-1){var r=o._bnd,n=o._arr,i=r.length,l=t%i,a=Math.floor(t/i);return r[l].getValue(n[a])}return o[e]},set:function(o,e,t){var r=o._keys.indexOf(e);if(r>-1){var n=o._bnd,i=o._arr,l=n.length,a=r%l,s=Math.floor(r/l);n[a].setValue(i[s],t);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,e,t){for(var r={_arr:o,_rowInfo:e},n=e.bindings.map((function(o){return new wijmo_1.Binding(o)})),_loop_1=function(e){var i=t[e];Object.defineProperty(r,i,{enumerable:!0,get:function(){var t=n.length,r=e%t,i=Math.floor(e/t);return n[r].getValue(o[i])},set:function(t){var r=n.length,i=e%r,l=Math.floor(e/r);n[i].setValue(o[l],t);if(o instanceof wijmo_1.ObservableArray){var a=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,o[l],l);o.onCollectionChanged(a)}return!0}})},i=0;i<t.length;i++)_loop_1(i);return r};TransposedMultiRow.prototype._getRowInfo=function(o){var e=[];if(this._layout){for(var t=this.rowHeaders.columns,r=this.columnsPerItem+1;t.length>r;)t.removeAt(t.length-1);for(;t.length<r;)t.push(new wijmo_grid_1.Column);this._layout._bindingGroups.forEach((function(o){for(var t=0;t<o.rowspan;t++){for(var r={bindings:[]},n=0;n<o.colspan;n++)for(var i=0;i<o.cells.length;i++){var l=o.cells[i];if(t>=l.row&&t<l.row+l.rowspan&&n>=l.col&&n<l.col+l.colspan){r.bindings.push(l.binding);break}}e.push(r)}}))}return e};return TransposedMultiRow}(wijmo_grid_1.FlexGrid);exports.TransposedMultiRow=TransposedMultiRow;var _CellFactory=function(o){__extends(_CellFactory,o);function _CellFactory(){return null!==o&&o.apply(this,arguments)||this}_CellFactory.prototype.updateCell=function(e,t,r,n,i,l){if(e.cellType==wijmo_grid_1.CellType.Cell){var a=e.grid,s=a.rows[t],u=a.columns[r],_=s.dataType,c=s.format,p=s.dataMap,w=this.findCell(a,t,r);if(s){s.setDataType(wijmo_1.getType(s.dataItem[u.binding]));if(w){s.setDataMap(w.dataMap);s.setFormat(w.format)}}try{o.prototype.updateCell.call(this,e,t,r,n,i,l)}finally{if(s){s.setDataType(_);if(w){p&&s.setDataMap(p);s.setFormat(c)}}}}else o.prototype.updateCell.call(this,e,t,r,n,i,l)};_CellFactory.prototype.findCell=function(o,e,t){for(var r=o._getGroupByRow(e),n=t%o.columnsPerItem,i=0;i<r.cells.length;i++){var l=r.cells[i];if(r._rowstart+l._row==e&&n>=r._colstart+l.col&&n<r._colstart+l.col+l.colspan)return l}return null};return _CellFactory}(wijmo_grid_1.CellFactory);exports._CellFactory=_CellFactory;var _MergeManager=function(o){__extends(_MergeManager,o);function _MergeManager(){return null!==o&&o.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(o,e,t,r){void 0===r&&(r=!0);var n=o.grid;switch(o.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:var i=t;o.cellType==wijmo_grid_1.CellType.RowHeader&&i--;var l=n._getGroupByRow(e);wijmo_1.assert(l instanceof _CellGroup,"Failed to get the group!");var a=l.getMergedRange(o,e,i);wijmo_1.assert(a&&a.contains(e,t),"Merged range must contain source cell");return a;case wijmo_grid_1.CellType.ColumnHeader:var s=n.columnsPerItem,u=t-t%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;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
{
"name": "@grapecity/wijmo.grid.transposedmultirow",
"version": "5.20201.681-nightly.d20200616.t020140",
"version": "5.20201.681-nightly.d20200617.t020400",
"description": "UI library for pure JS, Angular, React, Vue and more...",

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

"dependencies": {
"@grapecity/wijmo": "5.20201.681-nightly.d20200616.t020140",
"@grapecity/wijmo.grid": "5.20201.681-nightly.d20200616.t020140"
"@grapecity/wijmo": "5.20201.681-nightly.d20200617.t020400",
"@grapecity/wijmo.grid": "5.20201.681-nightly.d20200617.t020400"
},

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc