Socket
Socket
Sign inDemoInstall

@grapecity/wijmo.grid.transposedmultirow

Package Overview
Dependencies
Maintainers
2
Versions
863
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 5.20241.1-nightly.d20240301.t020148 to 5.20241.7

4

es2015-commonjs.js
/*!
*
* Wijmo Library 5.20241.001-nightly.d20240301.t020148
* Wijmo Library 5.20241.7
* https://developer.mescius.com/wijmo

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

"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.hasOwnProperty.call(e,o)&&(t[o]=e[o]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=__importStar(require("@grapecity/wijmo.grid.transposedmultirow"));class _MultiRow extends wijmo_grid_1.Row{constructor(e,t){super(e);this._idxData=t}}exports._MultiRow=_MultiRow;class _Cell extends wijmo_grid_1.Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;wijmo_1.copy(this,e)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")}}exports._Cell=_Cell;class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;this._g=e._grid;wijmo_1.copy(this,t);if(!this._cells)throw"Cell group with no cells?";let o=0,i=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,o,i);)0==(i=(i+1)%this.colspan)&&o++;e.row=o;e.col=i});let l=1,r=1;this._cells.forEach(e=>{l=Math.max(l,e.row+e.rowspan);r=Math.max(r,e.col+e.colspan)});this.rowspan=l;this.colspan=r}_copy(e,t){if("cells"==e){this._cells=[];wijmo_1.isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach(e=>{for(let t=0;t<e.rowspan;t++)for(let o=0;o<e.colspan;o++){let i=(e.row+t)*this.colspan+(e.col+o);this._cols.setAt(i,e);let l=new wijmo_grid_1.CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);l.isSingleCell||(this._rng[i]=l)}});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 i=t-this._rowstart,l=o%this.colspan,r=this._rng[i*this.colspan+l];e.cellType==wijmo_grid_1.CellType.RowHeader&&o++;let s=t-i,n=o-l;return r?new wijmo_grid_1.CellRange(s+r.row,n+r.col,s+r.row2,n+r.col2):null}getBindingColumn(e,t,o){if(o<0)return this;let i=t-this._rowstart,l=o%this.colspan;return this._cols[i*this.colspan+l]}_cellFits(e,t,o,i){if(i>0&&i+e.colspan>this.colspan)return!1;for(let l=0;l<e.colspan;l++)if(this._slotTaken(o,i+l,t))return!1;this.colspan=Math.max(this.colspan,i+e.colspan-1);return!0}_slotTaken(e,t,o=this._cells.length){for(let i=0;i<o;i++){let o=this._cells[i];if(e>=o.row&&e<=o.row+o.rowspan-1&&t>=o.col&&t<=o.col+o.colspan-1)return!0}return!1}_updateCellTypes(e){this._cols.forEach(t=>{let o=t;null==o.dataType&&o._binding&&(o.dataType=wijmo_1.getType(o._binding.getValue(e)))})}}exports._CellGroup=_CellGroup;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,i=!0){let l=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:let i=e.rows[t].dataItem._rowInfo.index,r=o;e.cellType==wijmo_grid_1.CellType.RowHeader&&r--;let s=l._getGroupByRow(t);wijmo_1.assert(s instanceof _CellGroup,"Failed to get the group!");let n=s.getMergedRange(e,i,r);if(n){let o=i,l=t;if(t>0){o=e.rows[t-1].dataItem._rowInfo.index;l=t-1}n.row<=o?n.row=l:n.row=t;let r=i,s=t;if(t<e.rows.length-1){r=e.rows[t+1].dataItem._rowInfo.index;s=t+1}n.row2>=r?n.row2=s:n.row2=t}wijmo_1.assert(!n||n.contains(t,o),"Merged range must contain source cell");return n;case wijmo_grid_1.CellType.ColumnHeader:let a=l.columnsPerItem,_=o-o%a,w=Math.min(_+a-1,e.columns.length-1);return new wijmo_grid_1.CellRange(0,_,e.rows.length-1,w);case wijmo_grid_1.CellType.TopLeft:return new wijmo_grid_1.CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}exports._MergeManager=_MergeManager;class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],o=1;if(e){for(let i=0,l=0;i<e.length;i++){let r=new _CellGroup(this,e[i]);r._rowstart=l;l+=r._rowspan;o=Math.max(o,r._colspan);t.push(r)}t.forEach(e=>{e.closeGroup(o)});this._columnsPerItem=o}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let o=this._bindingGroups;for(let t=0;t<o.length;t++){let i=o[t];if(e>=i._rowstart&&e<=i._rowstart+i._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._updateCellTypes(e)})}}exports._MultiRowLayout=_MultiRowLayout;class TransposedMultiRow extends wijmo_grid_1.FlexGrid{constructor(e,t){super(e);this._currentPos=-1;this._bindingColumns={};this._keyPrefix="item";wijmo_1.addClass(this.hostElement,"wj-transposed-multirow");this._layout=new _MultiRowLayout(this,null);this.allowDragging=wijmo_grid_1.AllowDragging.None;this.allowSorting=wijmo_grid_1.AllowSorting.None;this.mergeManager=new _MergeManager;this.formatItem.addHandler(this._formatItem,this);this._rowInfo=new wijmo_grid_1.ColumnCollection(this,this.columns.defaultSize);this.initialize(t);this._rowInfo.collectionChanged.addHandler(this._rowInfoChanged,this)}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this._layoutDef=wijmo_1.asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()}getBindingColumn(e,t,o){if(e.cellType!=wijmo_grid_1.CellType.Cell)return null;let i=t>-1?e.rows[t]:null,l=null!=i?i.dataItem._rowInfo:null,r=null!=l?l.index:-1,s=r+"_"+o,n=this._bindingColumns[s];if(n)return n;if(t>-1){let i=this._getGroupByRow(t).getBindingColumn(e,r,o);if(i){n=new wijmo_grid_1.Column;wijmo_grid_1.FlexGrid._getSerializableProperties(wijmo_grid_1.Column).forEach(e=>{null!=i[e]&&(n[e]=i[e])});let e=Math.floor(o/this.columnsPerItem),t=o%this.columnsPerItem;n.binding=this._keyPrefix+e+"_"+t;this._bindingColumns[s]=n}}return n}get columnsPerItem(){return this._layout._columnsPerItem}get allowAddNew(){return!1}set allowAddNew(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items addition.")}get allowDelete(){return!1}set allowDelete(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items deletion.")}get allowDragging(){return wijmo_grid_1.AllowDragging.None}set allowDragging(e){wijmo_1.assert(e===wijmo_grid_1.AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}}get allowPinning(){return!1}set allowPinning(e){wijmo_1.assert(!e,"TransposedMultiRow does not support pinning.")}get allowSorting(){return wijmo_grid_1.AllowSorting.None}set allowSorting(e){wijmo_1.assert(e===wijmo_grid_1.AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e}get columnLayout(){throw"TransposedMultiRow does not support column layout."}set columnLayout(e){throw"TransposedMultiRow does not support column layout."}refresh(e){let t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else super.refresh(e)}onLoadedRows(e){let t=this.columnHeaders.columns;for(let e=0;e<t.length;e++)this.columnHeaders.setCellData(0,e,"");let o=this.columns;for(let e=0;e<o.length;e++){let t=o[e];t.align=null;t.dataType=0}let i=this.rowHeaders.columns;this.rows.forEach(e=>{let t=e.dataItem._rowInfo;if(t)for(let o=i.length-2;o>=0;o--){let i=t.headers[o]||wijmo_1.toHeaderCase(t.bindings[o]);this.rowHeaders.setCellData(e.index,o+1,i)}});i[0].visible=!1;for(let e=1;e<i.length;e++){i[e].align="left";i[e].visible=!0;i[e].width=this.columns.defaultSize}super.onLoadedRows(e)}_getGroupByRow(e){let t=this.cells.rows[e].dataItem._rowInfo.index,o=this._layout._getGroupByRow(t);wijmo_1.assert(o instanceof _CellGroup,"Failed to get the group!");return o}_addBoundRow(e,t){let o=e[t];this.rows.push(new _MultiRow(o,t))}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(wijmo_1.hasItems(e)&&this._layout){let t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}}_getBindingColumn(e,t,o){if(this._layout){e==this.cells&&o&&(o=this.getBindingColumn(e,t,o.index));return o}return super._getBindingColumn(e,t,o)}_isTransposed(){return!0}_autoSizeRows(){this.autoSizeMode&wijmo_grid_1.AutoSizeMode.Both&&this.autoSizeRows();super._autoSizeRows()}onRowEditEnded(e){if(null!=this._view){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change);this._view.collectionChanged.raise(this._view,e)}super.onRowEditEnded(e)}_getCollectionView(e){let t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof wijmo_1.CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;let o=super._getCollectionView(e);o&&this._currentPos>=0&&(o.currentPosition=Math.min(o.items.length-1,this._currentPos));t&&o instanceof wijmo_1.CollectionView&&(o.getError=(e,o)=>{if(null==o)return null;let i=e._keys.indexOf(o),l=i%e._bnd.length,r=Math.floor(i/e._bnd.length);return t(e._arr[r],e._bnd[l].path)});return o}_rowInfoChanged(){try{let e=this.collectionView;this._currentPos=e?e.currentPosition:-1;let t=this.selection;this._bindingColumns={};let o=this.itemsSource;this.itemsSource=null;this.itemsSource=o;t&&t.isValid&&(this.selection=t)}finally{this._currentPos=-1}}_formatItem(e,t){let o=this.columnsPerItem,i=t.panel,l=i.cellType,r=i.rows[t.range.row],s=(i.rows[t.range.row2],t.cell);l==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(s,"wj-group-header",0==t.range.row);if(l==wijmo_grid_1.CellType.Cell||l==wijmo_grid_1.CellType.RowHeader){let e=this._getGroupByRow(t.row);wijmo_1.toggleClass(s,"wj-group-start",e._rowstart==t.range.row);wijmo_1.toggleClass(s,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(o>1&&(l==wijmo_grid_1.CellType.Cell||l==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(s,"wj-record-start",t.range.col%o==0);wijmo_1.toggleClass(s,"wj-record-end",t.range.col2%o==o-1)}let n=this.alternatingRowStep;if(n&&l==wijmo_grid_1.CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,o=Math.floor(r.dataIndex/e)*t,i=r.dataIndex%e,l=(o+=this._layout._getGroupIndexByRow(i)+1)%(n+1)==0;wijmo_1.toggleClass(s,"wj-alt",l)}if(l==wijmo_grid_1.CellType.RowHeader){let e=r.dataItem._rowInfo,o=this._getGroupByRow(t.row).getBindingColumn(i,e.index,t.col);wijmo_1.toggleClass(s,"wj-wrap",o.wordWrap)}}_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,i)=>{let l=this._createKeys(e);if(this._supportsProxies()){let i=this._createProxy(e,o,l);t.push(i)}else{let i=this._createTransposedObject(e,o,l);t.push(i)}});e instanceof wijmo_1.ObservableArray&&e.collectionChanged.addHandler((e,o)=>{if(o.action===wijmo_1.NotifyCollectionChangedAction.Change)this.activeEditor||this.invalidate();else{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 i={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};return new Proxy(i,{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,i=e._arr,l=t.length,r=o%l,s=Math.floor(o/l);return t[r].getValue(i[s])}return e[t]},set:(e,t,o)=>{let i=e._keys.indexOf(t);if(i>-1){let t=e._bnd,l=e._arr,r=t.length,s=i%r,n=Math.floor(i/r);t[s].setValue(l[n],o);if(l instanceof wijmo_1.ObservableArray||l instanceof wijmo_1.CollectionView){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,l[n],n);l.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,o){let i={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};for(let t=0;t<o.length;t++){let l=o[t];Object.defineProperty(i,l,{enumerable:!0,get:()=>{let o=i._bnd,l=o.length,r=t%l,s=Math.floor(t/l);return o[r].getValue(e[s])},set:o=>{let l=i._bnd,r=l.length,s=t%r,n=Math.floor(t/r);l[s].setValue(e[n],o);if(e instanceof wijmo_1.ObservableArray){let t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e[n],n);e.onCollectionChanged(t)}return!0}})}return i}_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 i={index:e._rowstart+o,bindings:[],headers:[]};for(let t=0;t<e.colspan;t++)for(let l=0;l<e.cells.length;l++){let r=e.cells[l];if(o>=r.row&&o<r.row+r.rowspan&&t>=r.col&&t<r.col+r.colspan){i.bindings.push(r.binding);i.headers.push(r.header);break}}t.push(i)}})}return t}}exports.TransposedMultiRow=TransposedMultiRow;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.hasOwnProperty.call(e,o)&&(t[o]=e[o]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=__importStar(require("@grapecity/wijmo.grid.transposedmultirow"));class _MultiRow extends wijmo_grid_1.Row{constructor(e,t){super(e);this._idxData=t}}exports._MultiRow=_MultiRow;class _Cell extends wijmo_grid_1.Column{constructor(e){super();this._row=this._col=0;this._rowspan=this._colspan=1;wijmo_1.copy(this,e)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e,!1,!0)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e,!1,!0)}get colspan(){return this._colspan}set colspan(e){this._colspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._colspan>0,"colspan must be >= 1")}get rowspan(){return this._rowspan}set rowspan(e){this._rowspan=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(this._rowspan>0,"colspan must be >= 1")}}exports._Cell=_Cell;class _CellGroup extends _Cell{constructor(e,t){super();this._colstart=0;this._rowstart=0;this._layout=e;this._g=e._grid;wijmo_1.copy(this,t);if(!this._cells)throw"Cell group with no cells?";let o=0,i=0;this._cells.forEach((e,t)=>{for(;!this._cellFits(e,t,o,i);)0==(i=(i+1)%this.colspan)&&o++;e.row=o;e.col=i});let l=1,r=1;this._cells.forEach(e=>{l=Math.max(l,e.row+e.rowspan);r=Math.max(r,e.col+e.colspan)});this.rowspan=l;this.colspan=r}_copy(e,t){if("cells"==e){this._cells=[];wijmo_1.isArray(t)&&t.forEach(e=>{let t=new _Cell(e);t.binding&&!t.header&&(t.header=wijmo_1.toHeaderCase(t.binding));this._cells.push(t);this.colspan=Math.max(this.colspan,t.colspan)});return!0}return!1}get cells(){return this._cells}closeGroup(e){if(e>this.colspan){this._cells.forEach(t=>{t.col==this.colspan-1&&(t.colspan=e-t.col)});this.colspan=e}this._cells.forEach(e=>{for(;e.col+e.colspan<this.colspan&&!this._slotTaken(e.row,e.col+e.colspan);)e.colspan++});this._cells.forEach(e=>{for(;e.row+e.rowspan<this.rowspan&&!this._slotTaken(e.row+e.rowspan,e.col);)e.rowspan++});for(let e=0;e<this.rowspan;e++)for(let t=0;t<this.colspan;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(this._g,this._g.columns.defaultSize);this._rng=new Array(e*this.rowspan);this._cells.forEach(e=>{for(let t=0;t<e.rowspan;t++)for(let o=0;o<e.colspan;o++){let i=(e.row+t)*this.colspan+(e.col+o);this._cols.setAt(i,e);let l=new wijmo_grid_1.CellRange(e.row,e.col,e.row+e.rowspan-1,e.col+e.colspan-1);l.isSingleCell||(this._rng[i]=l)}});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 i=t-this._rowstart,l=o%this.colspan,r=this._rng[i*this.colspan+l];e.cellType==wijmo_grid_1.CellType.RowHeader&&o++;let s=t-i,n=o-l;return r?new wijmo_grid_1.CellRange(s+r.row,n+r.col,s+r.row2,n+r.col2):null}getBindingColumn(e,t,o){if(o<0)return this;let i=t-this._rowstart,l=o%this.colspan;return this._cols[i*this.colspan+l]}_cellFits(e,t,o,i){if(i>0&&i+e.colspan>this.colspan)return!1;for(let l=0;l<e.colspan;l++)if(this._slotTaken(o,i+l,t))return!1;this.colspan=Math.max(this.colspan,i+e.colspan-1);return!0}_slotTaken(e,t,o=this._cells.length){for(let i=0;i<o;i++){let o=this._cells[i];if(e>=o.row&&e<=o.row+o.rowspan-1&&t>=o.col&&t<=o.col+o.colspan-1)return!0}return!1}_updateCellTypes(e){this._cols.forEach(t=>{let o=t;null==o.dataType&&o._binding&&(o.dataType=wijmo_1.getType(o._binding.getValue(e)))})}}exports._CellGroup=_CellGroup;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,i=!0){let l=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:let i=e.rows[t].dataItem._rowInfo.index,r=o;e.cellType==wijmo_grid_1.CellType.RowHeader&&r--;let s=l._getGroupByRow(t);wijmo_1.assert(s instanceof _CellGroup,"Failed to get the group!");let n=s.getMergedRange(e,i,r);if(n){let o=i,l=t;if(t>0){o=e.rows[t-1].dataItem._rowInfo.index;l=t-1}n.row<=o?n.row=l:n.row=t;let r=i,s=t;if(t<e.rows.length-1){r=e.rows[t+1].dataItem._rowInfo.index;s=t+1}n.row2>=r?n.row2=s:n.row2=t}wijmo_1.assert(!n||n.contains(t,o),"Merged range must contain source cell");return n;case wijmo_grid_1.CellType.ColumnHeader:let a=l.columnsPerItem,_=o-o%a,w=Math.min(_+a-1,e.columns.length-1);return new wijmo_grid_1.CellRange(0,_,e.rows.length-1,w);case wijmo_grid_1.CellType.TopLeft:return new wijmo_grid_1.CellRange(0,0,e.rows.length-1,e.columns.length-1)}return null}}exports._MergeManager=_MergeManager;class _MultiRowLayout{constructor(e,t){this._columnsPerItem=1;this._bindingGroups=[];this._groupsByRow={};this._grid=e;this._bindingGroups=this._parseCellGroups(t)}get totalRowSpan(){let e=this._bindingGroups;if(e&&e.length){let t=e[e.length-1];return t._rowstart+t.rowspan}return 0}_parseCellGroups(e){let t=[],o=1;if(e){for(let i=0,l=0;i<e.length;i++){let r=new _CellGroup(this,e[i]);r._rowstart=l;l+=r._rowspan;o=Math.max(o,r._colspan);t.push(r)}t.forEach(e=>{e.closeGroup(o)});this._columnsPerItem=o}return t}_getGroupByRow(e){let t=this._getGroupIndexByRow(e);return t>-1?this._bindingGroups[t]:null}_getGroupIndexByRow(e){let t=this._groupsByRow[e];if(t)return t;let o=this._bindingGroups;for(let t=0;t<o.length;t++){let i=o[t];if(e>=i._rowstart&&e<=i._rowstart+i._rowspan-1){this._groupsByRow[e]=t;return t}}return-1}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._updateCellTypes(e)})}}exports._MultiRowLayout=_MultiRowLayout;class TransposedMultiRow extends wijmo_grid_1.FlexGrid{constructor(e,t){super(e);this._currentPos=-1;this._bindingColumns={};this._keyPrefix="item";wijmo_1.addClass(this.hostElement,"wj-transposed-multirow");this._layout=new _MultiRowLayout(this,null);this.allowDragging=wijmo_grid_1.AllowDragging.None;this.allowSorting=wijmo_grid_1.AllowSorting.None;this.mergeManager=new _MergeManager;this.formatItem.addHandler(this._formatItem,this);this._rowInfo=new wijmo_grid_1.ColumnCollection(this,this.columns.defaultSize);this.initialize(t);this._rowInfo.collectionChanged.addHandler(this._rowInfoChanged,this)}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this._layoutDef=wijmo_1.asArray(e);this._layout=new _MultiRowLayout(this,e);this._rowInfoChanged()}getBindingColumn(e,t,o){if(e.cellType!=wijmo_grid_1.CellType.Cell)return null;let i=t>-1?e.rows[t]:null,l=null!=i?i.dataItem._rowInfo:null,r=null!=l?l.index:-1,s=r+"_"+o,n=this._bindingColumns[s];if(n)return n;if(t>-1){let i=this._getGroupByRow(t).getBindingColumn(e,r,o);if(i){n=new wijmo_grid_1.Column;wijmo_grid_1.FlexGrid._getSerializableProperties(wijmo_grid_1.Column).forEach(e=>{null!=i[e]&&(n[e]=i[e])});let e=Math.floor(o/this.columnsPerItem),t=o%this.columnsPerItem;n.binding=this._keyPrefix+e+"_"+t;this._bindingColumns[s]=n}}return n}get columnsPerItem(){return this._layout._columnsPerItem}get allowAddNew(){return!1}set allowAddNew(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items addition.")}get allowDelete(){return!1}set allowDelete(e){wijmo_1.assert(!e,"TransposedMultiRow does not support items deletion.")}get allowDragging(){return wijmo_grid_1.AllowDragging.None}set allowDragging(e){wijmo_1.assert(e===wijmo_grid_1.AllowDragging.None,"TransposedMultiRow does not support dragging.");if(e!==this._alDragging){this._alDragging=e;this.invalidate()}}get allowPinning(){return!1}set allowPinning(e){wijmo_1.assert(!e,"TransposedMultiRow does not support pinning.")}get allowSorting(){return wijmo_grid_1.AllowSorting.None}set allowSorting(e){wijmo_1.assert(e===wijmo_grid_1.AllowSorting.None,"TransposedMultiRow does not support sorting.");this._alSorting=e}get columnLayout(){throw"TransposedMultiRow does not support column layout."}set columnLayout(e){throw"TransposedMultiRow does not support column layout."}refresh(e){let t=this._rowInfo;if(t._dirty){t._dirty=!1;this._rowInfoChanged()}else super.refresh(e)}onLoadedRows(e){let t=this.columnHeaders.columns;for(let e=0;e<t.length;e++)this.columnHeaders.setCellData(0,e,"");let o=this.columns;for(let e=0;e<o.length;e++){let t=o[e];t.align=null;t.dataType=0}let i=this.rowHeaders.columns;this.rows.forEach(e=>{let t=e.dataItem._rowInfo;if(t)for(let o=i.length-2;o>=0;o--){let i=t.headers[o]||wijmo_1.toHeaderCase(t.bindings[o]);this.rowHeaders.setCellData(e.index,o+1,i)}});i[0].visible=!1;for(let e=1;e<i.length;e++){i[e].align="left";i[e].visible=!0;i[e].width=this.columns.defaultSize}super.onLoadedRows(e)}_getGroupByRow(e){let t=this.cells.rows[e].dataItem._rowInfo.index,o=this._layout._getGroupByRow(t);wijmo_1.assert(o instanceof _CellGroup,"Failed to get the group!");return o}_addBoundRow(e,t){let o=e[t];this.rows.push(new _MultiRow(o,t))}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(wijmo_1.hasItems(e)&&this._layout){let t=e.items[0]._arr;t&&t.length>0&&this._layout._updateCellTypes(t[0])}}_getBindingColumn(e,t,o){if(this._layout){e==this.cells&&o&&(o=this.getBindingColumn(e,t,o.index));return o}return super._getBindingColumn(e,t,o)}_isTransposed(){return!0}_autoSizeRows(){this.autoSizeMode&wijmo_grid_1.AutoSizeMode.Both&&this.autoSizeRows();super._autoSizeRows()}onRowEditEnded(e){if(null!=this._view){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change);this._view.collectionChanged.raise(this._view,e)}super.onRowEditEnded(e)}_getCollectionView(e){let t=null;null!=this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);if(wijmo_1.isArray(e))e=this._transposeItemsSource(e);else if(e){this._view&&this._view.collectionChanged.removeHandler(this._sourceViewChanged);this._view=wijmo_1.tryCast(e,"ICollectionView");if(this._view){this._view.collectionChanged.addHandler(this._sourceViewChanged,this);e instanceof wijmo_1.CollectionView&&(t=e.getError);e=this._transposeItemsSource(this._view.items)}}this.autoGenerateColumns=!0;let o=super._getCollectionView(e);o&&this._currentPos>=0&&(o.currentPosition=Math.min(o.items.length-1,this._currentPos));t&&o instanceof wijmo_1.CollectionView&&(o.getError=(e,o)=>{if(null==o)return null;let i=e._keys.indexOf(o),l=i%e._bnd.length,r=Math.floor(i/e._bnd.length);return t(e._arr[r],e._bnd[l].path)});return o}getRowDataItem(e,t){let o=this.cells,i=o.rows[e].dataItem._rowInfo.index,l=this._layout._getGroupByRow(i);if(l){let e=0;l._cells.forEach(t=>{0==t.row&&(e+=t.colspan)});let i=Math.floor(t/e),r={};for(let t=0;t<l._cells.length;t++){let s=l._cells[t];r[l._cells[t]._binding.path]=o.getCellData(s.row,i*e+s.col,!1)}return r}return super.getRowDataItem(e,t)}_rowInfoChanged(){try{let e=this.collectionView;this._currentPos=e?e.currentPosition:-1;let t=this.selection;this._bindingColumns={};let o=this.itemsSource;this.itemsSource=null;this.itemsSource=o;t&&t.isValid&&(this.selection=t)}finally{this._currentPos=-1}}_formatItem(e,t){let o=this.columnsPerItem,i=t.panel,l=i.cellType,r=i.rows[t.range.row],s=(i.rows[t.range.row2],t.cell);l==wijmo_grid_1.CellType.RowHeader&&wijmo_1.toggleClass(s,"wj-group-header",0==t.range.row);if(l==wijmo_grid_1.CellType.Cell||l==wijmo_grid_1.CellType.RowHeader){let e=this._getGroupByRow(t.row);wijmo_1.toggleClass(s,"wj-group-start",e._rowstart==t.range.row);wijmo_1.toggleClass(s,"wj-group-end",e._rowstart+e._rowspan-1==t.range.row2)}if(o>1&&(l==wijmo_grid_1.CellType.Cell||l==wijmo_grid_1.CellType.ColumnHeader)){wijmo_1.toggleClass(s,"wj-record-start",t.range.col%o==0);wijmo_1.toggleClass(s,"wj-record-end",t.range.col2%o==o-1)}let n=this.alternatingRowStep;if(n&&l==wijmo_grid_1.CellType.Cell){let e=this._layout.totalRowSpan,t=this._layout._bindingGroups.length,o=Math.floor(r.dataIndex/e)*t,i=r.dataIndex%e,l=(o+=this._layout._getGroupIndexByRow(i)+1)%(n+1)==0;wijmo_1.toggleClass(s,"wj-alt",l)}if(l==wijmo_grid_1.CellType.RowHeader){let e=r.dataItem._rowInfo,o=this._getGroupByRow(t.row).getBindingColumn(i,e.index,t.col);wijmo_1.toggleClass(s,"wj-wrap",o.wordWrap)}}_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,i)=>{let l=this._createKeys(e);if(this._supportsProxies()){let i=this._createProxy(e,o,l);t.push(i)}else{let i=this._createTransposedObject(e,o,l);t.push(i)}});e instanceof wijmo_1.ObservableArray&&e.collectionChanged.addHandler((e,o)=>{if(o.action===wijmo_1.NotifyCollectionChangedAction.Change)this.activeEditor||this.invalidate();else{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 i={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};return new Proxy(i,{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,i=e._arr,l=t.length,r=o%l,s=Math.floor(o/l);return t[r].getValue(i[s])}return e[t]},set:(e,t,o)=>{let i=e._keys.indexOf(t);if(i>-1){let t=e._bnd,l=e._arr,r=t.length,s=i%r,n=Math.floor(i/r);t[s].setValue(l[n],o);if(l instanceof wijmo_1.ObservableArray||l instanceof wijmo_1.CollectionView){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,l[n],n);l.onCollectionChanged(e)}return!0}return!1}})}_createTransposedObject(e,t,o){let i={_arr:e,_rowInfo:t,_bnd:t.bindings.map(e=>new wijmo_1.Binding(e)),_keys:o};for(let t=0;t<o.length;t++){let l=o[t];Object.defineProperty(i,l,{enumerable:!0,get:()=>{let o=i._bnd,l=o.length,r=t%l,s=Math.floor(t/l);return o[r].getValue(e[s])},set:o=>{let l=i._bnd,r=l.length,s=t%r,n=Math.floor(t/r);l[s].setValue(e[n],o);if(e instanceof wijmo_1.ObservableArray){let t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e[n],n);e.onCollectionChanged(t)}return!0}})}return i}_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 i={index:e._rowstart+o,bindings:[],headers:[]};for(let t=0;t<e.colspan;t++)for(let l=0;l<e.cells.length;l++){let r=e.cells[l];if(o>=r.row&&o<r.row+r.rowspan&&t>=r.col&&t<r.col+r.colspan){i.bindings.push(r.binding);i.headers.push(r.header);break}}t.push(i)}})}return t}}exports.TransposedMultiRow=TransposedMultiRow;wijmo_1._registerModule("wijmo.grid.transposedmultirow",selfModule);
/*!
*
* Wijmo Library 5.20241.001-nightly.d20240301.t020148
* Wijmo Library 5.20241.7
* https://developer.mescius.com/wijmo

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

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

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

@@ -21,5 +21,5 @@ *

export declare var ___keepComment: any;
import { EventArgs, ICollectionView } from '@grapecity/wijmo';
import { MergeManager, GridPanel, CellRange, Column, Row, AllowDragging, AllowSorting, ColumnCollection, CellRangeEventArgs, FlexGrid } from '@grapecity/wijmo.grid';
import * as selfModule from '@grapecity/wijmo.grid.transposedmultirow';
import { EventArgs, ICollectionView } from '@mescius/wijmo';
import { MergeManager, GridPanel, CellRange, Column, Row, AllowDragging, AllowSorting, ColumnCollection, CellRangeEventArgs, FlexGrid } from '@mescius/wijmo.grid';
import * as selfModule from '@mescius/wijmo.grid.transposedmultirow';
/**

@@ -229,2 +229,3 @@ * Extends the {@link Row} class to provide additional API for multi-row records.

protected _getCollectionView(value: any): ICollectionView<T>;
getRowDataItem(r: number, c: number): any;
private _rowInfoChanged;

@@ -231,0 +232,0 @@ private _formatItem;

/*!
*
* Wijmo Library 5.20241.001-nightly.d20240301.t020148
* Wijmo Library 5.20241.7
* https://developer.mescius.com/wijmo

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

@@ -10,4 +10,4 @@ "author": "MESCIUS inc",

"dependencies": {
"@grapecity/wijmo": "5.20241.001-nightly.d20240301.t020148",
"@grapecity/wijmo.grid": "5.20241.001-nightly.d20240301.t020148"
"@grapecity/wijmo": "5.20241.7",
"@grapecity/wijmo.grid": "5.20241.7"
},

@@ -14,0 +14,0 @@ "homepage": "https://developer.mescius.com/wijmo",

@@ -62,3 +62,3 @@ [English](#wijmo) | [日本語](#wijmo-jp) | [中文](#wijmo-cn) | [한국어](#wijmo-kr)

```sh
npm install @grapecity/wijmo.all
npm install @mescius/wijmo.all
```

@@ -69,3 +69,3 @@

```sh
npm install @grapecity/wijmo.all@nightly
npm install @mescius/wijmo.all@nightly
```

@@ -76,3 +76,3 @@

```sh
npm install @grapecity/wijmo.all@rc
npm install @mescius/wijmo.all@rc
```

@@ -208,3 +208,3 @@

```sh
npm install @grapecity/wijmo.all
npm install @mescius/wijmo.all
```

@@ -214,3 +214,3 @@

```sh
npm install @grapecity/wijmo.all@nightly
npm install @mescius/wijmo.all@nightly
```

@@ -221,3 +221,3 @@

```sh
npm install @grapecity/wijmo.all@rc
npm install @mescius/wijmo.all@rc
```

@@ -311,3 +311,3 @@

```sh
npm install @grapecity/wijmo.all
npm install @mescius/wijmo.all
```

@@ -318,3 +318,3 @@

```sh
npm install @grapecity/wijmo.all@nightly
npm install @mescius/wijmo.all@nightly
```

@@ -325,3 +325,3 @@

```sh
npm install @grapecity/wijmo.all@rc
npm install @mescius/wijmo.all@rc
```

@@ -328,0 +328,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc