@grapecity/wijmo.grid.multirow
Advanced tools
Comparing version 5.20241.1-nightly.d20240111.t020133 to 5.20241.1-nightly.d20240112.t020133
/*! | ||
* | ||
* Wijmo Library 5.20241.001-nightly.d20240111.t020133 | ||
* Wijmo Library 5.20241.001-nightly.d20240112.t020133 | ||
* 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.multirow"));class _MultiRowSelectionHandler extends wijmo_grid_1._SelectionHandler{_getNextColumnCell(e,t,o,l=0){const s=this._g,i=s.cells,r=s.columns,n=wijmo_grid_1.SelMove;switch(o){case n.NextEditableCell:for(let o=t+1;o<r.length;o++){let t=s._getBindingColumn(i,e,r[o]);if(t.renderSize>0&&!t.isReadOnly)return o}return t;case n.PrevEditableCell:for(let o=t-1;o>=0;o--){let t=s._getBindingColumn(i,e,r[o]);if(t.renderSize>0&&!t.isReadOnly)return o}return t}return super._getNextColumnCell(e,t,o,l)}}exports._MultiRowSelectionHandler=_MultiRowSelectionHandler;class _MultiRow extends wijmo_grid_1.Row{constructor(e,t,o){super(e);this._idxData=t;this._idxRecord=o}get recordIndex(){return this._idxRecord}}exports._MultiRow=_MultiRow;class _MultiGroupRow extends wijmo_grid_1.GroupRow{constructor(e,t){super(e);this._idxRecord=t}get recordIndex(){return this._idxRecord}get hasChildren(){return!0}getCellRange(){let e=this._getLastRowInHeader();return e!=this?e.getCellRange():super.getCellRange()}get isCollapsed(){return this._getLastRowInHeader()._getFlag(wijmo_grid_1.RowColFlags.Collapsed)}set isCollapsed(e){let t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(wijmo_1.asBoolean(e))}_setCollapsed(e){let t=this.grid,o=t.rows,l=this.getCellRange(),s=new wijmo_grid_1.CellRangeEventArgs(t.cells,new wijmo_grid_1.CellRange(this.index,-1));if(t.onGroupCollapsedChanging(s)){t.deferUpdate(()=>{o.deferUpdate(()=>{this._setFlag(wijmo_grid_1.RowColFlags.Collapsed,e,!0);for(let t=l.topRow+1;t<=l.bottomRow&&t>-1&&t<o.length;t++){o[t]._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);let l=o[t];if(l instanceof _MultiGroupRow){let s=l._getLastRowInHeader();for(t+=1;t<=s.index;t++)(l=o[t])._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);t--}l instanceof wijmo_grid_1.GroupRow&&l.isCollapsed&&(t=l.getCellRange().bottomRow)}})});t.onGroupCollapsedChanged(s)}}_getLastRowInHeader(){let e=this.grid,t=this;if(e&&e.multiRowGroupHeaders){let o=e.rows,l=this.dataItem;for(let e=this.index+1;e<o.length&&o[e].dataItem==l;e++)t=o[e]}wijmo_1.assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t}}exports._MultiGroupRow=_MultiGroupRow;class _MultiRowEditHandler extends wijmo_grid_1._EditHandler{_selectionChanging(e){if(this.finishEditing()){let t=this._g._selHdl.selection.row;if(t!=e.row){let o=this._g.rows.length;if((t>-1&&t<o?this._g.rows[t].dataItem:null)!=(e.row>-1&&e.row<o?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){let o=!this._g.rows[t]||this._g.rows[t]&&Object.getPrototypeOf(this._g.rows[t])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(t);null!==o&&setTimeout(()=>{this._g.select(o);this.startEditing(!0,o.row,o.col,!0,e)})}}}}else e.cancel=!0}}exports._MultiRowEditHandler=_MultiRowEditHandler;class MultiRowCellCollection extends wijmo_1.ObservableArray{_setLayout(e){this._layout=e;this.forEach(t=>t._setLayout(e))}onCollectionChanged(e=wijmo_1.NotifyCollectionChangedEventArgs.reset){const t=this._layout;t&&t._onLayoutChanged();super.onCollectionChanged(e)}}exports.MultiRowCellCollection=MultiRowCellCollection;class _MultiRowLayout{constructor(e,t,o){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=o;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_dispose(){if(this._disposed)return;this._disposed=!0;const e=this._bindingGroups;e.forEach(e=>{e.cells._setLayout(null)});e._setLayout(null);this._bindingGroups=null}_onLayoutChanged(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()}_parseCellGroups(e){let t=this._grid,o=null,l=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{wijmo_1.assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")});o=e}else{o=new MultiRowCellCollection;for(let t=0;t<e.length;t++){let l=null;l=e[t]instanceof MultiRowCellGroup?e[t]:new MultiRowCellGroup(e[t]);o.push(l)}}o.forEach(e=>{e.openGroup()});for(let e=0,t=0;e<o.length;e++){let s=o[e];s._colstart=t;t+=s._colspanEff;l=Math.max(l,s._rowspanEff)}o.forEach(e=>{e.closeGroup(t,l)});this._rowsPerItem=l}else o=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(o);o.forEach(e=>{e.cells._setLayout(this)});o._setLayout(this);return o}_getMultiRowGroupHeaderRange(e){const t=this._rowsPerItem,o=new wijmo_grid_1.CellRange(0,0,t-1,0);for(let t=0;t<e.length;t++){const l=e[t];if(l._hasAggregates){0===t&&this._expandMultiRowGroupHeaderToAggregate(o,l);return o}o.col2=l._colstart+l._colspanEff-1}return o}_expandMultiRowGroupHeaderToAggregate(e,t){const o=this._rowsPerItem,l=t._colspanEff,s=t.cells.filter(e=>e.col>0&&0!=e.aggregate).map(e=>e.col).reduce((e,t)=>t<e?t:e,l);e.col2=Math.max(t._colstart+s-1,e.col2);for(let i=s;i<l;i++){let l=!0;for(let e=0;e<o;e++){const o=t._getCellRange(e,i);l=l&&o.col===i}if(l){e.col2=Math.max(t._colstart+i-1,e.col2);return}}}_getSingleRowGroupHeaderRange(e,t,o){const l=this._bindingGroups;if(0===l.length)return null;let s=this._getGroupByColumn(o);wijmo_1.assert(null!=s,"Failed to get the group!");let i=s._getCellRange(0,o-s._colstart);const r=new wijmo_grid_1.CellRange(t,s._colstart+i.col,t,s._colstart+i.col2);if(0!=s.getBindingColumn(e,t,o).aggregate)return r;const n=l[0]._colstart;for(let l=o-1;l>=n;l--){const o=this._getGroupByColumn(l);wijmo_1.assert(null!=o,"Failed to get the group!");if(0!=o.getBindingColumn(e,t,l).aggregate)break;i=o._getCellRange(0,l-o._colstart);r.col=o._colstart+i.col}const a=l[l.length-1],_=a._colstart+a._colspanEff;for(let l=o+1;l<_;l++){const o=this._getGroupByColumn(l);wijmo_1.assert(null!=o,"Failed to get the group!");if(0!=o.getBindingColumn(e,t,l).aggregate)break;i=o._getCellRange(0,l-o._colstart);r.col2=o._colstart+i.col2}return r}_getGroupHeaderMergedRange(e,t,o,l){if(l){const l=this._multiRowGroupHeaderRange;if(l.containsColumn(o)){const e=this._rowsPerItem,o=Math.floor(t/e)*e;return new wijmo_grid_1.CellRange(o+l.row,l.col,o+l.row2,l.col2)}const s=this._getGroupByColumn(o);wijmo_1.assert(s instanceof MultiRowCellGroup,"Failed to get the group!");return s.getMergedRange(e,t,o)}return this._getSingleRowGroupHeaderRange(e,t,o)}_getGroupByColumn(e){let t=this._groupsByColumn[e];if(!t){let o=this._bindingGroups;for(let l=0;l<o.length;l++)if(e>=(t=o[l])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}}return t}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._cols.forEach(t=>{null==t.dataType&&t._binding&&(t.dataType=wijmo_1.getType(t._binding.getValue(e)));if(!t.isReadOnly){let o=wijmo_1.isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=o&&!o.writable&&!o.set}})})}}exports._MultiRowLayout=_MultiRowLayout;class MultiRowCell 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){const t=wijmo_1.asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}}get col(){return this._col}set col(e){const t=wijmo_1.asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}}get colspan(){return this._colspan}set colspan(e){const t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}}get rowspan(){return this._rowspan}set rowspan(e){const t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}}_setLayout(e){this._layout=e}_onLayoutPropertyChanged(){const e=this._layout;e&&e._onLayoutChanged()}}exports.MultiRowCell=MultiRowCell;class MultiRowCellGroup extends MultiRowCell{constructor(e){super();this._isRowHeader=!1;this._colstart=0;this._cells=new MultiRowCellCollection;wijmo_1.copy(this,e)}_copy(e,t){if("cells"==e){wijmo_1.isArray(t)&&(this._cellsDef=t);return!0}return!1}get cells(){return this._cells}get isRowHeader(){return this._isRowHeader}set isRowHeader(e){const t=wijmo_1.asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}}openGroup(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()}closeGroup(e,t){if(t>this._rowspanEff){this._cells.forEach(e=>{e.row==this._rowspanEff-1&&(e._rowspanEff=t-e.row)});this._rowspanEff=t}this._cells.forEach(e=>{for(;e.col+e._colspanEff<this._colspanEff&&!this._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++});this._cells.forEach(e=>{for(;e.row+e._rowspanEff<this._rowspanEff&&!this._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++});if(this._cells.length>0)for(let e=0;e<this._rowspanEff;e++)for(let t=0;t<this._colspanEff;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach(e=>{for(let t=0;t<e._rowspanEff;t++)for(let o=0;o<e._colspanEff;o++){let l=(e.row+t)*this._colspanEff+e.col+o;this._cols.setAt(l,e);let s=new wijmo_grid_1.CellRange(0-t,0-o,0-t+e._rowspanEff-1,0-o+e._colspanEff-1);s.isSingleCell||(this._rng[l]=s)}});let o=this._colstart;this._rng[-1]=new wijmo_grid_1.CellRange(0,o,0,o+this._colspanEff-1);this._hasAggregates=!1;for(let e=0;e<this._cells.length&&!this._hasAggregates;e++)this._hasAggregates=0!=this._cells[e].aggregate}getColumnWidth(e){for(let t=0;t<this._cells.length;t++){let o=this._cells[t];if(o.col==e&&1==o._colspanEff)return o.width}return null}getMergedRange(e,t,o){if(t<0)return this._rng[-1];let l=e.rows[t],s=null!=l.recordIndex?l.recordIndex:t%this._rowspanEff,i=o-this._colstart,r=this._rng[s*this._colspanEff+i];e.cellType==wijmo_grid_1.CellType.ColumnHeader&&t++;return r?new wijmo_grid_1.CellRange(t+r.row,o+r.col,t+r.row2,o+r.col2):null}getBindingColumn(e,t,o){if(t<0)return this;let l=e.rows[t],s=l&&null!=l.recordIndex?l.recordIndex:t%this._rowspanEff,i=o-this._colstart;return this._cols[s*this._colspanEff+i]}getColumn(e){return this._cols.getColumn(e)}_getCellRange(e,t){let o=this._rng[e*this._colspanEff+t];return o?new wijmo_grid_1.CellRange(e+o.row,t+o.col,e+o.row2,t+o.col2):new wijmo_grid_1.CellRange(e,t)}_parseCells(e){let t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{wijmo_1.assert(e instanceof MultiRowCell,"cells contain items of invalid type")});t=e}else e.forEach(e=>{let o=null;o=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(o)});t.forEach(e=>{e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding))})}return t}_clearCalculations(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach(e=>{e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0})}_calculate(){this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach(e=>{this._colspanEff=Math.max(this._colspanEff,e.colspan);e._colspanEff=e.colspan;e._rowspanEff=e.rowspan});let e=0,t=0;this._cells.forEach((o,l)=>{for(;!this._cellFits(o,l,e,t);)0==(t=(t+1)%this._colspanEff)&&e++;o.row=e;o.col=t});let o=1,l=1;this._cells.forEach(e=>{o=Math.max(o,e.row+e._rowspanEff);l=Math.max(l,e.col+e._colspanEff)});this._rowspanEff=o;this._colspanEff=l}_cellFits(e,t,o,l){if(l>0&&l+e._colspanEff>this._colspanEff)return!1;for(let s=0;s<e._colspanEff;s++)if(this._slotTaken(o,l+s,t))return!1;this._colspanEff=Math.max(this._colspanEff,l+e._colspanEff-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._rowspanEff-1&&t>=o.col&&t<=o.col+o._colspanEff-1)return!0}return!1}}exports.MultiRowCellGroup=MultiRowCellGroup;class MultiRow extends wijmo_grid_1.FlexGrid{constructor(e,t){super(e);this._hdrLayoutDef=null;this._centerVert=!0;this._collapsedHeaders=!1;this._multiRowGroupHeaders=!1;this._rowHdrCnt=0;this.collapsedHeadersChanging=new wijmo_1.Event;this.collapsedHeadersChanged=new wijmo_1.Event;this._layoutDef=new MultiRowCellCollection;this._layout=new _MultiRowLayout(this,this._layoutDef,()=>this._onLayoutChanged());wijmo_1.addClass(this.hostElement,"wj-multirow");let o=this.columnHeaders.hostElement.parentElement,l=wijmo_1.createElement('<div class="wj-hdr-collapse"><span></span></div>');l.style.display="none";o.appendChild(l);this._btnCollapse=l;this._updateButtonGlyph();this.addEventListener(l,"mousedown",e=>{switch(this.collapsedHeaders){case null:case!1:this._collapsedHeadersWasNull=null==this.collapsedHeaders;this.collapsedHeaders=!0;break;case!0:this.collapsedHeaders=!!this._collapsedHeadersWasNull&&null}e.preventDefault();this.focus()},!0);let s=this.hostElement;this.addEventListener(s,"mousedown",e=>{if(!this._mouseHdl._szRowCol){let t=this._layout?this._layout._bindingGroups:null,o=t&&t.length?t[0]:null;if(o&&o.isRowHeader){let t=this.hitTest(e);if(t.panel==this.columnHeaders&&t.col<this.columns.frozen){e.preventDefault();this.selectAll()}}}},!0);["dragover","dragleave","dragdrop"].forEach(e=>{this.removeEventListener(s,e)});this._edtHdl=new _MultiRowEditHandler(this);this._addHdl=new _MultiRowAddNewHandler(this);this.formatItem.addHandler(this._formatItem,this);this.autoGenerateColumns=!1;this.allowDragging=wijmo_grid_1.AllowDragging.None;this.mergeManager=new _MergeManager;this.initialize(t)}_getProductInfo(){return"H87K,MultiRow"}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this.finishEditing()||this.finishEditing(!0);this._layoutDef=wijmo_1.asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,()=>this._onLayoutChanged());this._rowHdrCnt=0;if(this._layout){let e=this._layout._bindingGroups;for(let t=0;t<e.length;t++){let o=e[t];if(!o.isRowHeader)break;this._rowHdrCnt=o._colstart+o._colspanEff;o.cells.forEach(e=>{e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"})}}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)}get recordViewRange(){const e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return Object.assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})}get headerLayoutDefinition(){return this._hdrLayoutDef}set headerLayoutDefinition(e){this._hdrLayoutDef=wijmo_1.asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}let t=null;e&&(t=new _MultiRowLayout(this,e,()=>this._onHeaderLayoutChanged()));this._hdrLayout=t;this._bindGrid(!0)}get rowsPerItem(){return this._layout._rowsPerItem}getBindingColumn(e,t,o){return this._getBindingColumn(e,t,e.columns[o])}getColumn(e,t){if(wijmo_1.isString(e)){let o=t&&this._hdrLayout,l=(o?this._hdrLayout:this._layout)._bindingGroups,s=null;for(let t=0;t<l.length&&!s;t++)s=l[t].getColumn(e);return!s&&o?this.getColumn(e,!1):s}return super.getColumn(e)}get centerHeadersVertically(){return this._centerVert}set centerHeadersVertically(e){if(e!=this._centerVert){this._centerVert=wijmo_1.asBoolean(e);this.invalidate()}}get collapsedHeaders(){return this._collapsedHeaders}set collapsedHeaders(e){if(e!=this._collapsedHeaders){let t=new wijmo_1.CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=wijmo_1.asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}}get showHeaderCollapseButton(){return""==this._btnCollapse.style.display}set showHeaderCollapseButton(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=wijmo_1.asBoolean(e)?"":"none")}get multiRowGroupHeaders(){return this._multiRowGroupHeaders}set multiRowGroupHeaders(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=wijmo_1.asBoolean(e);this._bindGrid(!0)}}onCollapsedHeadersChanging(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel}onCollapsedHeadersChanged(e){this.collapsedHeadersChanged.raise(this,e)}get allowPinning(){return!1}set allowPinning(e){wijmo_1.assert(!e,"MultiRow does not support pinning.")}onSelectionChanging(e){let t=e._rng;if(t&&t.isValid&&this.selectionMode){let e=this._mouseHdl._htDown,o=this.rows,l=this.columns,s=this._rowHdrCnt;if(s){t.col=Math.max(t.col,s);t.col2=Math.max(t.col2,s)}if(e&&(e.panel==this.rowHeaders||e.panel==this.cells&&e.col<s)){let e=o[t.topRow],s=o[t.bottomRow];if(e&&null!=e.recordIndex){let o=e.index-e.recordIndex,i=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,r=s.index-s.recordIndex+i-1,n=l.length-1,a=t.row!=t.topRow?new wijmo_grid_1.CellRange(r,0,o,n):new wijmo_grid_1.CellRange(o,0,r,n);t.row=a.row;t.row2=a.row2;t.col2=n;switch(this.selectionMode){case wijmo_grid_1.SelectionMode.Cell:t.row2=a.row;t.col2=a.col;break;case wijmo_grid_1.SelectionMode.Row:t.row2=a.row}}}}return super.onSelectionChanging(e)}_createSelHdl(){return new _MultiRowSelectionHandler(this)}_getDeleteColumnIndex(){return this._rowHdrCnt}_getQuickAutoSize(){return wijmo_1.isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter}_addBoundRow(e,t){let o=e[t];for(let e=0;e<this.rowsPerItem;e++)this.rows.push(new _MultiRow(o,t,e))}_addNode(e,t,o){this._addBoundRow(e,t)}_addGroupRow(e){let t=this._multiRowGroupHeaders?this.rowsPerItem:1;for(let o=0;o<t;o++)this.rows.push(new _MultiGroupRow(e,o))}_bindColumns(){let e=this.columnHeaders.rows,t=this._layout,o=this._hdrLayout,l=(o?o._rowsPerItem:this.rowsPerItem)+1;for(;e.length>l;)e.removeAt(e.length-1);for(;e.length<l;)e.push(new wijmo_grid_1.Row);this._updateCollapsedHeaders();this.columns.clear();if(t&&t._bindingGroups){let e="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");t._bindingGroups.forEach(t=>{for(let o=0;o<t._colspanEff;o++){if(0===t.cells.length)continue;let l=new wijmo_grid_1.Column;for(let s=0;s<t.cells.length;s++){let i=t.cells[s];i.col==o&&e.forEach(e=>{null!=i[e]&&i[e]!=l[e]&&(l[e]=i[e])})}this.columns.push(l)}})}}_updateCollapsedHeaders(){let e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(let o=1;o<e.length;o++)e[o].visible=1!=t}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(wijmo_1.hasItems(e)){let t=e.items[0];this._layout&&this._layout._updateCellTypes(t);this._hdrLayout&&this._hdrLayout._updateCellTypes(t)}}_getBindingColumn(e,t,o){if(o&&(e==this.cells||e==this.columnHeaders)){let l=e.cellType==wijmo_grid_1.CellType.ColumnHeader;l&&t--;o=this._getGroupByColumn(o.index,l).getBindingColumn(e,t,o.index)}return o}_getBindingColumns(){let e=[];this._layout._bindingGroups.forEach(t=>{t._cols.forEach(t=>{e.indexOf(t)<0&&e.push(t)})});return e}_getRowsPerItem(){return this.rowsPerItem}_cvCollectionChanged(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{let e=wijmo_1.NotifyCollectionChangedAction;switch(t.action){case e.Change:this.invalidate();break;case e.Add:if(t.index==this.collectionView.items.length-1){let e=this.rows.length;for(;e>0&&this.rows[e-1]instanceof wijmo_grid_1._NewRowTemplate;)e--;for(let o=0;o<this.rowsPerItem;o++)this.rows.insert(e+o,new _MultiRow(t.item,t.index,o));return}wijmo_1.assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}}_getGroupByColumn(e,t){let o=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(o=this._hdrLayout._getGroupByColumn(e));o||(o=this._layout._getGroupByColumn(e));wijmo_1.assert(o instanceof MultiRowCellGroup,"Failed to get the group!");return o}_onLayoutChanged(){this.layoutDefinition=this._layoutDef}_onHeaderLayoutChanged(){this.headerLayoutDefinition=this._hdrLayoutDef}_formatItem(e,t){let o=this.rowsPerItem,l=t.panel,s=l.cellType,i=l.rows[t.range.row],r=l.rows[t.range.row2],n=t.cell,a=wijmo_grid_1.CellType;s==a.ColumnHeader&&wijmo_1.toggleClass(n,"wj-group-header",0==t.range.row);if(s==a.Cell||s==a.ColumnHeader){let e=this._getGroupByColumn(t.col,s==a.ColumnHeader);wijmo_1.toggleClass(n,"wj-group-start",e._colstart==t.range.col);wijmo_1.toggleClass(n,"wj-group-end",e._colstart+e._colspanEff-1==t.range.col2)}if(o>1&&(s==a.Cell||s==a.RowHeader)){let e=i instanceof _MultiRow||i instanceof _MultiRowNewRowTemplate,t=r instanceof _MultiRow||r instanceof _MultiRowNewRowTemplate;wijmo_1.toggleClass(n,"wj-record-start",!!e&&0==i.recordIndex);wijmo_1.toggleClass(n,"wj-record-end",!!t&&r.recordIndex==o-1)}let _=this.alternatingRowStep;if(_){let e=!1;if(i instanceof _MultiRow){e=i.dataIndex%(_+1)==0;1==_&&(e=!e)}wijmo_1.toggleClass(n,"wj-alt",e)}if(this._centerVert&&!n.getAttribute("wj-state-measuring")){let e=t.range.rowSpan>1;if(e&&t.updateContent)if(0==n.childElementCount)n.innerHTML="<div>"+n.innerHTML+"</div>";else{let e=document.createElement("div"),t=document.createRange();t.selectNodeContents(n);t.surroundContents(e)}wijmo_1.toggleClass(n,"wj-center-vert",e)}}_updateButtonGlyph(){let e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")}_getError(e,t,o,l){if(wijmo_1.isFunction(this.itemValidator)&&e==this.rowHeaders){let e=[];for(let s=0;s<this.rowsPerItem;s++)for(o=0;o<this.columns.length;o++){let i=this.itemValidator(t+s,o,l);if(i){let l=this.getMergedRange(this.cells,t+s,o);l&&(l.columnSpan>1&&l.col<o||l.rowSpan>1&&l.row<t+s)||e.push(i)}}if(e.length){let t=this.errorTip,o=!!t&&t.isContentHtml;return e.join(o?"<br/>":"\n")}}return super._getError(e,t,o,l)}_getEmptyRequiredCell(e){if(e>=0){e-=this.rows[e].recordIndex;for(let t=0;t<this._getRowsPerItem();t++){let o=e+t;for(let e=0;e<this.columns.length;e++){let t=this._getBindingColumn(this.cells,o,this.columns[e]),l=this.getCellData(o,e,!1);if(t.getIsRequired(this.rows[o])&&(""===l||null==l)){if(!t.isReadOnly)return new wijmo_grid_1.CellRange(o,e);console.warn(`Incorrect data. Column ${e} is at the same time required, empty and read-only`)}}}}return null}}exports.MultiRow=MultiRow;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,l=!0){let s=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:if(e.rows[t]instanceof wijmo_grid_1.GroupRow&&!s.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,o,l,!1)}switch(e.cellType){case wijmo_grid_1.CellType.Cell:if(e.rows[t]instanceof wijmo_grid_1.GroupRow)return this._getGroupRowMergedRange(e,t,o,l,s.multiRowGroupHeaders);case wijmo_grid_1.CellType.ColumnHeader:let i=e.cellType==wijmo_grid_1.CellType.ColumnHeader,r=s._getGroupByColumn(o,i);wijmo_1.assert(r instanceof MultiRowCellGroup,"Failed to get the group!");let n=i?r.getMergedRange(e,t-1,o):r.getMergedRange(e,t,o),a=e.columns.frozen;if(a&&n&&n.columnSpan>1&&n.col<a&&n.col2>=a){n=n.clone();o<a?n.col2=a-1:n.col=a}let _=e.rows.frozen;if(_&&n&&n.rowSpan>1&&e.cellType==wijmo_grid_1.CellType.Cell&&n.row<_&&n.row2>=_){n=n.clone();t<_?n.row2=_-1:n.row=_}wijmo_1.assert(!n||n.contains(t,o),"Merged range must contain source cell");return n;case wijmo_grid_1.CellType.RowHeader:let h=s.rowsPerItem,d=t-e.rows[t].recordIndex,u=Math.min(d+h-1,e.rows.length-1);return new wijmo_grid_1.CellRange(d,0,u,e.columns.length-1);case wijmo_grid_1.CellType.TopLeft:const w=s.collapsedHeaders,c=e.rows.length-1,g=c>0?1:0,p=0!=w?0:g,f=1!=w?c:g;return new wijmo_grid_1.CellRange(p,0,f,e.columns.length-1)}return null}_getGroupRowMergedRange(e,t,o,l=!0,s){let i=e.grid,r=e.cellType,n=e.rows[t];if(i.showGroups&&!i.childItemsPath&&n instanceof _MultiGroupRow&&n.dataItem instanceof wijmo_1.CollectionViewGroup&&r==wijmo_grid_1.CellType.Cell){return i._layout._getGroupHeaderMergedRange(e,t,o,s)}return super.getMergedRange(e,t,o,l)}}exports._MergeManager=_MergeManager;class _MultiRowAddNewHandler extends wijmo_grid_1._AddNewHandler{constructor(e){e._addHdl._detach();super(e)}updateNewRowTemplate(){let e=this._g.editableCollectionView,t=this._g,o=t.rows,l=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,s=-1;for(let e=0;e<o.length;e+=t.rowsPerItem)if(o[e]instanceof _MultiRowNewRowTemplate){s=e;break}if(l&&s>-1&&(this._top&&s>0||!this._top&&0==s)){s=-1;this._removeNewRowTemplate()}if(l&&s<0)for(let e=0;e<t.rowsPerItem;e++){let t=new _MultiRowNewRowTemplate(e);0==e&&(this._nrt=t);this._top?o.insert(e,t):o.push(t)}!l&&s>-1&&this._removeNewRowTemplate()}_keydown(e){super._keydown(e);e.defaultPrevented||e.keyCode!=wijmo_1.Key.Escape||this._copyNewDataItem()}_beginningEdit(e,t){super._beginningEdit(e,t);this._top&&this._copyNewDataItem()}_rowEditStarting(e,t){super._rowEditStarting(e,t);this._top&&this._copyNewDataItem()}_rowEditEnded(e,t){super._rowEditEnded(e,t);this._copyNewDataItem()}_copyNewDataItem(){if(this._top){let e=this._g,t=e.rows;for(let o=0;o<e.rowsPerItem;o++)t[o]instanceof wijmo_grid_1._NewRowTemplate&&(t[o].dataItem=this._nrt.dataItem)}}_removeNewRowTemplate(){for(let e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof wijmo_grid_1._NewRowTemplate){t.removeAt(e);e--}}}exports._MultiRowAddNewHandler=_MultiRowAddNewHandler;class _MultiRowNewRowTemplate extends wijmo_grid_1._NewRowTemplate{constructor(e){super();this._idxRecord=e}get recordIndex(){return this._idxRecord}}exports._MultiRowNewRowTemplate=_MultiRowNewRowTemplate;wijmo_1._registerModule("wijmo.grid.multirow",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.multirow"));class _MultiRowSelectionHandler extends wijmo_grid_1._SelectionHandler{_getNextColumnCell(e,t,o,l=0){const s=this._g,i=s.cells,r=s.columns,n=wijmo_grid_1.SelMove;switch(o){case n.NextEditableCell:for(let o=t+1;o<r.length;o++){let t=s._getBindingColumn(i,e,r[o]);if(t.renderSize>0&&!t.isReadOnly)return o}return t;case n.PrevEditableCell:for(let o=t-1;o>=0;o--){let t=s._getBindingColumn(i,e,r[o]);if(t.renderSize>0&&!t.isReadOnly)return o}return t}return super._getNextColumnCell(e,t,o,l)}}exports._MultiRowSelectionHandler=_MultiRowSelectionHandler;class _MultiRow extends wijmo_grid_1.Row{constructor(e,t,o){super(e);this._idxData=t;this._idxRecord=o}get recordIndex(){return this._idxRecord}}exports._MultiRow=_MultiRow;class _MultiGroupRow extends wijmo_grid_1.GroupRow{constructor(e,t){super(e);this._idxRecord=t}get recordIndex(){return this._idxRecord}get hasChildren(){return!0}getCellRange(){let e=this._getLastRowInHeader();return e!=this?e.getCellRange():super.getCellRange()}get isCollapsed(){return this._getLastRowInHeader()._getFlag(wijmo_grid_1.RowColFlags.Collapsed)}set isCollapsed(e){let t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(wijmo_1.asBoolean(e))}_setCollapsed(e){let t=this.grid,o=t.rows,l=this.getCellRange(),s=new wijmo_grid_1.CellRangeEventArgs(t.cells,new wijmo_grid_1.CellRange(this.index,-1));if(t.onGroupCollapsedChanging(s)){t.deferUpdate(()=>{o.deferUpdate(()=>{this._setFlag(wijmo_grid_1.RowColFlags.Collapsed,e,!0);for(let t=l.topRow+1;t<=l.bottomRow&&t>-1&&t<o.length;t++){o[t]._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);let l=o[t];if(l instanceof _MultiGroupRow){let s=l._getLastRowInHeader();for(t+=1;t<=s.index;t++)(l=o[t])._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);t--}l instanceof wijmo_grid_1.GroupRow&&l.isCollapsed&&(t=l.getCellRange().bottomRow)}})});t.onGroupCollapsedChanged(s)}}_getLastRowInHeader(){let e=this.grid,t=this;if(e&&e.multiRowGroupHeaders){let o=e.rows,l=this.dataItem;for(let e=this.index+1;e<o.length&&o[e].dataItem==l;e++)t=o[e]}wijmo_1.assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t}}exports._MultiGroupRow=_MultiGroupRow;class _MultiRowEditHandler extends wijmo_grid_1._EditHandler{_selectionChanging(e){if(this.finishEditing()){let t=this._g._selHdl.selection.row;if(t!=e.row){let o=this._g.rows.length;if((t>-1&&t<o?this._g.rows[t].dataItem:null)!=(e.row>-1&&e.row<o?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){let o=!this._g.rows[t]||this._g.rows[t]&&Object.getPrototypeOf(this._g.rows[t])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(t);null!==o&&setTimeout(()=>{this._g.select(o);this.startEditing(!0,o.row,o.col,!0,e)})}}}}else e.cancel=!0}}exports._MultiRowEditHandler=_MultiRowEditHandler;class MultiRowCellCollection extends wijmo_1.ObservableArray{_setLayout(e){this._layout=e;this.forEach(t=>t._setLayout(e))}onCollectionChanged(e=wijmo_1.NotifyCollectionChangedEventArgs.reset){const t=this._layout;t&&t._onLayoutChanged();super.onCollectionChanged(e)}}exports.MultiRowCellCollection=MultiRowCellCollection;class _MultiRowLayout{constructor(e,t,o){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=o;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_dispose(){if(this._disposed)return;this._disposed=!0;const e=this._bindingGroups;e.forEach(e=>{e.cells._setLayout(null)});e._setLayout(null);this._bindingGroups=null}_onLayoutChanged(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()}_parseCellGroups(e){let t=this._grid,o=null,l=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{wijmo_1.assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")});o=e}else{o=new MultiRowCellCollection;for(let t=0;t<e.length;t++){let l=null;l=e[t]instanceof MultiRowCellGroup?e[t]:new MultiRowCellGroup(e[t]);o.push(l)}}o.forEach(e=>{e.openGroup()});for(let e=0,t=0;e<o.length;e++){let s=o[e];s._colstart=t;t+=s._colspanEff;l=Math.max(l,s._rowspanEff)}o.forEach(e=>{e.closeGroup(t,l)});this._rowsPerItem=l}else o=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(o);o.forEach(e=>{e.cells._setLayout(this)});o._setLayout(this);return o}_getMultiRowGroupHeaderRange(e){const t=this._rowsPerItem,o=new wijmo_grid_1.CellRange(0,0,t-1,0);for(let t=0;t<e.length;t++){const l=e[t];if(l._hasAggregates){0===t&&this._expandMultiRowGroupHeaderToAggregate(o,l);return o}o.col2=l._colstart+l._colspanEff-1}return o}_expandMultiRowGroupHeaderToAggregate(e,t){const o=this._rowsPerItem,l=t._colspanEff,s=t.cells.filter(e=>e.col>0&&0!=e.aggregate).map(e=>e.col).reduce((e,t)=>t<e?t:e,l);e.col2=Math.max(t._colstart+s-1,e.col2);for(let i=s;i<l;i++){let l=!0;for(let e=0;e<o;e++){const o=t._getCellRange(e,i);l=l&&o.col===i}if(l){e.col2=Math.max(t._colstart+i-1,e.col2);return}}}_getSingleRowGroupHeaderRange(e,t,o){const l=this._bindingGroups;if(0===l.length)return null;let s=this._getGroupByColumn(o);wijmo_1.assert(null!=s,"Failed to get the group!");let i=s._getCellRange(0,o-s._colstart);const r=new wijmo_grid_1.CellRange(t,s._colstart+i.col,t,s._colstart+i.col2);if(0!=s.getBindingColumn(e,t,o).aggregate)return r;const n=l[0]._colstart;for(let l=o-1;l>=n;l--){const o=this._getGroupByColumn(l);wijmo_1.assert(null!=o,"Failed to get the group!");if(0!=o.getBindingColumn(e,t,l).aggregate)break;i=o._getCellRange(0,l-o._colstart);r.col=o._colstart+i.col}const a=l[l.length-1],_=a._colstart+a._colspanEff;for(let l=o+1;l<_;l++){const o=this._getGroupByColumn(l);wijmo_1.assert(null!=o,"Failed to get the group!");const s=o.getBindingColumn(e,t,l);if(s&&0!=s.aggregate)break;i=o._getCellRange(0,l-o._colstart);r.col2=o._colstart+i.col2}return r}_getGroupHeaderMergedRange(e,t,o,l){if(l){const l=this._multiRowGroupHeaderRange;if(l.containsColumn(o)){const e=this._rowsPerItem,o=Math.floor(t/e)*e;return new wijmo_grid_1.CellRange(o+l.row,l.col,o+l.row2,l.col2)}const s=this._getGroupByColumn(o);wijmo_1.assert(s instanceof MultiRowCellGroup,"Failed to get the group!");return s.getMergedRange(e,t,o)}return this._getSingleRowGroupHeaderRange(e,t,o)}_getGroupByColumn(e){let t=this._groupsByColumn[e];if(!t){let o=this._bindingGroups;for(let l=0;l<o.length;l++)if(e>=(t=o[l])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}}return t}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._cols.forEach(t=>{null==t.dataType&&t._binding&&(t.dataType=wijmo_1.getType(t._binding.getValue(e)));if(!t.isReadOnly){let o=wijmo_1.isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=o&&!o.writable&&!o.set}})})}}exports._MultiRowLayout=_MultiRowLayout;class MultiRowCell 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){const t=wijmo_1.asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}}get col(){return this._col}set col(e){const t=wijmo_1.asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}}get colspan(){return this._colspan}set colspan(e){const t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}}get rowspan(){return this._rowspan}set rowspan(e){const t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}}_setLayout(e){this._layout=e}_onLayoutPropertyChanged(){const e=this._layout;e&&e._onLayoutChanged()}}exports.MultiRowCell=MultiRowCell;class MultiRowCellGroup extends MultiRowCell{constructor(e){super();this._isRowHeader=!1;this._colstart=0;this._cells=new MultiRowCellCollection;wijmo_1.copy(this,e)}_copy(e,t){if("cells"==e){wijmo_1.isArray(t)&&(this._cellsDef=t);return!0}return!1}get cells(){return this._cells}get isRowHeader(){return this._isRowHeader}set isRowHeader(e){const t=wijmo_1.asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}}openGroup(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()}closeGroup(e,t){if(t>this._rowspanEff){this._cells.forEach(e=>{e.row==this._rowspanEff-1&&(e._rowspanEff=t-e.row)});this._rowspanEff=t}this._cells.forEach(e=>{for(;e.col+e._colspanEff<this._colspanEff&&!this._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++});this._cells.forEach(e=>{for(;e.row+e._rowspanEff<this._rowspanEff&&!this._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++});if(this._cells.length>0)for(let e=0;e<this._rowspanEff;e++)for(let t=0;t<this._colspanEff;t++)wijmo_1.assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach(e=>{for(let t=0;t<e._rowspanEff;t++)for(let o=0;o<e._colspanEff;o++){let l=(e.row+t)*this._colspanEff+e.col+o;this._cols.setAt(l,e);let s=new wijmo_grid_1.CellRange(0-t,0-o,0-t+e._rowspanEff-1,0-o+e._colspanEff-1);s.isSingleCell||(this._rng[l]=s)}});let o=this._colstart;this._rng[-1]=new wijmo_grid_1.CellRange(0,o,0,o+this._colspanEff-1);this._hasAggregates=!1;for(let e=0;e<this._cells.length&&!this._hasAggregates;e++)this._hasAggregates=0!=this._cells[e].aggregate}getColumnWidth(e){for(let t=0;t<this._cells.length;t++){let o=this._cells[t];if(o.col==e&&1==o._colspanEff)return o.width}return null}getMergedRange(e,t,o){if(t<0)return this._rng[-1];let l=e.rows[t],s=null!=l.recordIndex?l.recordIndex:t%this._rowspanEff,i=o-this._colstart,r=this._rng[s*this._colspanEff+i];e.cellType==wijmo_grid_1.CellType.ColumnHeader&&t++;return r?new wijmo_grid_1.CellRange(t+r.row,o+r.col,t+r.row2,o+r.col2):null}getBindingColumn(e,t,o){if(t<0)return this;let l=e.rows[t],s=l&&null!=l.recordIndex?l.recordIndex:t%this._rowspanEff,i=o-this._colstart;return this._cols[s*this._colspanEff+i]}getColumn(e){return this._cols.getColumn(e)}_getCellRange(e,t){let o=this._rng[e*this._colspanEff+t];return o?new wijmo_grid_1.CellRange(e+o.row,t+o.col,e+o.row2,t+o.col2):new wijmo_grid_1.CellRange(e,t)}_parseCells(e){let t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{wijmo_1.assert(e instanceof MultiRowCell,"cells contain items of invalid type")});t=e}else e.forEach(e=>{let o=null;o=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(o)});t.forEach(e=>{e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding))})}return t}_clearCalculations(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach(e=>{e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0})}_calculate(){this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach(e=>{this._colspanEff=Math.max(this._colspanEff,e.colspan);e._colspanEff=e.colspan;e._rowspanEff=e.rowspan});let e=0,t=0;this._cells.forEach((o,l)=>{for(;!this._cellFits(o,l,e,t);)0==(t=(t+1)%this._colspanEff)&&e++;o.row=e;o.col=t});let o=1,l=1;this._cells.forEach(e=>{o=Math.max(o,e.row+e._rowspanEff);l=Math.max(l,e.col+e._colspanEff)});this._rowspanEff=o;this._colspanEff=l}_cellFits(e,t,o,l){if(l>0&&l+e._colspanEff>this._colspanEff)return!1;for(let s=0;s<e._colspanEff;s++)if(this._slotTaken(o,l+s,t))return!1;this._colspanEff=Math.max(this._colspanEff,l+e._colspanEff-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._rowspanEff-1&&t>=o.col&&t<=o.col+o._colspanEff-1)return!0}return!1}}exports.MultiRowCellGroup=MultiRowCellGroup;class MultiRow extends wijmo_grid_1.FlexGrid{constructor(e,t){super(e);this._hdrLayoutDef=null;this._centerVert=!0;this._collapsedHeaders=!1;this._multiRowGroupHeaders=!1;this._rowHdrCnt=0;this.collapsedHeadersChanging=new wijmo_1.Event;this.collapsedHeadersChanged=new wijmo_1.Event;this._layoutDef=new MultiRowCellCollection;this._layout=new _MultiRowLayout(this,this._layoutDef,()=>this._onLayoutChanged());wijmo_1.addClass(this.hostElement,"wj-multirow");let o=this.columnHeaders.hostElement.parentElement,l=wijmo_1.createElement('<div class="wj-hdr-collapse"><span></span></div>');l.style.display="none";o.appendChild(l);this._btnCollapse=l;this._updateButtonGlyph();this.addEventListener(l,"mousedown",e=>{switch(this.collapsedHeaders){case null:case!1:this._collapsedHeadersWasNull=null==this.collapsedHeaders;this.collapsedHeaders=!0;break;case!0:this.collapsedHeaders=!!this._collapsedHeadersWasNull&&null}e.preventDefault();this.focus()},!0);let s=this.hostElement;this.addEventListener(s,"mousedown",e=>{if(!this._mouseHdl._szRowCol){let t=this._layout?this._layout._bindingGroups:null,o=t&&t.length?t[0]:null;if(o&&o.isRowHeader){let t=this.hitTest(e);if(t.panel==this.columnHeaders&&t.col<this.columns.frozen){e.preventDefault();this.selectAll()}}}},!0);["dragover","dragleave","dragdrop"].forEach(e=>{this.removeEventListener(s,e)});this._edtHdl=new _MultiRowEditHandler(this);this._addHdl=new _MultiRowAddNewHandler(this);this.formatItem.addHandler(this._formatItem,this);this.autoGenerateColumns=!1;this.allowDragging=wijmo_grid_1.AllowDragging.None;this.mergeManager=new _MergeManager;this.initialize(t)}_getProductInfo(){return"H87K,MultiRow"}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this.finishEditing()||this.finishEditing(!0);this._layoutDef=wijmo_1.asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,()=>this._onLayoutChanged());this._rowHdrCnt=0;if(this._layout){let e=this._layout._bindingGroups;for(let t=0;t<e.length;t++){let o=e[t];if(!o.isRowHeader)break;this._rowHdrCnt=o._colstart+o._colspanEff;o.cells.forEach(e=>{e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"})}}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)}get recordViewRange(){const e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return Object.assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})}get headerLayoutDefinition(){return this._hdrLayoutDef}set headerLayoutDefinition(e){this._hdrLayoutDef=wijmo_1.asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}let t=null;e&&(t=new _MultiRowLayout(this,e,()=>this._onHeaderLayoutChanged()));this._hdrLayout=t;this._bindGrid(!0)}get rowsPerItem(){return this._layout._rowsPerItem}getBindingColumn(e,t,o){return this._getBindingColumn(e,t,e.columns[o])}getColumn(e,t){if(wijmo_1.isString(e)){let o=t&&this._hdrLayout,l=(o?this._hdrLayout:this._layout)._bindingGroups,s=null;for(let t=0;t<l.length&&!s;t++)s=l[t].getColumn(e);return!s&&o?this.getColumn(e,!1):s}return super.getColumn(e)}get centerHeadersVertically(){return this._centerVert}set centerHeadersVertically(e){if(e!=this._centerVert){this._centerVert=wijmo_1.asBoolean(e);this.invalidate()}}get collapsedHeaders(){return this._collapsedHeaders}set collapsedHeaders(e){if(e!=this._collapsedHeaders){let t=new wijmo_1.CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=wijmo_1.asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}}get showHeaderCollapseButton(){return""==this._btnCollapse.style.display}set showHeaderCollapseButton(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=wijmo_1.asBoolean(e)?"":"none")}get multiRowGroupHeaders(){return this._multiRowGroupHeaders}set multiRowGroupHeaders(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=wijmo_1.asBoolean(e);this._bindGrid(!0)}}onCollapsedHeadersChanging(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel}onCollapsedHeadersChanged(e){this.collapsedHeadersChanged.raise(this,e)}get allowPinning(){return!1}set allowPinning(e){wijmo_1.assert(!e,"MultiRow does not support pinning.")}onSelectionChanging(e){let t=e._rng;if(t&&t.isValid&&this.selectionMode){let e=this._mouseHdl._htDown,o=this.rows,l=this.columns,s=this._rowHdrCnt;if(s){t.col=Math.max(t.col,s);t.col2=Math.max(t.col2,s)}if(e&&(e.panel==this.rowHeaders||e.panel==this.cells&&e.col<s)){let e=o[t.topRow],s=o[t.bottomRow];if(e&&null!=e.recordIndex){let o=e.index-e.recordIndex,i=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,r=s.index-s.recordIndex+i-1,n=l.length-1,a=t.row!=t.topRow?new wijmo_grid_1.CellRange(r,0,o,n):new wijmo_grid_1.CellRange(o,0,r,n);t.row=a.row;t.row2=a.row2;t.col2=n;switch(this.selectionMode){case wijmo_grid_1.SelectionMode.Cell:t.row2=a.row;t.col2=a.col;break;case wijmo_grid_1.SelectionMode.Row:t.row2=a.row}}}}return super.onSelectionChanging(e)}_createSelHdl(){return new _MultiRowSelectionHandler(this)}_getDeleteColumnIndex(){return this._rowHdrCnt}_getQuickAutoSize(){return wijmo_1.isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter}_addBoundRow(e,t){let o=e[t];for(let e=0;e<this.rowsPerItem;e++)this.rows.push(new _MultiRow(o,t,e))}_addNode(e,t,o){this._addBoundRow(e,t)}_addGroupRow(e){let t=this._multiRowGroupHeaders?this.rowsPerItem:1;for(let o=0;o<t;o++)this.rows.push(new _MultiGroupRow(e,o))}_bindColumns(){let e=this.columnHeaders.rows,t=this._layout,o=this._hdrLayout,l=(o?o._rowsPerItem:this.rowsPerItem)+1;for(;e.length>l;)e.removeAt(e.length-1);for(;e.length<l;)e.push(new wijmo_grid_1.Row);this._updateCollapsedHeaders();this.columns.clear();if(t&&t._bindingGroups){let e="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");t._bindingGroups.forEach(t=>{for(let o=0;o<t._colspanEff;o++){if(0===t.cells.length)continue;let l=new wijmo_grid_1.Column;for(let s=0;s<t.cells.length;s++){let i=t.cells[s];i.col==o&&e.forEach(e=>{null!=i[e]&&i[e]!=l[e]&&(l[e]=i[e])})}this.columns.push(l)}})}}_updateCollapsedHeaders(){let e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(let o=1;o<e.length;o++)e[o].visible=1!=t}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(wijmo_1.hasItems(e)){let t=e.items[0];this._layout&&this._layout._updateCellTypes(t);this._hdrLayout&&this._hdrLayout._updateCellTypes(t)}}_getBindingColumn(e,t,o){if(o&&(e==this.cells||e==this.columnHeaders)){let l=e.cellType==wijmo_grid_1.CellType.ColumnHeader;l&&t--;o=this._getGroupByColumn(o.index,l).getBindingColumn(e,t,o.index)}return o}_getBindingColumns(){let e=[];this._layout._bindingGroups.forEach(t=>{t._cols.forEach(t=>{e.indexOf(t)<0&&e.push(t)})});return e}_getRowsPerItem(){return this.rowsPerItem}_cvCollectionChanged(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{let e=wijmo_1.NotifyCollectionChangedAction;switch(t.action){case e.Change:this.invalidate();break;case e.Add:if(t.index==this.collectionView.items.length-1){let e=this.rows.length;for(;e>0&&this.rows[e-1]instanceof wijmo_grid_1._NewRowTemplate;)e--;for(let o=0;o<this.rowsPerItem;o++)this.rows.insert(e+o,new _MultiRow(t.item,t.index,o));return}wijmo_1.assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}}_getGroupByColumn(e,t){let o=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(o=this._hdrLayout._getGroupByColumn(e));o||(o=this._layout._getGroupByColumn(e));wijmo_1.assert(o instanceof MultiRowCellGroup,"Failed to get the group!");return o}_onLayoutChanged(){this.layoutDefinition=this._layoutDef}_onHeaderLayoutChanged(){this.headerLayoutDefinition=this._hdrLayoutDef}_formatItem(e,t){let o=this.rowsPerItem,l=t.panel,s=l.cellType,i=l.rows[t.range.row],r=l.rows[t.range.row2],n=t.cell,a=wijmo_grid_1.CellType;s==a.ColumnHeader&&wijmo_1.toggleClass(n,"wj-group-header",0==t.range.row);if(s==a.Cell||s==a.ColumnHeader){let e=this._getGroupByColumn(t.col,s==a.ColumnHeader);wijmo_1.toggleClass(n,"wj-group-start",e._colstart==t.range.col);wijmo_1.toggleClass(n,"wj-group-end",e._colstart+e._colspanEff-1==t.range.col2)}if(o>1&&(s==a.Cell||s==a.RowHeader)){let e=i instanceof _MultiRow||i instanceof _MultiRowNewRowTemplate,t=r instanceof _MultiRow||r instanceof _MultiRowNewRowTemplate;wijmo_1.toggleClass(n,"wj-record-start",!!e&&0==i.recordIndex);wijmo_1.toggleClass(n,"wj-record-end",!!t&&r.recordIndex==o-1)}let _=this.alternatingRowStep;if(_){let e=!1;if(i instanceof _MultiRow){e=i.dataIndex%(_+1)==0;1==_&&(e=!e)}wijmo_1.toggleClass(n,"wj-alt",e)}if(this._centerVert&&!n.getAttribute("wj-state-measuring")){let e=t.range.rowSpan>1;if(e&&t.updateContent)if(0==n.childElementCount)n.innerHTML="<div>"+n.innerHTML+"</div>";else{let e=document.createElement("div"),t=document.createRange();t.selectNodeContents(n);t.surroundContents(e)}wijmo_1.toggleClass(n,"wj-center-vert",e)}}_updateButtonGlyph(){let e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")}_getError(e,t,o,l){if(wijmo_1.isFunction(this.itemValidator)&&e==this.rowHeaders){let e=[];for(let s=0;s<this.rowsPerItem;s++)for(o=0;o<this.columns.length;o++){let i=this.itemValidator(t+s,o,l);if(i){let l=this.getMergedRange(this.cells,t+s,o);l&&(l.columnSpan>1&&l.col<o||l.rowSpan>1&&l.row<t+s)||e.push(i)}}if(e.length){let t=this.errorTip,o=!!t&&t.isContentHtml;return e.join(o?"<br/>":"\n")}}return super._getError(e,t,o,l)}_getEmptyRequiredCell(e){if(e>=0){e-=this.rows[e].recordIndex;for(let t=0;t<this._getRowsPerItem();t++){let o=e+t;for(let e=0;e<this.columns.length;e++){let t=this._getBindingColumn(this.cells,o,this.columns[e]),l=this.getCellData(o,e,!1);if(t.getIsRequired(this.rows[o])&&(""===l||null==l)){if(!t.isReadOnly)return new wijmo_grid_1.CellRange(o,e);console.warn(`Incorrect data. Column ${e} is at the same time required, empty and read-only`)}}}}return null}}exports.MultiRow=MultiRow;class _MergeManager extends wijmo_grid_1.MergeManager{getMergedRange(e,t,o,l=!0){let s=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case wijmo_grid_1.CellType.Cell:case wijmo_grid_1.CellType.RowHeader:if(e.rows[t]instanceof wijmo_grid_1.GroupRow&&!s.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,o,l,!1)}switch(e.cellType){case wijmo_grid_1.CellType.Cell:if(e.rows[t]instanceof wijmo_grid_1.GroupRow)return this._getGroupRowMergedRange(e,t,o,l,s.multiRowGroupHeaders);case wijmo_grid_1.CellType.ColumnHeader:let i=e.cellType==wijmo_grid_1.CellType.ColumnHeader,r=s._getGroupByColumn(o,i);wijmo_1.assert(r instanceof MultiRowCellGroup,"Failed to get the group!");let n=i?r.getMergedRange(e,t-1,o):r.getMergedRange(e,t,o),a=e.columns.frozen;if(a&&n&&n.columnSpan>1&&n.col<a&&n.col2>=a){n=n.clone();o<a?n.col2=a-1:n.col=a}let _=e.rows.frozen;if(_&&n&&n.rowSpan>1&&e.cellType==wijmo_grid_1.CellType.Cell&&n.row<_&&n.row2>=_){n=n.clone();t<_?n.row2=_-1:n.row=_}wijmo_1.assert(!n||n.contains(t,o),"Merged range must contain source cell");return n;case wijmo_grid_1.CellType.RowHeader:let h=s.rowsPerItem,d=t-e.rows[t].recordIndex,u=Math.min(d+h-1,e.rows.length-1);return new wijmo_grid_1.CellRange(d,0,u,e.columns.length-1);case wijmo_grid_1.CellType.TopLeft:const w=s.collapsedHeaders,c=e.rows.length-1,g=c>0?1:0,p=0!=w?0:g,f=1!=w?c:g;return new wijmo_grid_1.CellRange(p,0,f,e.columns.length-1)}return null}_getGroupRowMergedRange(e,t,o,l=!0,s){let i=e.grid,r=e.cellType,n=e.rows[t];if(i.showGroups&&!i.childItemsPath&&n instanceof _MultiGroupRow&&n.dataItem instanceof wijmo_1.CollectionViewGroup&&r==wijmo_grid_1.CellType.Cell){return i._layout._getGroupHeaderMergedRange(e,t,o,s)}return super.getMergedRange(e,t,o,l)}}exports._MergeManager=_MergeManager;class _MultiRowAddNewHandler extends wijmo_grid_1._AddNewHandler{constructor(e){e._addHdl._detach();super(e)}updateNewRowTemplate(){let e=this._g.editableCollectionView,t=this._g,o=t.rows,l=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,s=-1;for(let e=0;e<o.length;e+=t.rowsPerItem)if(o[e]instanceof _MultiRowNewRowTemplate){s=e;break}if(l&&s>-1&&(this._top&&s>0||!this._top&&0==s)){s=-1;this._removeNewRowTemplate()}if(l&&s<0)for(let e=0;e<t.rowsPerItem;e++){let t=new _MultiRowNewRowTemplate(e);0==e&&(this._nrt=t);this._top?o.insert(e,t):o.push(t)}!l&&s>-1&&this._removeNewRowTemplate()}_keydown(e){super._keydown(e);e.defaultPrevented||e.keyCode!=wijmo_1.Key.Escape||this._copyNewDataItem()}_beginningEdit(e,t){super._beginningEdit(e,t);this._top&&this._copyNewDataItem()}_rowEditStarting(e,t){super._rowEditStarting(e,t);this._top&&this._copyNewDataItem()}_rowEditEnded(e,t){super._rowEditEnded(e,t);this._copyNewDataItem()}_copyNewDataItem(){if(this._top){let e=this._g,t=e.rows;for(let o=0;o<e.rowsPerItem;o++)t[o]instanceof wijmo_grid_1._NewRowTemplate&&(t[o].dataItem=this._nrt.dataItem)}}_removeNewRowTemplate(){for(let e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof wijmo_grid_1._NewRowTemplate){t.removeAt(e);e--}}}exports._MultiRowAddNewHandler=_MultiRowAddNewHandler;class _MultiRowNewRowTemplate extends wijmo_grid_1._NewRowTemplate{constructor(e){super();this._idxRecord=e}get recordIndex(){return this._idxRecord}}exports._MultiRowNewRowTemplate=_MultiRowNewRowTemplate;wijmo_1._registerModule("wijmo.grid.multirow",selfModule); |
/*! | ||
* | ||
* Wijmo Library 5.20241.001-nightly.d20240111.t020133 | ||
* Wijmo Library 5.20241.001-nightly.d20240112.t020133 | ||
* https://developer.mescius.com/wijmo | ||
@@ -14,2 +14,2 @@ * | ||
import{ObservableArray,NotifyCollectionChangedEventArgs,assert,asBoolean,copy,isArray,toHeaderCase,getType,isIE,asInt,Key,addClass,createElement,hasItems,asArray,toggleClass,isFunction,isString,isBoolean,Event,CancelEventArgs,CollectionViewGroup,NotifyCollectionChangedAction,_registerModule}from"@grapecity/wijmo";import{Row,GroupRow,CellRange,RowColFlags,CellRangeEventArgs,Column,ColumnCollection,CellType,FlexGrid,_AddNewHandler,_NewRowTemplate,SelMove,_SelectionHandler,_EditHandler,SelectionMode,AllowDragging,MergeManager}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.multirow";export class _MultiRowSelectionHandler extends _SelectionHandler{_getNextColumnCell(e,t,l,o=0){const s=this._g,r=s.cells,i=s.columns,n=SelMove;switch(l){case n.NextEditableCell:for(let l=t+1;l<i.length;l++){let t=s._getBindingColumn(r,e,i[l]);if(t.renderSize>0&&!t.isReadOnly)return l}return t;case n.PrevEditableCell:for(let l=t-1;l>=0;l--){let t=s._getBindingColumn(r,e,i[l]);if(t.renderSize>0&&!t.isReadOnly)return l}return t}return super._getNextColumnCell(e,t,l,o)}}export class _MultiRow extends Row{constructor(e,t,l){super(e);this._idxData=t;this._idxRecord=l}get recordIndex(){return this._idxRecord}}export class _MultiGroupRow extends GroupRow{constructor(e,t){super(e);this._idxRecord=t}get recordIndex(){return this._idxRecord}get hasChildren(){return!0}getCellRange(){let e=this._getLastRowInHeader();return e!=this?e.getCellRange():super.getCellRange()}get isCollapsed(){return this._getLastRowInHeader()._getFlag(RowColFlags.Collapsed)}set isCollapsed(e){let t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(asBoolean(e))}_setCollapsed(e){let t=this.grid,l=t.rows,o=this.getCellRange(),s=new CellRangeEventArgs(t.cells,new CellRange(this.index,-1));if(t.onGroupCollapsedChanging(s)){t.deferUpdate(()=>{l.deferUpdate(()=>{this._setFlag(RowColFlags.Collapsed,e,!0);for(let t=o.topRow+1;t<=o.bottomRow&&t>-1&&t<l.length;t++){l[t]._setFlag(RowColFlags.ParentCollapsed,e,!0);let o=l[t];if(o instanceof _MultiGroupRow){let s=o._getLastRowInHeader();for(t+=1;t<=s.index;t++)(o=l[t])._setFlag(RowColFlags.ParentCollapsed,e,!0);t--}o instanceof GroupRow&&o.isCollapsed&&(t=o.getCellRange().bottomRow)}})});t.onGroupCollapsedChanged(s)}}_getLastRowInHeader(){let e=this.grid,t=this;if(e&&e.multiRowGroupHeaders){let l=e.rows,o=this.dataItem;for(let e=this.index+1;e<l.length&&l[e].dataItem==o;e++)t=l[e]}assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t}}export class _MultiRowEditHandler extends _EditHandler{_selectionChanging(e){if(this.finishEditing()){let t=this._g._selHdl.selection.row;if(t!=e.row){let l=this._g.rows.length;if((t>-1&&t<l?this._g.rows[t].dataItem:null)!=(e.row>-1&&e.row<l?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){let l=!this._g.rows[t]||this._g.rows[t]&&Object.getPrototypeOf(this._g.rows[t])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(t);null!==l&&setTimeout(()=>{this._g.select(l);this.startEditing(!0,l.row,l.col,!0,e)})}}}}else e.cancel=!0}}export class MultiRowCellCollection extends ObservableArray{_setLayout(e){this._layout=e;this.forEach(t=>t._setLayout(e))}onCollectionChanged(e=NotifyCollectionChangedEventArgs.reset){const t=this._layout;t&&t._onLayoutChanged();super.onCollectionChanged(e)}}export class _MultiRowLayout{constructor(e,t,l){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=l;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_dispose(){if(this._disposed)return;this._disposed=!0;const e=this._bindingGroups;e.forEach(e=>{e.cells._setLayout(null)});e._setLayout(null);this._bindingGroups=null}_onLayoutChanged(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()}_parseCellGroups(e){let t=this._grid,l=null,o=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")});l=e}else{l=new MultiRowCellCollection;for(let t=0;t<e.length;t++){let o=null;o=e[t]instanceof MultiRowCellGroup?e[t]:new MultiRowCellGroup(e[t]);l.push(o)}}l.forEach(e=>{e.openGroup()});for(let e=0,t=0;e<l.length;e++){let s=l[e];s._colstart=t;t+=s._colspanEff;o=Math.max(o,s._rowspanEff)}l.forEach(e=>{e.closeGroup(t,o)});this._rowsPerItem=o}else l=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(l);l.forEach(e=>{e.cells._setLayout(this)});l._setLayout(this);return l}_getMultiRowGroupHeaderRange(e){const t=this._rowsPerItem,l=new CellRange(0,0,t-1,0);for(let t=0;t<e.length;t++){const o=e[t];if(o._hasAggregates){0===t&&this._expandMultiRowGroupHeaderToAggregate(l,o);return l}l.col2=o._colstart+o._colspanEff-1}return l}_expandMultiRowGroupHeaderToAggregate(e,t){const l=this._rowsPerItem,o=t._colspanEff,s=t.cells.filter(e=>e.col>0&&0!=e.aggregate).map(e=>e.col).reduce((e,t)=>t<e?t:e,o);e.col2=Math.max(t._colstart+s-1,e.col2);for(let r=s;r<o;r++){let o=!0;for(let e=0;e<l;e++){const l=t._getCellRange(e,r);o=o&&l.col===r}if(o){e.col2=Math.max(t._colstart+r-1,e.col2);return}}}_getSingleRowGroupHeaderRange(e,t,l){const o=this._bindingGroups;if(0===o.length)return null;let s=this._getGroupByColumn(l);assert(null!=s,"Failed to get the group!");let r=s._getCellRange(0,l-s._colstart);const i=new CellRange(t,s._colstart+r.col,t,s._colstart+r.col2);if(0!=s.getBindingColumn(e,t,l).aggregate)return i;const n=o[0]._colstart;for(let o=l-1;o>=n;o--){const l=this._getGroupByColumn(o);assert(null!=l,"Failed to get the group!");if(0!=l.getBindingColumn(e,t,o).aggregate)break;r=l._getCellRange(0,o-l._colstart);i.col=l._colstart+r.col}const a=o[o.length-1],h=a._colstart+a._colspanEff;for(let o=l+1;o<h;o++){const l=this._getGroupByColumn(o);assert(null!=l,"Failed to get the group!");if(0!=l.getBindingColumn(e,t,o).aggregate)break;r=l._getCellRange(0,o-l._colstart);i.col2=l._colstart+r.col2}return i}_getGroupHeaderMergedRange(e,t,l,o){if(o){const o=this._multiRowGroupHeaderRange;if(o.containsColumn(l)){const e=this._rowsPerItem,l=Math.floor(t/e)*e;return new CellRange(l+o.row,o.col,l+o.row2,o.col2)}const s=this._getGroupByColumn(l);assert(s instanceof MultiRowCellGroup,"Failed to get the group!");return s.getMergedRange(e,t,l)}return this._getSingleRowGroupHeaderRange(e,t,l)}_getGroupByColumn(e){let t=this._groupsByColumn[e];if(!t){let l=this._bindingGroups;for(let o=0;o<l.length;o++)if(e>=(t=l[o])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}}return t}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._cols.forEach(t=>{null==t.dataType&&t._binding&&(t.dataType=getType(t._binding.getValue(e)));if(!t.isReadOnly){let l=isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=l&&!l.writable&&!l.set}})})}}export class MultiRowCell 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){const t=asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}}get col(){return this._col}set col(e){const t=asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}}get colspan(){return this._colspan}set colspan(e){const t=asInt(e,!1,!0);assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}}get rowspan(){return this._rowspan}set rowspan(e){const t=asInt(e,!1,!0);assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}}_setLayout(e){this._layout=e}_onLayoutPropertyChanged(){const e=this._layout;e&&e._onLayoutChanged()}}export class MultiRowCellGroup extends MultiRowCell{constructor(e){super();this._isRowHeader=!1;this._colstart=0;this._cells=new MultiRowCellCollection;copy(this,e)}_copy(e,t){if("cells"==e){isArray(t)&&(this._cellsDef=t);return!0}return!1}get cells(){return this._cells}get isRowHeader(){return this._isRowHeader}set isRowHeader(e){const t=asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}}openGroup(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()}closeGroup(e,t){if(t>this._rowspanEff){this._cells.forEach(e=>{e.row==this._rowspanEff-1&&(e._rowspanEff=t-e.row)});this._rowspanEff=t}this._cells.forEach(e=>{for(;e.col+e._colspanEff<this._colspanEff&&!this._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++});this._cells.forEach(e=>{for(;e.row+e._rowspanEff<this._rowspanEff&&!this._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++});if(this._cells.length>0)for(let e=0;e<this._rowspanEff;e++)for(let t=0;t<this._colspanEff;t++)assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach(e=>{for(let t=0;t<e._rowspanEff;t++)for(let l=0;l<e._colspanEff;l++){let o=(e.row+t)*this._colspanEff+e.col+l;this._cols.setAt(o,e);let s=new CellRange(0-t,0-l,0-t+e._rowspanEff-1,0-l+e._colspanEff-1);s.isSingleCell||(this._rng[o]=s)}});let l=this._colstart;this._rng[-1]=new CellRange(0,l,0,l+this._colspanEff-1);this._hasAggregates=!1;for(let e=0;e<this._cells.length&&!this._hasAggregates;e++)this._hasAggregates=0!=this._cells[e].aggregate}getColumnWidth(e){for(let t=0;t<this._cells.length;t++){let l=this._cells[t];if(l.col==e&&1==l._colspanEff)return l.width}return null}getMergedRange(e,t,l){if(t<0)return this._rng[-1];let o=e.rows[t],s=null!=o.recordIndex?o.recordIndex:t%this._rowspanEff,r=l-this._colstart,i=this._rng[s*this._colspanEff+r];e.cellType==CellType.ColumnHeader&&t++;return i?new CellRange(t+i.row,l+i.col,t+i.row2,l+i.col2):null}getBindingColumn(e,t,l){if(t<0)return this;let o=e.rows[t],s=o&&null!=o.recordIndex?o.recordIndex:t%this._rowspanEff,r=l-this._colstart;return this._cols[s*this._colspanEff+r]}getColumn(e){return this._cols.getColumn(e)}_getCellRange(e,t){let l=this._rng[e*this._colspanEff+t];return l?new CellRange(e+l.row,t+l.col,e+l.row2,t+l.col2):new CellRange(e,t)}_parseCells(e){let t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{assert(e instanceof MultiRowCell,"cells contain items of invalid type")});t=e}else e.forEach(e=>{let l=null;l=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(l)});t.forEach(e=>{e.binding&&!e.header&&(e.header=toHeaderCase(e.binding))})}return t}_clearCalculations(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach(e=>{e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0})}_calculate(){this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach(e=>{this._colspanEff=Math.max(this._colspanEff,e.colspan);e._colspanEff=e.colspan;e._rowspanEff=e.rowspan});let e=0,t=0;this._cells.forEach((l,o)=>{for(;!this._cellFits(l,o,e,t);)0==(t=(t+1)%this._colspanEff)&&e++;l.row=e;l.col=t});let l=1,o=1;this._cells.forEach(e=>{l=Math.max(l,e.row+e._rowspanEff);o=Math.max(o,e.col+e._colspanEff)});this._rowspanEff=l;this._colspanEff=o}_cellFits(e,t,l,o){if(o>0&&o+e._colspanEff>this._colspanEff)return!1;for(let s=0;s<e._colspanEff;s++)if(this._slotTaken(l,o+s,t))return!1;this._colspanEff=Math.max(this._colspanEff,o+e._colspanEff-1);return!0}_slotTaken(e,t,l=this._cells.length){for(let o=0;o<l;o++){let l=this._cells[o];if(e>=l.row&&e<=l.row+l._rowspanEff-1&&t>=l.col&&t<=l.col+l._colspanEff-1)return!0}return!1}}export class MultiRow extends FlexGrid{constructor(e,t){super(e);this._hdrLayoutDef=null;this._centerVert=!0;this._collapsedHeaders=!1;this._multiRowGroupHeaders=!1;this._rowHdrCnt=0;this.collapsedHeadersChanging=new Event;this.collapsedHeadersChanged=new Event;this._layoutDef=new MultiRowCellCollection;this._layout=new _MultiRowLayout(this,this._layoutDef,()=>this._onLayoutChanged());addClass(this.hostElement,"wj-multirow");let l=this.columnHeaders.hostElement.parentElement,o=createElement('<div class="wj-hdr-collapse"><span></span></div>');o.style.display="none";l.appendChild(o);this._btnCollapse=o;this._updateButtonGlyph();this.addEventListener(o,"mousedown",e=>{switch(this.collapsedHeaders){case null:case!1:this._collapsedHeadersWasNull=null==this.collapsedHeaders;this.collapsedHeaders=!0;break;case!0:this.collapsedHeaders=!!this._collapsedHeadersWasNull&&null}e.preventDefault();this.focus()},!0);let s=this.hostElement;this.addEventListener(s,"mousedown",e=>{if(!this._mouseHdl._szRowCol){let t=this._layout?this._layout._bindingGroups:null,l=t&&t.length?t[0]:null;if(l&&l.isRowHeader){let t=this.hitTest(e);if(t.panel==this.columnHeaders&&t.col<this.columns.frozen){e.preventDefault();this.selectAll()}}}},!0);["dragover","dragleave","dragdrop"].forEach(e=>{this.removeEventListener(s,e)});this._edtHdl=new _MultiRowEditHandler(this);this._addHdl=new _MultiRowAddNewHandler(this);this.formatItem.addHandler(this._formatItem,this);this.autoGenerateColumns=!1;this.allowDragging=AllowDragging.None;this.mergeManager=new _MergeManager;this.initialize(t)}_getProductInfo(){return"H87K,MultiRow"}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this.finishEditing()||this.finishEditing(!0);this._layoutDef=asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,()=>this._onLayoutChanged());this._rowHdrCnt=0;if(this._layout){let e=this._layout._bindingGroups;for(let t=0;t<e.length;t++){let l=e[t];if(!l.isRowHeader)break;this._rowHdrCnt=l._colstart+l._colspanEff;l.cells.forEach(e=>{e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"})}}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)}get recordViewRange(){const e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return Object.assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})}get headerLayoutDefinition(){return this._hdrLayoutDef}set headerLayoutDefinition(e){this._hdrLayoutDef=asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}let t=null;e&&(t=new _MultiRowLayout(this,e,()=>this._onHeaderLayoutChanged()));this._hdrLayout=t;this._bindGrid(!0)}get rowsPerItem(){return this._layout._rowsPerItem}getBindingColumn(e,t,l){return this._getBindingColumn(e,t,e.columns[l])}getColumn(e,t){if(isString(e)){let l=t&&this._hdrLayout,o=(l?this._hdrLayout:this._layout)._bindingGroups,s=null;for(let t=0;t<o.length&&!s;t++)s=o[t].getColumn(e);return!s&&l?this.getColumn(e,!1):s}return super.getColumn(e)}get centerHeadersVertically(){return this._centerVert}set centerHeadersVertically(e){if(e!=this._centerVert){this._centerVert=asBoolean(e);this.invalidate()}}get collapsedHeaders(){return this._collapsedHeaders}set collapsedHeaders(e){if(e!=this._collapsedHeaders){let t=new CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}}get showHeaderCollapseButton(){return""==this._btnCollapse.style.display}set showHeaderCollapseButton(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=asBoolean(e)?"":"none")}get multiRowGroupHeaders(){return this._multiRowGroupHeaders}set multiRowGroupHeaders(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=asBoolean(e);this._bindGrid(!0)}}onCollapsedHeadersChanging(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel}onCollapsedHeadersChanged(e){this.collapsedHeadersChanged.raise(this,e)}get allowPinning(){return!1}set allowPinning(e){assert(!e,"MultiRow does not support pinning.")}onSelectionChanging(e){let t=e._rng;if(t&&t.isValid&&this.selectionMode){let e=this._mouseHdl._htDown,l=this.rows,o=this.columns,s=this._rowHdrCnt;if(s){t.col=Math.max(t.col,s);t.col2=Math.max(t.col2,s)}if(e&&(e.panel==this.rowHeaders||e.panel==this.cells&&e.col<s)){let e=l[t.topRow],s=l[t.bottomRow];if(e&&null!=e.recordIndex){let l=e.index-e.recordIndex,r=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,i=s.index-s.recordIndex+r-1,n=o.length-1,a=t.row!=t.topRow?new CellRange(i,0,l,n):new CellRange(l,0,i,n);t.row=a.row;t.row2=a.row2;t.col2=n;switch(this.selectionMode){case SelectionMode.Cell:t.row2=a.row;t.col2=a.col;break;case SelectionMode.Row:t.row2=a.row}}}}return super.onSelectionChanging(e)}_createSelHdl(){return new _MultiRowSelectionHandler(this)}_getDeleteColumnIndex(){return this._rowHdrCnt}_getQuickAutoSize(){return isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter}_addBoundRow(e,t){let l=e[t];for(let e=0;e<this.rowsPerItem;e++)this.rows.push(new _MultiRow(l,t,e))}_addNode(e,t,l){this._addBoundRow(e,t)}_addGroupRow(e){let t=this._multiRowGroupHeaders?this.rowsPerItem:1;for(let l=0;l<t;l++)this.rows.push(new _MultiGroupRow(e,l))}_bindColumns(){let e=this.columnHeaders.rows,t=this._layout,l=this._hdrLayout,o=(l?l._rowsPerItem:this.rowsPerItem)+1;for(;e.length>o;)e.removeAt(e.length-1);for(;e.length<o;)e.push(new Row);this._updateCollapsedHeaders();this.columns.clear();if(t&&t._bindingGroups){let e="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");t._bindingGroups.forEach(t=>{for(let l=0;l<t._colspanEff;l++){if(0===t.cells.length)continue;let o=new Column;for(let s=0;s<t.cells.length;s++){let r=t.cells[s];r.col==l&&e.forEach(e=>{null!=r[e]&&r[e]!=o[e]&&(o[e]=r[e])})}this.columns.push(o)}})}}_updateCollapsedHeaders(){let e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(let l=1;l<e.length;l++)e[l].visible=1!=t}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(hasItems(e)){let t=e.items[0];this._layout&&this._layout._updateCellTypes(t);this._hdrLayout&&this._hdrLayout._updateCellTypes(t)}}_getBindingColumn(e,t,l){if(l&&(e==this.cells||e==this.columnHeaders)){let o=e.cellType==CellType.ColumnHeader;o&&t--;l=this._getGroupByColumn(l.index,o).getBindingColumn(e,t,l.index)}return l}_getBindingColumns(){let e=[];this._layout._bindingGroups.forEach(t=>{t._cols.forEach(t=>{e.indexOf(t)<0&&e.push(t)})});return e}_getRowsPerItem(){return this.rowsPerItem}_cvCollectionChanged(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{let e=NotifyCollectionChangedAction;switch(t.action){case e.Change:this.invalidate();break;case e.Add:if(t.index==this.collectionView.items.length-1){let e=this.rows.length;for(;e>0&&this.rows[e-1]instanceof _NewRowTemplate;)e--;for(let l=0;l<this.rowsPerItem;l++)this.rows.insert(e+l,new _MultiRow(t.item,t.index,l));return}assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}}_getGroupByColumn(e,t){let l=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(l=this._hdrLayout._getGroupByColumn(e));l||(l=this._layout._getGroupByColumn(e));assert(l instanceof MultiRowCellGroup,"Failed to get the group!");return l}_onLayoutChanged(){this.layoutDefinition=this._layoutDef}_onHeaderLayoutChanged(){this.headerLayoutDefinition=this._hdrLayoutDef}_formatItem(e,t){let l=this.rowsPerItem,o=t.panel,s=o.cellType,r=o.rows[t.range.row],i=o.rows[t.range.row2],n=t.cell,a=CellType;s==a.ColumnHeader&&toggleClass(n,"wj-group-header",0==t.range.row);if(s==a.Cell||s==a.ColumnHeader){let e=this._getGroupByColumn(t.col,s==a.ColumnHeader);toggleClass(n,"wj-group-start",e._colstart==t.range.col);toggleClass(n,"wj-group-end",e._colstart+e._colspanEff-1==t.range.col2)}if(l>1&&(s==a.Cell||s==a.RowHeader)){let e=i instanceof _MultiRow||i instanceof _MultiRowNewRowTemplate;toggleClass(n,"wj-record-start",!!(r instanceof _MultiRow||r instanceof _MultiRowNewRowTemplate)&&0==r.recordIndex);toggleClass(n,"wj-record-end",!!e&&i.recordIndex==l-1)}let h=this.alternatingRowStep;if(h){let e=!1;if(r instanceof _MultiRow){e=r.dataIndex%(h+1)==0;1==h&&(e=!e)}toggleClass(n,"wj-alt",e)}if(this._centerVert&&!n.getAttribute("wj-state-measuring")){let e=t.range.rowSpan>1;if(e&&t.updateContent)if(0==n.childElementCount)n.innerHTML="<div>"+n.innerHTML+"</div>";else{let e=document.createElement("div"),t=document.createRange();t.selectNodeContents(n);t.surroundContents(e)}toggleClass(n,"wj-center-vert",e)}}_updateButtonGlyph(){let e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")}_getError(e,t,l,o){if(isFunction(this.itemValidator)&&e==this.rowHeaders){let e=[];for(let s=0;s<this.rowsPerItem;s++)for(l=0;l<this.columns.length;l++){let r=this.itemValidator(t+s,l,o);if(r){let o=this.getMergedRange(this.cells,t+s,l);o&&(o.columnSpan>1&&o.col<l||o.rowSpan>1&&o.row<t+s)||e.push(r)}}if(e.length){let t=this.errorTip,l=!!t&&t.isContentHtml;return e.join(l?"<br/>":"\n")}}return super._getError(e,t,l,o)}_getEmptyRequiredCell(e){if(e>=0){e-=this.rows[e].recordIndex;for(let t=0;t<this._getRowsPerItem();t++){let l=e+t;for(let e=0;e<this.columns.length;e++){let t=this._getBindingColumn(this.cells,l,this.columns[e]),o=this.getCellData(l,e,!1);if(t.getIsRequired(this.rows[l])&&(""===o||null==o)){if(!t.isReadOnly)return new CellRange(l,e);console.warn(`Incorrect data. Column ${e} is at the same time required, empty and read-only`)}}}}return null}}export class _MergeManager extends MergeManager{getMergedRange(e,t,l,o=!0){let s=e.grid;if(t<0||t>=e.rows.length||l<0||l>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:if(e.rows[t]instanceof GroupRow&&!s.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,l,o,!1)}switch(e.cellType){case CellType.Cell:if(e.rows[t]instanceof GroupRow)return this._getGroupRowMergedRange(e,t,l,o,s.multiRowGroupHeaders);case CellType.ColumnHeader:let r=e.cellType==CellType.ColumnHeader,i=s._getGroupByColumn(l,r);assert(i instanceof MultiRowCellGroup,"Failed to get the group!");let n=r?i.getMergedRange(e,t-1,l):i.getMergedRange(e,t,l),a=e.columns.frozen;if(a&&n&&n.columnSpan>1&&n.col<a&&n.col2>=a){n=n.clone();l<a?n.col2=a-1:n.col=a}let h=e.rows.frozen;if(h&&n&&n.rowSpan>1&&e.cellType==CellType.Cell&&n.row<h&&n.row2>=h){n=n.clone();t<h?n.row2=h-1:n.row=h}assert(!n||n.contains(t,l),"Merged range must contain source cell");return n;case CellType.RowHeader:let u=s.rowsPerItem,d=t-e.rows[t].recordIndex,c=Math.min(d+u-1,e.rows.length-1);return new CellRange(d,0,c,e.columns.length-1);case CellType.TopLeft:const _=s.collapsedHeaders,g=e.rows.length-1,w=g>0?1:0;return new CellRange(0!=_?0:w,0,1!=_?g:w,e.columns.length-1)}return null}_getGroupRowMergedRange(e,t,l,o=!0,s){let r=e.grid,i=e.cellType,n=e.rows[t];if(r.showGroups&&!r.childItemsPath&&n instanceof _MultiGroupRow&&n.dataItem instanceof CollectionViewGroup&&i==CellType.Cell){return r._layout._getGroupHeaderMergedRange(e,t,l,s)}return super.getMergedRange(e,t,l,o)}}export class _MultiRowAddNewHandler extends _AddNewHandler{constructor(e){e._addHdl._detach();super(e)}updateNewRowTemplate(){let e=this._g.editableCollectionView,t=this._g,l=t.rows,o=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,s=-1;for(let e=0;e<l.length;e+=t.rowsPerItem)if(l[e]instanceof _MultiRowNewRowTemplate){s=e;break}if(o&&s>-1&&(this._top&&s>0||!this._top&&0==s)){s=-1;this._removeNewRowTemplate()}if(o&&s<0)for(let e=0;e<t.rowsPerItem;e++){let t=new _MultiRowNewRowTemplate(e);0==e&&(this._nrt=t);this._top?l.insert(e,t):l.push(t)}!o&&s>-1&&this._removeNewRowTemplate()}_keydown(e){super._keydown(e);e.defaultPrevented||e.keyCode!=Key.Escape||this._copyNewDataItem()}_beginningEdit(e,t){super._beginningEdit(e,t);this._top&&this._copyNewDataItem()}_rowEditStarting(e,t){super._rowEditStarting(e,t);this._top&&this._copyNewDataItem()}_rowEditEnded(e,t){super._rowEditEnded(e,t);this._copyNewDataItem()}_copyNewDataItem(){if(this._top){let e=this._g,t=e.rows;for(let l=0;l<e.rowsPerItem;l++)t[l]instanceof _NewRowTemplate&&(t[l].dataItem=this._nrt.dataItem)}}_removeNewRowTemplate(){for(let e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof _NewRowTemplate){t.removeAt(e);e--}}}export class _MultiRowNewRowTemplate extends _NewRowTemplate{constructor(e){super();this._idxRecord=e}get recordIndex(){return this._idxRecord}}_registerModule("wijmo.grid.multirow",selfModule); | ||
import{ObservableArray,NotifyCollectionChangedEventArgs,assert,asBoolean,copy,isArray,toHeaderCase,getType,isIE,asInt,Key,addClass,createElement,hasItems,asArray,toggleClass,isFunction,isString,isBoolean,Event,CancelEventArgs,CollectionViewGroup,NotifyCollectionChangedAction,_registerModule}from"@grapecity/wijmo";import{Row,GroupRow,CellRange,RowColFlags,CellRangeEventArgs,Column,ColumnCollection,CellType,FlexGrid,_AddNewHandler,_NewRowTemplate,SelMove,_SelectionHandler,_EditHandler,SelectionMode,AllowDragging,MergeManager}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.multirow";export class _MultiRowSelectionHandler extends _SelectionHandler{_getNextColumnCell(e,t,l,o=0){const s=this._g,r=s.cells,i=s.columns,n=SelMove;switch(l){case n.NextEditableCell:for(let l=t+1;l<i.length;l++){let t=s._getBindingColumn(r,e,i[l]);if(t.renderSize>0&&!t.isReadOnly)return l}return t;case n.PrevEditableCell:for(let l=t-1;l>=0;l--){let t=s._getBindingColumn(r,e,i[l]);if(t.renderSize>0&&!t.isReadOnly)return l}return t}return super._getNextColumnCell(e,t,l,o)}}export class _MultiRow extends Row{constructor(e,t,l){super(e);this._idxData=t;this._idxRecord=l}get recordIndex(){return this._idxRecord}}export class _MultiGroupRow extends GroupRow{constructor(e,t){super(e);this._idxRecord=t}get recordIndex(){return this._idxRecord}get hasChildren(){return!0}getCellRange(){let e=this._getLastRowInHeader();return e!=this?e.getCellRange():super.getCellRange()}get isCollapsed(){return this._getLastRowInHeader()._getFlag(RowColFlags.Collapsed)}set isCollapsed(e){let t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(asBoolean(e))}_setCollapsed(e){let t=this.grid,l=t.rows,o=this.getCellRange(),s=new CellRangeEventArgs(t.cells,new CellRange(this.index,-1));if(t.onGroupCollapsedChanging(s)){t.deferUpdate(()=>{l.deferUpdate(()=>{this._setFlag(RowColFlags.Collapsed,e,!0);for(let t=o.topRow+1;t<=o.bottomRow&&t>-1&&t<l.length;t++){l[t]._setFlag(RowColFlags.ParentCollapsed,e,!0);let o=l[t];if(o instanceof _MultiGroupRow){let s=o._getLastRowInHeader();for(t+=1;t<=s.index;t++)(o=l[t])._setFlag(RowColFlags.ParentCollapsed,e,!0);t--}o instanceof GroupRow&&o.isCollapsed&&(t=o.getCellRange().bottomRow)}})});t.onGroupCollapsedChanged(s)}}_getLastRowInHeader(){let e=this.grid,t=this;if(e&&e.multiRowGroupHeaders){let l=e.rows,o=this.dataItem;for(let e=this.index+1;e<l.length&&l[e].dataItem==o;e++)t=l[e]}assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t}}export class _MultiRowEditHandler extends _EditHandler{_selectionChanging(e){if(this.finishEditing()){let t=this._g._selHdl.selection.row;if(t!=e.row){let l=this._g.rows.length;if((t>-1&&t<l?this._g.rows[t].dataItem:null)!=(e.row>-1&&e.row<l?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){let l=!this._g.rows[t]||this._g.rows[t]&&Object.getPrototypeOf(this._g.rows[t])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(t);null!==l&&setTimeout(()=>{this._g.select(l);this.startEditing(!0,l.row,l.col,!0,e)})}}}}else e.cancel=!0}}export class MultiRowCellCollection extends ObservableArray{_setLayout(e){this._layout=e;this.forEach(t=>t._setLayout(e))}onCollectionChanged(e=NotifyCollectionChangedEventArgs.reset){const t=this._layout;t&&t._onLayoutChanged();super.onCollectionChanged(e)}}export class _MultiRowLayout{constructor(e,t,l){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=l;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_dispose(){if(this._disposed)return;this._disposed=!0;const e=this._bindingGroups;e.forEach(e=>{e.cells._setLayout(null)});e._setLayout(null);this._bindingGroups=null}_onLayoutChanged(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()}_parseCellGroups(e){let t=this._grid,l=null,o=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")});l=e}else{l=new MultiRowCellCollection;for(let t=0;t<e.length;t++){let o=null;o=e[t]instanceof MultiRowCellGroup?e[t]:new MultiRowCellGroup(e[t]);l.push(o)}}l.forEach(e=>{e.openGroup()});for(let e=0,t=0;e<l.length;e++){let s=l[e];s._colstart=t;t+=s._colspanEff;o=Math.max(o,s._rowspanEff)}l.forEach(e=>{e.closeGroup(t,o)});this._rowsPerItem=o}else l=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(l);l.forEach(e=>{e.cells._setLayout(this)});l._setLayout(this);return l}_getMultiRowGroupHeaderRange(e){const t=this._rowsPerItem,l=new CellRange(0,0,t-1,0);for(let t=0;t<e.length;t++){const o=e[t];if(o._hasAggregates){0===t&&this._expandMultiRowGroupHeaderToAggregate(l,o);return l}l.col2=o._colstart+o._colspanEff-1}return l}_expandMultiRowGroupHeaderToAggregate(e,t){const l=this._rowsPerItem,o=t._colspanEff,s=t.cells.filter(e=>e.col>0&&0!=e.aggregate).map(e=>e.col).reduce((e,t)=>t<e?t:e,o);e.col2=Math.max(t._colstart+s-1,e.col2);for(let r=s;r<o;r++){let o=!0;for(let e=0;e<l;e++){const l=t._getCellRange(e,r);o=o&&l.col===r}if(o){e.col2=Math.max(t._colstart+r-1,e.col2);return}}}_getSingleRowGroupHeaderRange(e,t,l){const o=this._bindingGroups;if(0===o.length)return null;let s=this._getGroupByColumn(l);assert(null!=s,"Failed to get the group!");let r=s._getCellRange(0,l-s._colstart);const i=new CellRange(t,s._colstart+r.col,t,s._colstart+r.col2);if(0!=s.getBindingColumn(e,t,l).aggregate)return i;const n=o[0]._colstart;for(let o=l-1;o>=n;o--){const l=this._getGroupByColumn(o);assert(null!=l,"Failed to get the group!");if(0!=l.getBindingColumn(e,t,o).aggregate)break;r=l._getCellRange(0,o-l._colstart);i.col=l._colstart+r.col}const a=o[o.length-1],h=a._colstart+a._colspanEff;for(let o=l+1;o<h;o++){const l=this._getGroupByColumn(o);assert(null!=l,"Failed to get the group!");const s=l.getBindingColumn(e,t,o);if(s&&0!=s.aggregate)break;r=l._getCellRange(0,o-l._colstart);i.col2=l._colstart+r.col2}return i}_getGroupHeaderMergedRange(e,t,l,o){if(o){const o=this._multiRowGroupHeaderRange;if(o.containsColumn(l)){const e=this._rowsPerItem,l=Math.floor(t/e)*e;return new CellRange(l+o.row,o.col,l+o.row2,o.col2)}const s=this._getGroupByColumn(l);assert(s instanceof MultiRowCellGroup,"Failed to get the group!");return s.getMergedRange(e,t,l)}return this._getSingleRowGroupHeaderRange(e,t,l)}_getGroupByColumn(e){let t=this._groupsByColumn[e];if(!t){let l=this._bindingGroups;for(let o=0;o<l.length;o++)if(e>=(t=l[o])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}}return t}_updateCellTypes(e){this._bindingGroups.forEach(t=>{t._cols.forEach(t=>{null==t.dataType&&t._binding&&(t.dataType=getType(t._binding.getValue(e)));if(!t.isReadOnly){let l=isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=l&&!l.writable&&!l.set}})})}}export class MultiRowCell 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){const t=asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}}get col(){return this._col}set col(e){const t=asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}}get colspan(){return this._colspan}set colspan(e){const t=asInt(e,!1,!0);assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}}get rowspan(){return this._rowspan}set rowspan(e){const t=asInt(e,!1,!0);assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}}_setLayout(e){this._layout=e}_onLayoutPropertyChanged(){const e=this._layout;e&&e._onLayoutChanged()}}export class MultiRowCellGroup extends MultiRowCell{constructor(e){super();this._isRowHeader=!1;this._colstart=0;this._cells=new MultiRowCellCollection;copy(this,e)}_copy(e,t){if("cells"==e){isArray(t)&&(this._cellsDef=t);return!0}return!1}get cells(){return this._cells}get isRowHeader(){return this._isRowHeader}set isRowHeader(e){const t=asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}}openGroup(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()}closeGroup(e,t){if(t>this._rowspanEff){this._cells.forEach(e=>{e.row==this._rowspanEff-1&&(e._rowspanEff=t-e.row)});this._rowspanEff=t}this._cells.forEach(e=>{for(;e.col+e._colspanEff<this._colspanEff&&!this._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++});this._cells.forEach(e=>{for(;e.row+e._rowspanEff<this._rowspanEff&&!this._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++});if(this._cells.length>0)for(let e=0;e<this._rowspanEff;e++)for(let t=0;t<this._colspanEff;t++)assert(this._slotTaken(e,t),"Invalid layout (empty cells).");this._cols=new ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach(e=>{for(let t=0;t<e._rowspanEff;t++)for(let l=0;l<e._colspanEff;l++){let o=(e.row+t)*this._colspanEff+e.col+l;this._cols.setAt(o,e);let s=new CellRange(0-t,0-l,0-t+e._rowspanEff-1,0-l+e._colspanEff-1);s.isSingleCell||(this._rng[o]=s)}});let l=this._colstart;this._rng[-1]=new CellRange(0,l,0,l+this._colspanEff-1);this._hasAggregates=!1;for(let e=0;e<this._cells.length&&!this._hasAggregates;e++)this._hasAggregates=0!=this._cells[e].aggregate}getColumnWidth(e){for(let t=0;t<this._cells.length;t++){let l=this._cells[t];if(l.col==e&&1==l._colspanEff)return l.width}return null}getMergedRange(e,t,l){if(t<0)return this._rng[-1];let o=e.rows[t],s=null!=o.recordIndex?o.recordIndex:t%this._rowspanEff,r=l-this._colstart,i=this._rng[s*this._colspanEff+r];e.cellType==CellType.ColumnHeader&&t++;return i?new CellRange(t+i.row,l+i.col,t+i.row2,l+i.col2):null}getBindingColumn(e,t,l){if(t<0)return this;let o=e.rows[t],s=o&&null!=o.recordIndex?o.recordIndex:t%this._rowspanEff,r=l-this._colstart;return this._cols[s*this._colspanEff+r]}getColumn(e){return this._cols.getColumn(e)}_getCellRange(e,t){let l=this._rng[e*this._colspanEff+t];return l?new CellRange(e+l.row,t+l.col,e+l.row2,t+l.col2):new CellRange(e,t)}_parseCells(e){let t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach(e=>{assert(e instanceof MultiRowCell,"cells contain items of invalid type")});t=e}else e.forEach(e=>{let l=null;l=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(l)});t.forEach(e=>{e.binding&&!e.header&&(e.header=toHeaderCase(e.binding))})}return t}_clearCalculations(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach(e=>{e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0})}_calculate(){this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach(e=>{this._colspanEff=Math.max(this._colspanEff,e.colspan);e._colspanEff=e.colspan;e._rowspanEff=e.rowspan});let e=0,t=0;this._cells.forEach((l,o)=>{for(;!this._cellFits(l,o,e,t);)0==(t=(t+1)%this._colspanEff)&&e++;l.row=e;l.col=t});let l=1,o=1;this._cells.forEach(e=>{l=Math.max(l,e.row+e._rowspanEff);o=Math.max(o,e.col+e._colspanEff)});this._rowspanEff=l;this._colspanEff=o}_cellFits(e,t,l,o){if(o>0&&o+e._colspanEff>this._colspanEff)return!1;for(let s=0;s<e._colspanEff;s++)if(this._slotTaken(l,o+s,t))return!1;this._colspanEff=Math.max(this._colspanEff,o+e._colspanEff-1);return!0}_slotTaken(e,t,l=this._cells.length){for(let o=0;o<l;o++){let l=this._cells[o];if(e>=l.row&&e<=l.row+l._rowspanEff-1&&t>=l.col&&t<=l.col+l._colspanEff-1)return!0}return!1}}export class MultiRow extends FlexGrid{constructor(e,t){super(e);this._hdrLayoutDef=null;this._centerVert=!0;this._collapsedHeaders=!1;this._multiRowGroupHeaders=!1;this._rowHdrCnt=0;this.collapsedHeadersChanging=new Event;this.collapsedHeadersChanged=new Event;this._layoutDef=new MultiRowCellCollection;this._layout=new _MultiRowLayout(this,this._layoutDef,()=>this._onLayoutChanged());addClass(this.hostElement,"wj-multirow");let l=this.columnHeaders.hostElement.parentElement,o=createElement('<div class="wj-hdr-collapse"><span></span></div>');o.style.display="none";l.appendChild(o);this._btnCollapse=o;this._updateButtonGlyph();this.addEventListener(o,"mousedown",e=>{switch(this.collapsedHeaders){case null:case!1:this._collapsedHeadersWasNull=null==this.collapsedHeaders;this.collapsedHeaders=!0;break;case!0:this.collapsedHeaders=!!this._collapsedHeadersWasNull&&null}e.preventDefault();this.focus()},!0);let s=this.hostElement;this.addEventListener(s,"mousedown",e=>{if(!this._mouseHdl._szRowCol){let t=this._layout?this._layout._bindingGroups:null,l=t&&t.length?t[0]:null;if(l&&l.isRowHeader){let t=this.hitTest(e);if(t.panel==this.columnHeaders&&t.col<this.columns.frozen){e.preventDefault();this.selectAll()}}}},!0);["dragover","dragleave","dragdrop"].forEach(e=>{this.removeEventListener(s,e)});this._edtHdl=new _MultiRowEditHandler(this);this._addHdl=new _MultiRowAddNewHandler(this);this.formatItem.addHandler(this._formatItem,this);this.autoGenerateColumns=!1;this.allowDragging=AllowDragging.None;this.mergeManager=new _MergeManager;this.initialize(t)}_getProductInfo(){return"H87K,MultiRow"}get layoutDefinition(){return this._layoutDef}set layoutDefinition(e){this.finishEditing()||this.finishEditing(!0);this._layoutDef=asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,()=>this._onLayoutChanged());this._rowHdrCnt=0;if(this._layout){let e=this._layout._bindingGroups;for(let t=0;t<e.length;t++){let l=e[t];if(!l.isRowHeader)break;this._rowHdrCnt=l._colstart+l._colspanEff;l.cells.forEach(e=>{e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"})}}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)}get recordViewRange(){const e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return Object.assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})}get headerLayoutDefinition(){return this._hdrLayoutDef}set headerLayoutDefinition(e){this._hdrLayoutDef=asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}let t=null;e&&(t=new _MultiRowLayout(this,e,()=>this._onHeaderLayoutChanged()));this._hdrLayout=t;this._bindGrid(!0)}get rowsPerItem(){return this._layout._rowsPerItem}getBindingColumn(e,t,l){return this._getBindingColumn(e,t,e.columns[l])}getColumn(e,t){if(isString(e)){let l=t&&this._hdrLayout,o=(l?this._hdrLayout:this._layout)._bindingGroups,s=null;for(let t=0;t<o.length&&!s;t++)s=o[t].getColumn(e);return!s&&l?this.getColumn(e,!1):s}return super.getColumn(e)}get centerHeadersVertically(){return this._centerVert}set centerHeadersVertically(e){if(e!=this._centerVert){this._centerVert=asBoolean(e);this.invalidate()}}get collapsedHeaders(){return this._collapsedHeaders}set collapsedHeaders(e){if(e!=this._collapsedHeaders){let t=new CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}}get showHeaderCollapseButton(){return""==this._btnCollapse.style.display}set showHeaderCollapseButton(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=asBoolean(e)?"":"none")}get multiRowGroupHeaders(){return this._multiRowGroupHeaders}set multiRowGroupHeaders(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=asBoolean(e);this._bindGrid(!0)}}onCollapsedHeadersChanging(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel}onCollapsedHeadersChanged(e){this.collapsedHeadersChanged.raise(this,e)}get allowPinning(){return!1}set allowPinning(e){assert(!e,"MultiRow does not support pinning.")}onSelectionChanging(e){let t=e._rng;if(t&&t.isValid&&this.selectionMode){let e=this._mouseHdl._htDown,l=this.rows,o=this.columns,s=this._rowHdrCnt;if(s){t.col=Math.max(t.col,s);t.col2=Math.max(t.col2,s)}if(e&&(e.panel==this.rowHeaders||e.panel==this.cells&&e.col<s)){let e=l[t.topRow],s=l[t.bottomRow];if(e&&null!=e.recordIndex){let l=e.index-e.recordIndex,r=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,i=s.index-s.recordIndex+r-1,n=o.length-1,a=t.row!=t.topRow?new CellRange(i,0,l,n):new CellRange(l,0,i,n);t.row=a.row;t.row2=a.row2;t.col2=n;switch(this.selectionMode){case SelectionMode.Cell:t.row2=a.row;t.col2=a.col;break;case SelectionMode.Row:t.row2=a.row}}}}return super.onSelectionChanging(e)}_createSelHdl(){return new _MultiRowSelectionHandler(this)}_getDeleteColumnIndex(){return this._rowHdrCnt}_getQuickAutoSize(){return isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter}_addBoundRow(e,t){let l=e[t];for(let e=0;e<this.rowsPerItem;e++)this.rows.push(new _MultiRow(l,t,e))}_addNode(e,t,l){this._addBoundRow(e,t)}_addGroupRow(e){let t=this._multiRowGroupHeaders?this.rowsPerItem:1;for(let l=0;l<t;l++)this.rows.push(new _MultiGroupRow(e,l))}_bindColumns(){let e=this.columnHeaders.rows,t=this._layout,l=this._hdrLayout,o=(l?l._rowsPerItem:this.rowsPerItem)+1;for(;e.length>o;)e.removeAt(e.length-1);for(;e.length<o;)e.push(new Row);this._updateCollapsedHeaders();this.columns.clear();if(t&&t._bindingGroups){let e="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");t._bindingGroups.forEach(t=>{for(let l=0;l<t._colspanEff;l++){if(0===t.cells.length)continue;let o=new Column;for(let s=0;s<t.cells.length;s++){let r=t.cells[s];r.col==l&&e.forEach(e=>{null!=r[e]&&r[e]!=o[e]&&(o[e]=r[e])})}this.columns.push(o)}})}}_updateCollapsedHeaders(){let e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(let l=1;l<e.length;l++)e[l].visible=1!=t}_updateColumnTypes(){super._updateColumnTypes();let e=this.collectionView;if(hasItems(e)){let t=e.items[0];this._layout&&this._layout._updateCellTypes(t);this._hdrLayout&&this._hdrLayout._updateCellTypes(t)}}_getBindingColumn(e,t,l){if(l&&(e==this.cells||e==this.columnHeaders)){let o=e.cellType==CellType.ColumnHeader;o&&t--;l=this._getGroupByColumn(l.index,o).getBindingColumn(e,t,l.index)}return l}_getBindingColumns(){let e=[];this._layout._bindingGroups.forEach(t=>{t._cols.forEach(t=>{e.indexOf(t)<0&&e.push(t)})});return e}_getRowsPerItem(){return this.rowsPerItem}_cvCollectionChanged(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{let e=NotifyCollectionChangedAction;switch(t.action){case e.Change:this.invalidate();break;case e.Add:if(t.index==this.collectionView.items.length-1){let e=this.rows.length;for(;e>0&&this.rows[e-1]instanceof _NewRowTemplate;)e--;for(let l=0;l<this.rowsPerItem;l++)this.rows.insert(e+l,new _MultiRow(t.item,t.index,l));return}assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}}_getGroupByColumn(e,t){let l=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(l=this._hdrLayout._getGroupByColumn(e));l||(l=this._layout._getGroupByColumn(e));assert(l instanceof MultiRowCellGroup,"Failed to get the group!");return l}_onLayoutChanged(){this.layoutDefinition=this._layoutDef}_onHeaderLayoutChanged(){this.headerLayoutDefinition=this._hdrLayoutDef}_formatItem(e,t){let l=this.rowsPerItem,o=t.panel,s=o.cellType,r=o.rows[t.range.row],i=o.rows[t.range.row2],n=t.cell,a=CellType;s==a.ColumnHeader&&toggleClass(n,"wj-group-header",0==t.range.row);if(s==a.Cell||s==a.ColumnHeader){let e=this._getGroupByColumn(t.col,s==a.ColumnHeader);toggleClass(n,"wj-group-start",e._colstart==t.range.col);toggleClass(n,"wj-group-end",e._colstart+e._colspanEff-1==t.range.col2)}if(l>1&&(s==a.Cell||s==a.RowHeader)){let e=i instanceof _MultiRow||i instanceof _MultiRowNewRowTemplate;toggleClass(n,"wj-record-start",!!(r instanceof _MultiRow||r instanceof _MultiRowNewRowTemplate)&&0==r.recordIndex);toggleClass(n,"wj-record-end",!!e&&i.recordIndex==l-1)}let h=this.alternatingRowStep;if(h){let e=!1;if(r instanceof _MultiRow){e=r.dataIndex%(h+1)==0;1==h&&(e=!e)}toggleClass(n,"wj-alt",e)}if(this._centerVert&&!n.getAttribute("wj-state-measuring")){let e=t.range.rowSpan>1;if(e&&t.updateContent)if(0==n.childElementCount)n.innerHTML="<div>"+n.innerHTML+"</div>";else{let e=document.createElement("div"),t=document.createRange();t.selectNodeContents(n);t.surroundContents(e)}toggleClass(n,"wj-center-vert",e)}}_updateButtonGlyph(){let e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")}_getError(e,t,l,o){if(isFunction(this.itemValidator)&&e==this.rowHeaders){let e=[];for(let s=0;s<this.rowsPerItem;s++)for(l=0;l<this.columns.length;l++){let r=this.itemValidator(t+s,l,o);if(r){let o=this.getMergedRange(this.cells,t+s,l);o&&(o.columnSpan>1&&o.col<l||o.rowSpan>1&&o.row<t+s)||e.push(r)}}if(e.length){let t=this.errorTip,l=!!t&&t.isContentHtml;return e.join(l?"<br/>":"\n")}}return super._getError(e,t,l,o)}_getEmptyRequiredCell(e){if(e>=0){e-=this.rows[e].recordIndex;for(let t=0;t<this._getRowsPerItem();t++){let l=e+t;for(let e=0;e<this.columns.length;e++){let t=this._getBindingColumn(this.cells,l,this.columns[e]),o=this.getCellData(l,e,!1);if(t.getIsRequired(this.rows[l])&&(""===o||null==o)){if(!t.isReadOnly)return new CellRange(l,e);console.warn(`Incorrect data. Column ${e} is at the same time required, empty and read-only`)}}}}return null}}export class _MergeManager extends MergeManager{getMergedRange(e,t,l,o=!0){let s=e.grid;if(t<0||t>=e.rows.length||l<0||l>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:if(e.rows[t]instanceof GroupRow&&!s.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,l,o,!1)}switch(e.cellType){case CellType.Cell:if(e.rows[t]instanceof GroupRow)return this._getGroupRowMergedRange(e,t,l,o,s.multiRowGroupHeaders);case CellType.ColumnHeader:let r=e.cellType==CellType.ColumnHeader,i=s._getGroupByColumn(l,r);assert(i instanceof MultiRowCellGroup,"Failed to get the group!");let n=r?i.getMergedRange(e,t-1,l):i.getMergedRange(e,t,l),a=e.columns.frozen;if(a&&n&&n.columnSpan>1&&n.col<a&&n.col2>=a){n=n.clone();l<a?n.col2=a-1:n.col=a}let h=e.rows.frozen;if(h&&n&&n.rowSpan>1&&e.cellType==CellType.Cell&&n.row<h&&n.row2>=h){n=n.clone();t<h?n.row2=h-1:n.row=h}assert(!n||n.contains(t,l),"Merged range must contain source cell");return n;case CellType.RowHeader:let u=s.rowsPerItem,d=t-e.rows[t].recordIndex,c=Math.min(d+u-1,e.rows.length-1);return new CellRange(d,0,c,e.columns.length-1);case CellType.TopLeft:const _=s.collapsedHeaders,g=e.rows.length-1,w=g>0?1:0;return new CellRange(0!=_?0:w,0,1!=_?g:w,e.columns.length-1)}return null}_getGroupRowMergedRange(e,t,l,o=!0,s){let r=e.grid,i=e.cellType,n=e.rows[t];if(r.showGroups&&!r.childItemsPath&&n instanceof _MultiGroupRow&&n.dataItem instanceof CollectionViewGroup&&i==CellType.Cell){return r._layout._getGroupHeaderMergedRange(e,t,l,s)}return super.getMergedRange(e,t,l,o)}}export class _MultiRowAddNewHandler extends _AddNewHandler{constructor(e){e._addHdl._detach();super(e)}updateNewRowTemplate(){let e=this._g.editableCollectionView,t=this._g,l=t.rows,o=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,s=-1;for(let e=0;e<l.length;e+=t.rowsPerItem)if(l[e]instanceof _MultiRowNewRowTemplate){s=e;break}if(o&&s>-1&&(this._top&&s>0||!this._top&&0==s)){s=-1;this._removeNewRowTemplate()}if(o&&s<0)for(let e=0;e<t.rowsPerItem;e++){let t=new _MultiRowNewRowTemplate(e);0==e&&(this._nrt=t);this._top?l.insert(e,t):l.push(t)}!o&&s>-1&&this._removeNewRowTemplate()}_keydown(e){super._keydown(e);e.defaultPrevented||e.keyCode!=Key.Escape||this._copyNewDataItem()}_beginningEdit(e,t){super._beginningEdit(e,t);this._top&&this._copyNewDataItem()}_rowEditStarting(e,t){super._rowEditStarting(e,t);this._top&&this._copyNewDataItem()}_rowEditEnded(e,t){super._rowEditEnded(e,t);this._copyNewDataItem()}_copyNewDataItem(){if(this._top){let e=this._g,t=e.rows;for(let l=0;l<e.rowsPerItem;l++)t[l]instanceof _NewRowTemplate&&(t[l].dataItem=this._nrt.dataItem)}}_removeNewRowTemplate(){for(let e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof _NewRowTemplate){t.removeAt(e);e--}}}export class _MultiRowNewRowTemplate extends _NewRowTemplate{constructor(e){super();this._idxRecord=e}get recordIndex(){return this._idxRecord}}_registerModule("wijmo.grid.multirow",selfModule); |
/*! | ||
* | ||
* Wijmo Library 5.20241.001-nightly.d20240111.t020133 | ||
* Wijmo Library 5.20241.001-nightly.d20240112.t020133 | ||
* 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 __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)};import{ObservableArray,NotifyCollectionChangedEventArgs,assert,asBoolean,copy,isArray,toHeaderCase,getType,isIE,asInt,Key,addClass,createElement,hasItems,asArray,toggleClass,isFunction,isString,isBoolean,Event,CancelEventArgs,CollectionViewGroup,NotifyCollectionChangedAction,_registerModule}from"@grapecity/wijmo";import{Row,GroupRow,CellRange,RowColFlags,CellRangeEventArgs,Column,ColumnCollection,CellType,FlexGrid,_AddNewHandler,_NewRowTemplate,SelMove,_SelectionHandler,_EditHandler,SelectionMode,AllowDragging,MergeManager}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.multirow";var _MultiRowSelectionHandler=function(e){__extends(_MultiRowSelectionHandler,e);function _MultiRowSelectionHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowSelectionHandler.prototype._getNextColumnCell=function(t,o,r,n){void 0===n&&(n=0);var l=this._g,i=l.cells,a=l.columns,s=SelMove;switch(r){case s.NextEditableCell:for(var u=o+1;u<a.length;u++){if((c=l._getBindingColumn(i,t,a[u])).renderSize>0&&!c.isReadOnly)return u}return o;case s.PrevEditableCell:for(u=o-1;u>=0;u--){var c;if((c=l._getBindingColumn(i,t,a[u])).renderSize>0&&!c.isReadOnly)return u}return o}return e.prototype._getNextColumnCell.call(this,t,o,r,n)};return _MultiRowSelectionHandler}(_SelectionHandler);export{_MultiRowSelectionHandler};var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o,r){var n=e.call(this,t)||this;n._idxData=o;n._idxRecord=r;return n}Object.defineProperty(_MultiRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRow}(Row);export{_MultiRow};var _MultiGroupRow=function(e){__extends(_MultiGroupRow,e);function _MultiGroupRow(t,o){var r=e.call(this,t)||this;r._idxRecord=o;return r}Object.defineProperty(_MultiGroupRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});Object.defineProperty(_MultiGroupRow.prototype,"hasChildren",{get:function(){return!0},enumerable:!0,configurable:!0});_MultiGroupRow.prototype.getCellRange=function(){var t=this._getLastRowInHeader();return t!=this?t.getCellRange():e.prototype.getCellRange.call(this)};Object.defineProperty(_MultiGroupRow.prototype,"isCollapsed",{get:function(){return this._getLastRowInHeader()._getFlag(RowColFlags.Collapsed)},set:function(e){var t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(asBoolean(e))},enumerable:!0,configurable:!0});_MultiGroupRow.prototype._setCollapsed=function(e){var t=this,o=this.grid,r=o.rows,n=this.getCellRange(),l=new CellRangeEventArgs(o.cells,new CellRange(this.index,-1));if(o.onGroupCollapsedChanging(l)){o.deferUpdate((function(){r.deferUpdate((function(){t._setFlag(RowColFlags.Collapsed,e,!0);for(var o=n.topRow+1;o<=n.bottomRow&&o>-1&&o<r.length;o++){r[o]._setFlag(RowColFlags.ParentCollapsed,e,!0);var l=r[o];if(l instanceof _MultiGroupRow){var i=l._getLastRowInHeader();for(o+=1;o<=i.index;o++)(l=r[o])._setFlag(RowColFlags.ParentCollapsed,e,!0);o--}l instanceof GroupRow&&l.isCollapsed&&(o=l.getCellRange().bottomRow)}}))}));o.onGroupCollapsedChanged(l)}};_MultiGroupRow.prototype._getLastRowInHeader=function(){var e=this.grid,t=this;if(e&&e.multiRowGroupHeaders)for(var o=e.rows,r=this.dataItem,n=this.index+1;n<o.length&&o[n].dataItem==r;n++)t=o[n];assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t};return _MultiGroupRow}(GroupRow);export{_MultiGroupRow};var _MultiRowEditHandler=function(e){__extends(_MultiRowEditHandler,e);function _MultiRowEditHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowEditHandler.prototype._selectionChanging=function(e){var t=this;if(this.finishEditing()){var o=this._g._selHdl.selection.row;if(o!=e.row){var r=this._g.rows.length;if((o>-1&&o<r?this._g.rows[o].dataItem:null)!=(e.row>-1&&e.row<r?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){var n=!this._g.rows[o]||this._g.rows[o]&&Object.getPrototypeOf(this._g.rows[o])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(o);null!==n&&setTimeout((function(){t._g.select(n);t.startEditing(!0,n.row,n.col,!0,e)}))}}}}else e.cancel=!0};return _MultiRowEditHandler}(_EditHandler);export{_MultiRowEditHandler};var MultiRowCellCollection=function(e){__extends(MultiRowCellCollection,e);function MultiRowCellCollection(){return null!==e&&e.apply(this,arguments)||this}MultiRowCellCollection.prototype._setLayout=function(e){this._layout=e;this.forEach((function(t){return t._setLayout(e)}))};MultiRowCellCollection.prototype.onCollectionChanged=function(t){void 0===t&&(t=NotifyCollectionChangedEventArgs.reset);var o=this._layout;o&&o._onLayoutChanged();e.prototype.onCollectionChanged.call(this,t)};return MultiRowCellCollection}(ObservableArray);export{MultiRowCellCollection};var _MultiRowLayout=function(){function _MultiRowLayout(e,t,o){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=o;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_MultiRowLayout.prototype._dispose=function(){if(!this._disposed){this._disposed=!0;var e=this._bindingGroups;e.forEach((function(e){e.cells._setLayout(null)}));e._setLayout(null);this._bindingGroups=null}};_MultiRowLayout.prototype._onLayoutChanged=function(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()};_MultiRowLayout.prototype._parseCellGroups=function(e){var t=this,o=this._grid,r=null,n=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")}));r=e}else{r=new MultiRowCellCollection;for(var l=0;l<e.length;l++){var i=null;i=e[l]instanceof MultiRowCellGroup?e[l]:new MultiRowCellGroup(e[l]);r.push(i)}}r.forEach((function(e){e.openGroup()}));l=0;for(var a=0;l<r.length;l++){(i=r[l])._colstart=a;a+=i._colspanEff;n=Math.max(n,i._rowspanEff)}r.forEach((function(e){e.closeGroup(o,n)}));this._rowsPerItem=n}else r=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(r);r.forEach((function(e){e.cells._setLayout(t)}));r._setLayout(this);return r};_MultiRowLayout.prototype._getMultiRowGroupHeaderRange=function(e){for(var t=this._rowsPerItem,o=new CellRange(0,0,t-1,0),r=0;r<e.length;r++){var n=e[r];if(n._hasAggregates){0===r&&this._expandMultiRowGroupHeaderToAggregate(o,n);return o}o.col2=n._colstart+n._colspanEff-1}return o};_MultiRowLayout.prototype._expandMultiRowGroupHeaderToAggregate=function(e,t){var o=this._rowsPerItem,r=t._colspanEff,n=t.cells.filter((function(e){return e.col>0&&0!=e.aggregate})).map((function(e){return e.col})).reduce((function(e,t){return t<e?t:e}),r);e.col2=Math.max(t._colstart+n-1,e.col2);for(var l=n;l<r;l++){for(var i=!0,a=0;a<o;a++){var s=t._getCellRange(a,l);i=i&&s.col===l}if(i){e.col2=Math.max(t._colstart+l-1,e.col2);return}}};_MultiRowLayout.prototype._getSingleRowGroupHeaderRange=function(e,t,o){var r=this._bindingGroups;if(0===r.length)return null;var n=this._getGroupByColumn(o);assert(null!=n,"Failed to get the group!");var l=n._getCellRange(0,o-n._colstart),i=new CellRange(t,n._colstart+l.col,t,n._colstart+l.col2);if(0!=n.getBindingColumn(e,t,o).aggregate)return i;for(var a=r[0]._colstart,s=o-1;s>=a;s--){var u=this._getGroupByColumn(s);assert(null!=u,"Failed to get the group!");if(0!=u.getBindingColumn(e,t,s).aggregate)break;l=u._getCellRange(0,s-u._colstart);i.col=u._colstart+l.col}var c=r[r.length-1],p=c._colstart+c._colspanEff;for(s=o+1;s<p;s++){var d=this._getGroupByColumn(s);assert(null!=d,"Failed to get the group!");if(0!=d.getBindingColumn(e,t,s).aggregate)break;l=d._getCellRange(0,s-d._colstart);i.col2=d._colstart+l.col2}return i};_MultiRowLayout.prototype._getGroupHeaderMergedRange=function(e,t,o,r){if(r){var n=this._multiRowGroupHeaderRange;if(n.containsColumn(o)){var l=this._rowsPerItem,i=Math.floor(t/l)*l;return new CellRange(i+n.row,n.col,i+n.row2,n.col2)}var a=this._getGroupByColumn(o);assert(a instanceof MultiRowCellGroup,"Failed to get the group!");return a.getMergedRange(e,t,o)}return this._getSingleRowGroupHeaderRange(e,t,o)};_MultiRowLayout.prototype._getGroupByColumn=function(e){var t=this._groupsByColumn[e];if(!t)for(var o=this._bindingGroups,r=0;r<o.length;r++)if(e>=(t=o[r])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}return t};_MultiRowLayout.prototype._updateCellTypes=function(e){this._bindingGroups.forEach((function(t){t._cols.forEach((function(t){null==t.dataType&&t._binding&&(t.dataType=getType(t._binding.getValue(e)));if(!t.isReadOnly){var o=isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=o&&!o.writable&&!o.set}}))}))};return _MultiRowLayout}();export{_MultiRowLayout};var MultiRowCell=function(e){__extends(MultiRowCell,e);function MultiRowCell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;copy(o,t);return o}Object.defineProperty(MultiRowCell.prototype,"row",{get:function(){return this._row},set:function(e){var t=asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"col",{get:function(){return this._col},set:function(e){var t=asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){var t=asInt(e,!1,!0);assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){var t=asInt(e,!1,!0);assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCell.prototype._setLayout=function(e){this._layout=e};MultiRowCell.prototype._onLayoutPropertyChanged=function(){var e=this._layout;e&&e._onLayoutChanged()};return MultiRowCell}(Column);export{MultiRowCell};var MultiRowCellGroup=function(e){__extends(MultiRowCellGroup,e);function MultiRowCellGroup(t){var o=e.call(this)||this;o._isRowHeader=!1;o._colstart=0;o._cells=new MultiRowCellCollection;copy(o,t);return o}MultiRowCellGroup.prototype._copy=function(e,t){if("cells"==e){isArray(t)&&(this._cellsDef=t);return!0}return!1};Object.defineProperty(MultiRowCellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCellGroup.prototype,"isRowHeader",{get:function(){return this._isRowHeader},set:function(e){var t=asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCellGroup.prototype.openGroup=function(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()};MultiRowCellGroup.prototype.closeGroup=function(e,t){var o=this;if(t>this._rowspanEff){this._cells.forEach((function(e){e.row==o._rowspanEff-1&&(e._rowspanEff=t-e.row)}));this._rowspanEff=t}this._cells.forEach((function(e){for(;e.col+e._colspanEff<o._colspanEff&&!o._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++}));this._cells.forEach((function(e){for(;e.row+e._rowspanEff<o._rowspanEff&&!o._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++}));if(this._cells.length>0)for(var r=0;r<this._rowspanEff;r++)for(var n=0;n<this._colspanEff;n++)assert(this._slotTaken(r,n),"Invalid layout (empty cells).");this._cols=new ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach((function(e){for(var t=0;t<e._rowspanEff;t++)for(var r=0;r<e._colspanEff;r++){var n=(e.row+t)*o._colspanEff+e.col+r;o._cols.setAt(n,e);var l=new CellRange(0-t,0-r,0-t+e._rowspanEff-1,0-r+e._colspanEff-1);l.isSingleCell||(o._rng[n]=l)}}));var l=this._colstart;this._rng[-1]=new CellRange(0,l,0,l+this._colspanEff-1);this._hasAggregates=!1;for(var i=0;i<this._cells.length&&!this._hasAggregates;i++)this._hasAggregates=0!=this._cells[i].aggregate};MultiRowCellGroup.prototype.getColumnWidth=function(e){for(var t=0;t<this._cells.length;t++){var o=this._cells[t];if(o.col==e&&1==o._colspanEff)return o.width}return null};MultiRowCellGroup.prototype.getMergedRange=function(e,t,o){if(t<0)return this._rng[-1];var r=e.rows[t],n=null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,l=o-this._colstart,i=this._rng[n*this._colspanEff+l];e.cellType==CellType.ColumnHeader&&t++;return i?new CellRange(t+i.row,o+i.col,t+i.row2,o+i.col2):null};MultiRowCellGroup.prototype.getBindingColumn=function(e,t,o){if(t<0)return this;var r=e.rows[t],n=r&&null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,l=o-this._colstart;return this._cols[n*this._colspanEff+l]};MultiRowCellGroup.prototype.getColumn=function(e){return this._cols.getColumn(e)};MultiRowCellGroup.prototype._getCellRange=function(e,t){var o=this._rng[e*this._colspanEff+t];return o?new CellRange(e+o.row,t+o.col,e+o.row2,t+o.col2):new CellRange(e,t)};MultiRowCellGroup.prototype._parseCells=function(e){var t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){assert(e instanceof MultiRowCell,"cells contain items of invalid type")}));t=e}else e.forEach((function(e){var o=null;o=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(o)}));t.forEach((function(e){e.binding&&!e.header&&(e.header=toHeaderCase(e.binding))}))}return t};MultiRowCellGroup.prototype._clearCalculations=function(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach((function(e){e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0}))};MultiRowCellGroup.prototype._calculate=function(){var e=this;this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach((function(t){e._colspanEff=Math.max(e._colspanEff,t.colspan);t._colspanEff=t.colspan;t._rowspanEff=t.rowspan}));var t=0,o=0;this._cells.forEach((function(r,n){for(;!e._cellFits(r,n,t,o);)0==(o=(o+1)%e._colspanEff)&&t++;r.row=t;r.col=o}));var r=1,n=1;this._cells.forEach((function(e){r=Math.max(r,e.row+e._rowspanEff);n=Math.max(n,e.col+e._colspanEff)}));this._rowspanEff=r;this._colspanEff=n};MultiRowCellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e._colspanEff>this._colspanEff)return!1;for(var n=0;n<e._colspanEff;n++)if(this._slotTaken(o,r+n,t))return!1;this._colspanEff=Math.max(this._colspanEff,r+e._colspanEff-1);return!0};MultiRowCellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var n=this._cells[r];if(e>=n.row&&e<=n.row+n._rowspanEff-1&&t>=n.col&&t<=n.col+n._colspanEff-1)return!0}return!1};return MultiRowCellGroup}(MultiRowCell);export{MultiRowCellGroup};var MultiRow=function(e){__extends(MultiRow,e);function MultiRow(t,o){var r=e.call(this,t)||this;r._hdrLayoutDef=null;r._centerVert=!0;r._collapsedHeaders=!1;r._multiRowGroupHeaders=!1;r._rowHdrCnt=0;r.collapsedHeadersChanging=new Event;r.collapsedHeadersChanged=new Event;r._layoutDef=new MultiRowCellCollection;r._layout=new _MultiRowLayout(r,r._layoutDef,(function(){return r._onLayoutChanged()}));addClass(r.hostElement,"wj-multirow");var n=r.columnHeaders.hostElement.parentElement,l=createElement('<div class="wj-hdr-collapse"><span></span></div>');l.style.display="none";n.appendChild(l);r._btnCollapse=l;r._updateButtonGlyph();r.addEventListener(l,"mousedown",(function(e){switch(r.collapsedHeaders){case null:case!1:r._collapsedHeadersWasNull=null==r.collapsedHeaders;r.collapsedHeaders=!0;break;case!0:r.collapsedHeaders=!!r._collapsedHeadersWasNull&&null}e.preventDefault();r.focus()}),!0);var i=r.hostElement;r.addEventListener(i,"mousedown",(function(e){if(!r._mouseHdl._szRowCol){var t=r._layout?r._layout._bindingGroups:null,o=t&&t.length?t[0]:null;if(o&&o.isRowHeader){var n=r.hitTest(e);if(n.panel==r.columnHeaders&&n.col<r.columns.frozen){e.preventDefault();r.selectAll()}}}}),!0);["dragover","dragleave","dragdrop"].forEach((function(e){r.removeEventListener(i,e)}));r._edtHdl=new _MultiRowEditHandler(r);r._addHdl=new _MultiRowAddNewHandler(r);r.formatItem.addHandler(r._formatItem,r);r.autoGenerateColumns=!1;r.allowDragging=AllowDragging.None;r.mergeManager=new _MergeManager;r.initialize(o);return r}MultiRow.prototype._getProductInfo=function(){return"H87K,MultiRow"};Object.defineProperty(MultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){var t=this;this.finishEditing()||this.finishEditing(!0);this._layoutDef=asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,(function(){return t._onLayoutChanged()}));this._rowHdrCnt=0;if(this._layout)for(var o=this._layout._bindingGroups,r=0;r<o.length;r++){var n=o[r];if(!n.isRowHeader)break;this._rowHdrCnt=n._colstart+n._colspanEff;n.cells.forEach((function(e){e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"}))}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"recordViewRange",{get:function(){var e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return __assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"headerLayoutDefinition",{get:function(){return this._hdrLayoutDef},set:function(e){var t=this;this._hdrLayoutDef=asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}var o=null;e&&(o=new _MultiRowLayout(this,e,(function(){return t._onHeaderLayoutChanged()})));this._hdrLayout=o;this._bindGrid(!0)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"rowsPerItem",{get:function(){return this._layout._rowsPerItem},enumerable:!0,configurable:!0});MultiRow.prototype.getBindingColumn=function(e,t,o){return this._getBindingColumn(e,t,e.columns[o])};MultiRow.prototype.getColumn=function(t,o){if(isString(t)){for(var r=o&&this._hdrLayout,n=(r?this._hdrLayout:this._layout)._bindingGroups,l=null,i=0;i<n.length&&!l;i++)l=n[i].getColumn(t);return!l&&r?this.getColumn(t,!1):l}return e.prototype.getColumn.call(this,t)};Object.defineProperty(MultiRow.prototype,"centerHeadersVertically",{get:function(){return this._centerVert},set:function(e){if(e!=this._centerVert){this._centerVert=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"collapsedHeaders",{get:function(){return this._collapsedHeaders},set:function(e){if(e!=this._collapsedHeaders){var t=new CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"showHeaderCollapseButton",{get:function(){return""==this._btnCollapse.style.display},set:function(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=asBoolean(e)?"":"none")},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"multiRowGroupHeaders",{get:function(){return this._multiRowGroupHeaders},set:function(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=asBoolean(e);this._bindGrid(!0)}},enumerable:!0,configurable:!0});MultiRow.prototype.onCollapsedHeadersChanging=function(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel};MultiRow.prototype.onCollapsedHeadersChanged=function(e){this.collapsedHeadersChanged.raise(this,e)};Object.defineProperty(MultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(e){assert(!e,"MultiRow does not support pinning.")},enumerable:!0,configurable:!0});MultiRow.prototype.onSelectionChanging=function(t){var o=t._rng;if(o&&o.isValid&&this.selectionMode){var r=this._mouseHdl._htDown,n=this.rows,l=this.columns,i=this._rowHdrCnt;if(i){o.col=Math.max(o.col,i);o.col2=Math.max(o.col2,i)}if(r&&(r.panel==this.rowHeaders||r.panel==this.cells&&r.col<i)){var a=n[o.topRow],s=n[o.bottomRow];if(a&&null!=a.recordIndex){var u=a.index-a.recordIndex,c=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,p=s.index-s.recordIndex+c-1,d=l.length-1,_=o.row!=o.topRow?new CellRange(p,0,u,d):new CellRange(u,0,p,d);o.row=_.row;o.row2=_.row2;o.col2=d;switch(this.selectionMode){case SelectionMode.Cell:o.row2=_.row;o.col2=_.col;break;case SelectionMode.Row:o.row2=_.row}}}}return e.prototype.onSelectionChanging.call(this,t)};MultiRow.prototype._createSelHdl=function(){return new _MultiRowSelectionHandler(this)};MultiRow.prototype._getDeleteColumnIndex=function(){return this._rowHdrCnt};MultiRow.prototype._getQuickAutoSize=function(){return isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter};MultiRow.prototype._addBoundRow=function(e,t){for(var o=e[t],r=0;r<this.rowsPerItem;r++)this.rows.push(new _MultiRow(o,t,r))};MultiRow.prototype._addNode=function(e,t,o){this._addBoundRow(e,t)};MultiRow.prototype._addGroupRow=function(e){for(var t=this._multiRowGroupHeaders?this.rowsPerItem:1,o=0;o<t;o++)this.rows.push(new _MultiGroupRow(e,o))};MultiRow.prototype._bindColumns=function(){for(var e=this,t=this.columnHeaders.rows,o=this._layout,r=this._hdrLayout,n=(r?r._rowsPerItem:this.rowsPerItem)+1;t.length>n;)t.removeAt(t.length-1);for(;t.length<n;)t.push(new Row);this._updateCollapsedHeaders();this.columns.clear();if(o&&o._bindingGroups){var l="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");o._bindingGroups.forEach((function(t){for(var _loop_1=function(o){if(0===t.cells.length)return"continue";for(var r=new Column,_loop_2=function(e){var n=t.cells[e];n.col==o&&l.forEach((function(e){null!=n[e]&&n[e]!=r[e]&&(r[e]=n[e])}))},n=0;n<t.cells.length;n++)_loop_2(n);e.columns.push(r)},o=0;o<t._colspanEff;o++)_loop_1(o)}))}};MultiRow.prototype._updateCollapsedHeaders=function(){var e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(var o=1;o<e.length;o++)e[o].visible=1!=t};MultiRow.prototype._updateColumnTypes=function(){e.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(hasItems(t)){var o=t.items[0];this._layout&&this._layout._updateCellTypes(o);this._hdrLayout&&this._hdrLayout._updateCellTypes(o)}};MultiRow.prototype._getBindingColumn=function(e,t,o){if(o&&(e==this.cells||e==this.columnHeaders)){var r=e.cellType==CellType.ColumnHeader;r&&t--;o=this._getGroupByColumn(o.index,r).getBindingColumn(e,t,o.index)}return o};MultiRow.prototype._getBindingColumns=function(){var e=[];this._layout._bindingGroups.forEach((function(t){t._cols.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))}));return e};MultiRow.prototype._getRowsPerItem=function(){return this.rowsPerItem};MultiRow.prototype._cvCollectionChanged=function(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{var o=NotifyCollectionChangedAction;switch(t.action){case o.Change:this.invalidate();break;case o.Add:if(t.index==this.collectionView.items.length-1){for(var r=this.rows.length;r>0&&this.rows[r-1]instanceof _NewRowTemplate;)r--;for(var n=0;n<this.rowsPerItem;n++)this.rows.insert(r+n,new _MultiRow(t.item,t.index,n));return}assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}};MultiRow.prototype._getGroupByColumn=function(e,t){var o=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(o=this._hdrLayout._getGroupByColumn(e));o||(o=this._layout._getGroupByColumn(e));assert(o instanceof MultiRowCellGroup,"Failed to get the group!");return o};MultiRow.prototype._onLayoutChanged=function(){this.layoutDefinition=this._layoutDef};MultiRow.prototype._onHeaderLayoutChanged=function(){this.headerLayoutDefinition=this._hdrLayoutDef};MultiRow.prototype._formatItem=function(e,t){var o=this.rowsPerItem,r=t.panel,n=r.cellType,l=r.rows[t.range.row],i=r.rows[t.range.row2],a=t.cell,s=CellType;n==s.ColumnHeader&&toggleClass(a,"wj-group-header",0==t.range.row);if(n==s.Cell||n==s.ColumnHeader){var u=this._getGroupByColumn(t.col,n==s.ColumnHeader);toggleClass(a,"wj-group-start",u._colstart==t.range.col);toggleClass(a,"wj-group-end",u._colstart+u._colspanEff-1==t.range.col2)}if(o>1&&(n==s.Cell||n==s.RowHeader)){var c=i instanceof _MultiRow||i instanceof _MultiRowNewRowTemplate;toggleClass(a,"wj-record-start",!!(l instanceof _MultiRow||l instanceof _MultiRowNewRowTemplate)&&0==l.recordIndex);toggleClass(a,"wj-record-end",!!c&&i.recordIndex==o-1)}var p=this.alternatingRowStep;if(p){var d=!1;if(l instanceof _MultiRow){d=l.dataIndex%(p+1)==0;1==p&&(d=!d)}toggleClass(a,"wj-alt",d)}if(this._centerVert&&!a.getAttribute("wj-state-measuring")){var _=t.range.rowSpan>1;if(_&&t.updateContent)if(0==a.childElementCount)a.innerHTML="<div>"+a.innerHTML+"</div>";else{var h=document.createElement("div"),f=document.createRange();f.selectNodeContents(a);f.surroundContents(h)}toggleClass(a,"wj-center-vert",_)}};MultiRow.prototype._updateButtonGlyph=function(){var e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")};MultiRow.prototype._getError=function(t,o,r,n){if(isFunction(this.itemValidator)&&t==this.rowHeaders){for(var l=[],i=0;i<this.rowsPerItem;i++)for(r=0;r<this.columns.length;r++){var a=this.itemValidator(o+i,r,n);if(a){var s=this.getMergedRange(this.cells,o+i,r);s&&(s.columnSpan>1&&s.col<r||s.rowSpan>1&&s.row<o+i)||l.push(a)}}if(l.length){var u=this.errorTip,c=!!u&&u.isContentHtml;return l.join(c?"<br/>":"\n")}}return e.prototype._getError.call(this,t,o,r,n)};MultiRow.prototype._getEmptyRequiredCell=function(e){if(e>=0){e-=this.rows[e].recordIndex;for(var t=0;t<this._getRowsPerItem();t++)for(var o=e+t,r=0;r<this.columns.length;r++){var n=this._getBindingColumn(this.cells,o,this.columns[r]),l=this.getCellData(o,r,!1);if(n.getIsRequired(this.rows[o])&&(""===l||null==l)){if(!n.isReadOnly)return new CellRange(o,r);console.warn("Incorrect data. Column "+r+" is at the same time required, empty and read-only")}}}return null};return MultiRow}(FlexGrid);export{MultiRow};var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var n=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:if(e.rows[t]instanceof GroupRow&&!n.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,o,r,!1)}switch(e.cellType){case CellType.Cell:if(e.rows[t]instanceof GroupRow)return this._getGroupRowMergedRange(e,t,o,r,n.multiRowGroupHeaders);case CellType.ColumnHeader:var l=e.cellType==CellType.ColumnHeader,i=n._getGroupByColumn(o,l);assert(i instanceof MultiRowCellGroup,"Failed to get the group!");var a=l?i.getMergedRange(e,t-1,o):i.getMergedRange(e,t,o),s=e.columns.frozen;if(s&&a&&a.columnSpan>1&&a.col<s&&a.col2>=s){a=a.clone();o<s?a.col2=s-1:a.col=s}var u=e.rows.frozen;if(u&&a&&a.rowSpan>1&&e.cellType==CellType.Cell&&a.row<u&&a.row2>=u){a=a.clone();t<u?a.row2=u-1:a.row=u}assert(!a||a.contains(t,o),"Merged range must contain source cell");return a;case CellType.RowHeader:var c=n.rowsPerItem,p=t-e.rows[t].recordIndex,d=Math.min(p+c-1,e.rows.length-1);return new CellRange(p,0,d,e.columns.length-1);case CellType.TopLeft:var _=n.collapsedHeaders,h=e.rows.length-1,f=h>0?1:0;return new CellRange(0!=_?0:f,0,1!=_?h:f,e.columns.length-1)}return null};_MergeManager.prototype._getGroupRowMergedRange=function(t,o,r,n,l){void 0===n&&(n=!0);var i=t.grid,a=t.cellType,s=t.rows[o];if(i.showGroups&&!i.childItemsPath&&s instanceof _MultiGroupRow&&s.dataItem instanceof CollectionViewGroup&&a==CellType.Cell){return i._layout._getGroupHeaderMergedRange(t,o,r,l)}return e.prototype.getMergedRange.call(this,t,o,r,n)};return _MergeManager}(MergeManager);export{_MergeManager};var _MultiRowAddNewHandler=function(e){__extends(_MultiRowAddNewHandler,e);function _MultiRowAddNewHandler(t){t._addHdl._detach();return e.call(this,t)||this}_MultiRowAddNewHandler.prototype.updateNewRowTemplate=function(){for(var e=this._g.editableCollectionView,t=this._g,o=t.rows,r=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,n=-1,l=0;l<o.length;l+=t.rowsPerItem)if(o[l]instanceof _MultiRowNewRowTemplate){n=l;break}if(r&&n>-1&&(this._top&&n>0||!this._top&&0==n)){n=-1;this._removeNewRowTemplate()}if(r&&n<0)for(l=0;l<t.rowsPerItem;l++){var i=new _MultiRowNewRowTemplate(l);0==l&&(this._nrt=i);this._top?o.insert(l,i):o.push(i)}!r&&n>-1&&this._removeNewRowTemplate()};_MultiRowAddNewHandler.prototype._keydown=function(t){e.prototype._keydown.call(this,t);t.defaultPrevented||t.keyCode!=Key.Escape||this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._beginningEdit=function(t,o){e.prototype._beginningEdit.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditStarting=function(t,o){e.prototype._rowEditStarting.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditEnded=function(t,o){e.prototype._rowEditEnded.call(this,t,o);this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._copyNewDataItem=function(){if(this._top)for(var e=this._g,t=e.rows,o=0;o<e.rowsPerItem;o++)t[o]instanceof _NewRowTemplate&&(t[o].dataItem=this._nrt.dataItem)};_MultiRowAddNewHandler.prototype._removeNewRowTemplate=function(){for(var e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof _NewRowTemplate){t.removeAt(e);e--}};return _MultiRowAddNewHandler}(_AddNewHandler);export{_MultiRowAddNewHandler};var _MultiRowNewRowTemplate=function(e){__extends(_MultiRowNewRowTemplate,e);function _MultiRowNewRowTemplate(t){var o=e.call(this)||this;o._idxRecord=t;return o}Object.defineProperty(_MultiRowNewRowTemplate.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRowNewRowTemplate}(_NewRowTemplate);export{_MultiRowNewRowTemplate};_registerModule("wijmo.grid.multirow",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 __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)};import{ObservableArray,NotifyCollectionChangedEventArgs,assert,asBoolean,copy,isArray,toHeaderCase,getType,isIE,asInt,Key,addClass,createElement,hasItems,asArray,toggleClass,isFunction,isString,isBoolean,Event,CancelEventArgs,CollectionViewGroup,NotifyCollectionChangedAction,_registerModule}from"@grapecity/wijmo";import{Row,GroupRow,CellRange,RowColFlags,CellRangeEventArgs,Column,ColumnCollection,CellType,FlexGrid,_AddNewHandler,_NewRowTemplate,SelMove,_SelectionHandler,_EditHandler,SelectionMode,AllowDragging,MergeManager}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.multirow";var _MultiRowSelectionHandler=function(e){__extends(_MultiRowSelectionHandler,e);function _MultiRowSelectionHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowSelectionHandler.prototype._getNextColumnCell=function(t,o,r,n){void 0===n&&(n=0);var l=this._g,i=l.cells,a=l.columns,s=SelMove;switch(r){case s.NextEditableCell:for(var u=o+1;u<a.length;u++){if((c=l._getBindingColumn(i,t,a[u])).renderSize>0&&!c.isReadOnly)return u}return o;case s.PrevEditableCell:for(u=o-1;u>=0;u--){var c;if((c=l._getBindingColumn(i,t,a[u])).renderSize>0&&!c.isReadOnly)return u}return o}return e.prototype._getNextColumnCell.call(this,t,o,r,n)};return _MultiRowSelectionHandler}(_SelectionHandler);export{_MultiRowSelectionHandler};var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o,r){var n=e.call(this,t)||this;n._idxData=o;n._idxRecord=r;return n}Object.defineProperty(_MultiRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRow}(Row);export{_MultiRow};var _MultiGroupRow=function(e){__extends(_MultiGroupRow,e);function _MultiGroupRow(t,o){var r=e.call(this,t)||this;r._idxRecord=o;return r}Object.defineProperty(_MultiGroupRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});Object.defineProperty(_MultiGroupRow.prototype,"hasChildren",{get:function(){return!0},enumerable:!0,configurable:!0});_MultiGroupRow.prototype.getCellRange=function(){var t=this._getLastRowInHeader();return t!=this?t.getCellRange():e.prototype.getCellRange.call(this)};Object.defineProperty(_MultiGroupRow.prototype,"isCollapsed",{get:function(){return this._getLastRowInHeader()._getFlag(RowColFlags.Collapsed)},set:function(e){var t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(asBoolean(e))},enumerable:!0,configurable:!0});_MultiGroupRow.prototype._setCollapsed=function(e){var t=this,o=this.grid,r=o.rows,n=this.getCellRange(),l=new CellRangeEventArgs(o.cells,new CellRange(this.index,-1));if(o.onGroupCollapsedChanging(l)){o.deferUpdate((function(){r.deferUpdate((function(){t._setFlag(RowColFlags.Collapsed,e,!0);for(var o=n.topRow+1;o<=n.bottomRow&&o>-1&&o<r.length;o++){r[o]._setFlag(RowColFlags.ParentCollapsed,e,!0);var l=r[o];if(l instanceof _MultiGroupRow){var i=l._getLastRowInHeader();for(o+=1;o<=i.index;o++)(l=r[o])._setFlag(RowColFlags.ParentCollapsed,e,!0);o--}l instanceof GroupRow&&l.isCollapsed&&(o=l.getCellRange().bottomRow)}}))}));o.onGroupCollapsedChanged(l)}};_MultiGroupRow.prototype._getLastRowInHeader=function(){var e=this.grid,t=this;if(e&&e.multiRowGroupHeaders)for(var o=e.rows,r=this.dataItem,n=this.index+1;n<o.length&&o[n].dataItem==r;n++)t=o[n];assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t};return _MultiGroupRow}(GroupRow);export{_MultiGroupRow};var _MultiRowEditHandler=function(e){__extends(_MultiRowEditHandler,e);function _MultiRowEditHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowEditHandler.prototype._selectionChanging=function(e){var t=this;if(this.finishEditing()){var o=this._g._selHdl.selection.row;if(o!=e.row){var r=this._g.rows.length;if((o>-1&&o<r?this._g.rows[o].dataItem:null)!=(e.row>-1&&e.row<r?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){var n=!this._g.rows[o]||this._g.rows[o]&&Object.getPrototypeOf(this._g.rows[o])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(o);null!==n&&setTimeout((function(){t._g.select(n);t.startEditing(!0,n.row,n.col,!0,e)}))}}}}else e.cancel=!0};return _MultiRowEditHandler}(_EditHandler);export{_MultiRowEditHandler};var MultiRowCellCollection=function(e){__extends(MultiRowCellCollection,e);function MultiRowCellCollection(){return null!==e&&e.apply(this,arguments)||this}MultiRowCellCollection.prototype._setLayout=function(e){this._layout=e;this.forEach((function(t){return t._setLayout(e)}))};MultiRowCellCollection.prototype.onCollectionChanged=function(t){void 0===t&&(t=NotifyCollectionChangedEventArgs.reset);var o=this._layout;o&&o._onLayoutChanged();e.prototype.onCollectionChanged.call(this,t)};return MultiRowCellCollection}(ObservableArray);export{MultiRowCellCollection};var _MultiRowLayout=function(){function _MultiRowLayout(e,t,o){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=o;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_MultiRowLayout.prototype._dispose=function(){if(!this._disposed){this._disposed=!0;var e=this._bindingGroups;e.forEach((function(e){e.cells._setLayout(null)}));e._setLayout(null);this._bindingGroups=null}};_MultiRowLayout.prototype._onLayoutChanged=function(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()};_MultiRowLayout.prototype._parseCellGroups=function(e){var t=this,o=this._grid,r=null,n=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")}));r=e}else{r=new MultiRowCellCollection;for(var l=0;l<e.length;l++){var i=null;i=e[l]instanceof MultiRowCellGroup?e[l]:new MultiRowCellGroup(e[l]);r.push(i)}}r.forEach((function(e){e.openGroup()}));l=0;for(var a=0;l<r.length;l++){(i=r[l])._colstart=a;a+=i._colspanEff;n=Math.max(n,i._rowspanEff)}r.forEach((function(e){e.closeGroup(o,n)}));this._rowsPerItem=n}else r=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(r);r.forEach((function(e){e.cells._setLayout(t)}));r._setLayout(this);return r};_MultiRowLayout.prototype._getMultiRowGroupHeaderRange=function(e){for(var t=this._rowsPerItem,o=new CellRange(0,0,t-1,0),r=0;r<e.length;r++){var n=e[r];if(n._hasAggregates){0===r&&this._expandMultiRowGroupHeaderToAggregate(o,n);return o}o.col2=n._colstart+n._colspanEff-1}return o};_MultiRowLayout.prototype._expandMultiRowGroupHeaderToAggregate=function(e,t){var o=this._rowsPerItem,r=t._colspanEff,n=t.cells.filter((function(e){return e.col>0&&0!=e.aggregate})).map((function(e){return e.col})).reduce((function(e,t){return t<e?t:e}),r);e.col2=Math.max(t._colstart+n-1,e.col2);for(var l=n;l<r;l++){for(var i=!0,a=0;a<o;a++){var s=t._getCellRange(a,l);i=i&&s.col===l}if(i){e.col2=Math.max(t._colstart+l-1,e.col2);return}}};_MultiRowLayout.prototype._getSingleRowGroupHeaderRange=function(e,t,o){var r=this._bindingGroups;if(0===r.length)return null;var n=this._getGroupByColumn(o);assert(null!=n,"Failed to get the group!");var l=n._getCellRange(0,o-n._colstart),i=new CellRange(t,n._colstart+l.col,t,n._colstart+l.col2);if(0!=n.getBindingColumn(e,t,o).aggregate)return i;for(var a=r[0]._colstart,s=o-1;s>=a;s--){var u=this._getGroupByColumn(s);assert(null!=u,"Failed to get the group!");if(0!=u.getBindingColumn(e,t,s).aggregate)break;l=u._getCellRange(0,s-u._colstart);i.col=u._colstart+l.col}var c=r[r.length-1],p=c._colstart+c._colspanEff;for(s=o+1;s<p;s++){var d=this._getGroupByColumn(s);assert(null!=d,"Failed to get the group!");var _=d.getBindingColumn(e,t,s);if(_&&0!=_.aggregate)break;l=d._getCellRange(0,s-d._colstart);i.col2=d._colstart+l.col2}return i};_MultiRowLayout.prototype._getGroupHeaderMergedRange=function(e,t,o,r){if(r){var n=this._multiRowGroupHeaderRange;if(n.containsColumn(o)){var l=this._rowsPerItem,i=Math.floor(t/l)*l;return new CellRange(i+n.row,n.col,i+n.row2,n.col2)}var a=this._getGroupByColumn(o);assert(a instanceof MultiRowCellGroup,"Failed to get the group!");return a.getMergedRange(e,t,o)}return this._getSingleRowGroupHeaderRange(e,t,o)};_MultiRowLayout.prototype._getGroupByColumn=function(e){var t=this._groupsByColumn[e];if(!t)for(var o=this._bindingGroups,r=0;r<o.length;r++)if(e>=(t=o[r])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}return t};_MultiRowLayout.prototype._updateCellTypes=function(e){this._bindingGroups.forEach((function(t){t._cols.forEach((function(t){null==t.dataType&&t._binding&&(t.dataType=getType(t._binding.getValue(e)));if(!t.isReadOnly){var o=isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=o&&!o.writable&&!o.set}}))}))};return _MultiRowLayout}();export{_MultiRowLayout};var MultiRowCell=function(e){__extends(MultiRowCell,e);function MultiRowCell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;copy(o,t);return o}Object.defineProperty(MultiRowCell.prototype,"row",{get:function(){return this._row},set:function(e){var t=asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"col",{get:function(){return this._col},set:function(e){var t=asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){var t=asInt(e,!1,!0);assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){var t=asInt(e,!1,!0);assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCell.prototype._setLayout=function(e){this._layout=e};MultiRowCell.prototype._onLayoutPropertyChanged=function(){var e=this._layout;e&&e._onLayoutChanged()};return MultiRowCell}(Column);export{MultiRowCell};var MultiRowCellGroup=function(e){__extends(MultiRowCellGroup,e);function MultiRowCellGroup(t){var o=e.call(this)||this;o._isRowHeader=!1;o._colstart=0;o._cells=new MultiRowCellCollection;copy(o,t);return o}MultiRowCellGroup.prototype._copy=function(e,t){if("cells"==e){isArray(t)&&(this._cellsDef=t);return!0}return!1};Object.defineProperty(MultiRowCellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCellGroup.prototype,"isRowHeader",{get:function(){return this._isRowHeader},set:function(e){var t=asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCellGroup.prototype.openGroup=function(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()};MultiRowCellGroup.prototype.closeGroup=function(e,t){var o=this;if(t>this._rowspanEff){this._cells.forEach((function(e){e.row==o._rowspanEff-1&&(e._rowspanEff=t-e.row)}));this._rowspanEff=t}this._cells.forEach((function(e){for(;e.col+e._colspanEff<o._colspanEff&&!o._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++}));this._cells.forEach((function(e){for(;e.row+e._rowspanEff<o._rowspanEff&&!o._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++}));if(this._cells.length>0)for(var r=0;r<this._rowspanEff;r++)for(var n=0;n<this._colspanEff;n++)assert(this._slotTaken(r,n),"Invalid layout (empty cells).");this._cols=new ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach((function(e){for(var t=0;t<e._rowspanEff;t++)for(var r=0;r<e._colspanEff;r++){var n=(e.row+t)*o._colspanEff+e.col+r;o._cols.setAt(n,e);var l=new CellRange(0-t,0-r,0-t+e._rowspanEff-1,0-r+e._colspanEff-1);l.isSingleCell||(o._rng[n]=l)}}));var l=this._colstart;this._rng[-1]=new CellRange(0,l,0,l+this._colspanEff-1);this._hasAggregates=!1;for(var i=0;i<this._cells.length&&!this._hasAggregates;i++)this._hasAggregates=0!=this._cells[i].aggregate};MultiRowCellGroup.prototype.getColumnWidth=function(e){for(var t=0;t<this._cells.length;t++){var o=this._cells[t];if(o.col==e&&1==o._colspanEff)return o.width}return null};MultiRowCellGroup.prototype.getMergedRange=function(e,t,o){if(t<0)return this._rng[-1];var r=e.rows[t],n=null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,l=o-this._colstart,i=this._rng[n*this._colspanEff+l];e.cellType==CellType.ColumnHeader&&t++;return i?new CellRange(t+i.row,o+i.col,t+i.row2,o+i.col2):null};MultiRowCellGroup.prototype.getBindingColumn=function(e,t,o){if(t<0)return this;var r=e.rows[t],n=r&&null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,l=o-this._colstart;return this._cols[n*this._colspanEff+l]};MultiRowCellGroup.prototype.getColumn=function(e){return this._cols.getColumn(e)};MultiRowCellGroup.prototype._getCellRange=function(e,t){var o=this._rng[e*this._colspanEff+t];return o?new CellRange(e+o.row,t+o.col,e+o.row2,t+o.col2):new CellRange(e,t)};MultiRowCellGroup.prototype._parseCells=function(e){var t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){assert(e instanceof MultiRowCell,"cells contain items of invalid type")}));t=e}else e.forEach((function(e){var o=null;o=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(o)}));t.forEach((function(e){e.binding&&!e.header&&(e.header=toHeaderCase(e.binding))}))}return t};MultiRowCellGroup.prototype._clearCalculations=function(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach((function(e){e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0}))};MultiRowCellGroup.prototype._calculate=function(){var e=this;this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach((function(t){e._colspanEff=Math.max(e._colspanEff,t.colspan);t._colspanEff=t.colspan;t._rowspanEff=t.rowspan}));var t=0,o=0;this._cells.forEach((function(r,n){for(;!e._cellFits(r,n,t,o);)0==(o=(o+1)%e._colspanEff)&&t++;r.row=t;r.col=o}));var r=1,n=1;this._cells.forEach((function(e){r=Math.max(r,e.row+e._rowspanEff);n=Math.max(n,e.col+e._colspanEff)}));this._rowspanEff=r;this._colspanEff=n};MultiRowCellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e._colspanEff>this._colspanEff)return!1;for(var n=0;n<e._colspanEff;n++)if(this._slotTaken(o,r+n,t))return!1;this._colspanEff=Math.max(this._colspanEff,r+e._colspanEff-1);return!0};MultiRowCellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var n=this._cells[r];if(e>=n.row&&e<=n.row+n._rowspanEff-1&&t>=n.col&&t<=n.col+n._colspanEff-1)return!0}return!1};return MultiRowCellGroup}(MultiRowCell);export{MultiRowCellGroup};var MultiRow=function(e){__extends(MultiRow,e);function MultiRow(t,o){var r=e.call(this,t)||this;r._hdrLayoutDef=null;r._centerVert=!0;r._collapsedHeaders=!1;r._multiRowGroupHeaders=!1;r._rowHdrCnt=0;r.collapsedHeadersChanging=new Event;r.collapsedHeadersChanged=new Event;r._layoutDef=new MultiRowCellCollection;r._layout=new _MultiRowLayout(r,r._layoutDef,(function(){return r._onLayoutChanged()}));addClass(r.hostElement,"wj-multirow");var n=r.columnHeaders.hostElement.parentElement,l=createElement('<div class="wj-hdr-collapse"><span></span></div>');l.style.display="none";n.appendChild(l);r._btnCollapse=l;r._updateButtonGlyph();r.addEventListener(l,"mousedown",(function(e){switch(r.collapsedHeaders){case null:case!1:r._collapsedHeadersWasNull=null==r.collapsedHeaders;r.collapsedHeaders=!0;break;case!0:r.collapsedHeaders=!!r._collapsedHeadersWasNull&&null}e.preventDefault();r.focus()}),!0);var i=r.hostElement;r.addEventListener(i,"mousedown",(function(e){if(!r._mouseHdl._szRowCol){var t=r._layout?r._layout._bindingGroups:null,o=t&&t.length?t[0]:null;if(o&&o.isRowHeader){var n=r.hitTest(e);if(n.panel==r.columnHeaders&&n.col<r.columns.frozen){e.preventDefault();r.selectAll()}}}}),!0);["dragover","dragleave","dragdrop"].forEach((function(e){r.removeEventListener(i,e)}));r._edtHdl=new _MultiRowEditHandler(r);r._addHdl=new _MultiRowAddNewHandler(r);r.formatItem.addHandler(r._formatItem,r);r.autoGenerateColumns=!1;r.allowDragging=AllowDragging.None;r.mergeManager=new _MergeManager;r.initialize(o);return r}MultiRow.prototype._getProductInfo=function(){return"H87K,MultiRow"};Object.defineProperty(MultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){var t=this;this.finishEditing()||this.finishEditing(!0);this._layoutDef=asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,(function(){return t._onLayoutChanged()}));this._rowHdrCnt=0;if(this._layout)for(var o=this._layout._bindingGroups,r=0;r<o.length;r++){var n=o[r];if(!n.isRowHeader)break;this._rowHdrCnt=n._colstart+n._colspanEff;n.cells.forEach((function(e){e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"}))}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"recordViewRange",{get:function(){var e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return __assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"headerLayoutDefinition",{get:function(){return this._hdrLayoutDef},set:function(e){var t=this;this._hdrLayoutDef=asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}var o=null;e&&(o=new _MultiRowLayout(this,e,(function(){return t._onHeaderLayoutChanged()})));this._hdrLayout=o;this._bindGrid(!0)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"rowsPerItem",{get:function(){return this._layout._rowsPerItem},enumerable:!0,configurable:!0});MultiRow.prototype.getBindingColumn=function(e,t,o){return this._getBindingColumn(e,t,e.columns[o])};MultiRow.prototype.getColumn=function(t,o){if(isString(t)){for(var r=o&&this._hdrLayout,n=(r?this._hdrLayout:this._layout)._bindingGroups,l=null,i=0;i<n.length&&!l;i++)l=n[i].getColumn(t);return!l&&r?this.getColumn(t,!1):l}return e.prototype.getColumn.call(this,t)};Object.defineProperty(MultiRow.prototype,"centerHeadersVertically",{get:function(){return this._centerVert},set:function(e){if(e!=this._centerVert){this._centerVert=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"collapsedHeaders",{get:function(){return this._collapsedHeaders},set:function(e){if(e!=this._collapsedHeaders){var t=new CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"showHeaderCollapseButton",{get:function(){return""==this._btnCollapse.style.display},set:function(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=asBoolean(e)?"":"none")},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"multiRowGroupHeaders",{get:function(){return this._multiRowGroupHeaders},set:function(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=asBoolean(e);this._bindGrid(!0)}},enumerable:!0,configurable:!0});MultiRow.prototype.onCollapsedHeadersChanging=function(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel};MultiRow.prototype.onCollapsedHeadersChanged=function(e){this.collapsedHeadersChanged.raise(this,e)};Object.defineProperty(MultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(e){assert(!e,"MultiRow does not support pinning.")},enumerable:!0,configurable:!0});MultiRow.prototype.onSelectionChanging=function(t){var o=t._rng;if(o&&o.isValid&&this.selectionMode){var r=this._mouseHdl._htDown,n=this.rows,l=this.columns,i=this._rowHdrCnt;if(i){o.col=Math.max(o.col,i);o.col2=Math.max(o.col2,i)}if(r&&(r.panel==this.rowHeaders||r.panel==this.cells&&r.col<i)){var a=n[o.topRow],s=n[o.bottomRow];if(a&&null!=a.recordIndex){var u=a.index-a.recordIndex,c=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,p=s.index-s.recordIndex+c-1,d=l.length-1,_=o.row!=o.topRow?new CellRange(p,0,u,d):new CellRange(u,0,p,d);o.row=_.row;o.row2=_.row2;o.col2=d;switch(this.selectionMode){case SelectionMode.Cell:o.row2=_.row;o.col2=_.col;break;case SelectionMode.Row:o.row2=_.row}}}}return e.prototype.onSelectionChanging.call(this,t)};MultiRow.prototype._createSelHdl=function(){return new _MultiRowSelectionHandler(this)};MultiRow.prototype._getDeleteColumnIndex=function(){return this._rowHdrCnt};MultiRow.prototype._getQuickAutoSize=function(){return isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter};MultiRow.prototype._addBoundRow=function(e,t){for(var o=e[t],r=0;r<this.rowsPerItem;r++)this.rows.push(new _MultiRow(o,t,r))};MultiRow.prototype._addNode=function(e,t,o){this._addBoundRow(e,t)};MultiRow.prototype._addGroupRow=function(e){for(var t=this._multiRowGroupHeaders?this.rowsPerItem:1,o=0;o<t;o++)this.rows.push(new _MultiGroupRow(e,o))};MultiRow.prototype._bindColumns=function(){for(var e=this,t=this.columnHeaders.rows,o=this._layout,r=this._hdrLayout,n=(r?r._rowsPerItem:this.rowsPerItem)+1;t.length>n;)t.removeAt(t.length-1);for(;t.length<n;)t.push(new Row);this._updateCollapsedHeaders();this.columns.clear();if(o&&o._bindingGroups){var l="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");o._bindingGroups.forEach((function(t){for(var _loop_1=function(o){if(0===t.cells.length)return"continue";for(var r=new Column,_loop_2=function(e){var n=t.cells[e];n.col==o&&l.forEach((function(e){null!=n[e]&&n[e]!=r[e]&&(r[e]=n[e])}))},n=0;n<t.cells.length;n++)_loop_2(n);e.columns.push(r)},o=0;o<t._colspanEff;o++)_loop_1(o)}))}};MultiRow.prototype._updateCollapsedHeaders=function(){var e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(var o=1;o<e.length;o++)e[o].visible=1!=t};MultiRow.prototype._updateColumnTypes=function(){e.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(hasItems(t)){var o=t.items[0];this._layout&&this._layout._updateCellTypes(o);this._hdrLayout&&this._hdrLayout._updateCellTypes(o)}};MultiRow.prototype._getBindingColumn=function(e,t,o){if(o&&(e==this.cells||e==this.columnHeaders)){var r=e.cellType==CellType.ColumnHeader;r&&t--;o=this._getGroupByColumn(o.index,r).getBindingColumn(e,t,o.index)}return o};MultiRow.prototype._getBindingColumns=function(){var e=[];this._layout._bindingGroups.forEach((function(t){t._cols.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))}));return e};MultiRow.prototype._getRowsPerItem=function(){return this.rowsPerItem};MultiRow.prototype._cvCollectionChanged=function(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{var o=NotifyCollectionChangedAction;switch(t.action){case o.Change:this.invalidate();break;case o.Add:if(t.index==this.collectionView.items.length-1){for(var r=this.rows.length;r>0&&this.rows[r-1]instanceof _NewRowTemplate;)r--;for(var n=0;n<this.rowsPerItem;n++)this.rows.insert(r+n,new _MultiRow(t.item,t.index,n));return}assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}};MultiRow.prototype._getGroupByColumn=function(e,t){var o=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(o=this._hdrLayout._getGroupByColumn(e));o||(o=this._layout._getGroupByColumn(e));assert(o instanceof MultiRowCellGroup,"Failed to get the group!");return o};MultiRow.prototype._onLayoutChanged=function(){this.layoutDefinition=this._layoutDef};MultiRow.prototype._onHeaderLayoutChanged=function(){this.headerLayoutDefinition=this._hdrLayoutDef};MultiRow.prototype._formatItem=function(e,t){var o=this.rowsPerItem,r=t.panel,n=r.cellType,l=r.rows[t.range.row],i=r.rows[t.range.row2],a=t.cell,s=CellType;n==s.ColumnHeader&&toggleClass(a,"wj-group-header",0==t.range.row);if(n==s.Cell||n==s.ColumnHeader){var u=this._getGroupByColumn(t.col,n==s.ColumnHeader);toggleClass(a,"wj-group-start",u._colstart==t.range.col);toggleClass(a,"wj-group-end",u._colstart+u._colspanEff-1==t.range.col2)}if(o>1&&(n==s.Cell||n==s.RowHeader)){var c=i instanceof _MultiRow||i instanceof _MultiRowNewRowTemplate;toggleClass(a,"wj-record-start",!!(l instanceof _MultiRow||l instanceof _MultiRowNewRowTemplate)&&0==l.recordIndex);toggleClass(a,"wj-record-end",!!c&&i.recordIndex==o-1)}var p=this.alternatingRowStep;if(p){var d=!1;if(l instanceof _MultiRow){d=l.dataIndex%(p+1)==0;1==p&&(d=!d)}toggleClass(a,"wj-alt",d)}if(this._centerVert&&!a.getAttribute("wj-state-measuring")){var _=t.range.rowSpan>1;if(_&&t.updateContent)if(0==a.childElementCount)a.innerHTML="<div>"+a.innerHTML+"</div>";else{var h=document.createElement("div"),f=document.createRange();f.selectNodeContents(a);f.surroundContents(h)}toggleClass(a,"wj-center-vert",_)}};MultiRow.prototype._updateButtonGlyph=function(){var e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")};MultiRow.prototype._getError=function(t,o,r,n){if(isFunction(this.itemValidator)&&t==this.rowHeaders){for(var l=[],i=0;i<this.rowsPerItem;i++)for(r=0;r<this.columns.length;r++){var a=this.itemValidator(o+i,r,n);if(a){var s=this.getMergedRange(this.cells,o+i,r);s&&(s.columnSpan>1&&s.col<r||s.rowSpan>1&&s.row<o+i)||l.push(a)}}if(l.length){var u=this.errorTip,c=!!u&&u.isContentHtml;return l.join(c?"<br/>":"\n")}}return e.prototype._getError.call(this,t,o,r,n)};MultiRow.prototype._getEmptyRequiredCell=function(e){if(e>=0){e-=this.rows[e].recordIndex;for(var t=0;t<this._getRowsPerItem();t++)for(var o=e+t,r=0;r<this.columns.length;r++){var n=this._getBindingColumn(this.cells,o,this.columns[r]),l=this.getCellData(o,r,!1);if(n.getIsRequired(this.rows[o])&&(""===l||null==l)){if(!n.isReadOnly)return new CellRange(o,r);console.warn("Incorrect data. Column "+r+" is at the same time required, empty and read-only")}}}return null};return MultiRow}(FlexGrid);export{MultiRow};var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var n=e.grid;if(t<0||t>=e.rows.length||o<0||o>=e.columns.length)return null;switch(e.cellType){case CellType.Cell:case CellType.RowHeader:if(e.rows[t]instanceof GroupRow&&!n.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,o,r,!1)}switch(e.cellType){case CellType.Cell:if(e.rows[t]instanceof GroupRow)return this._getGroupRowMergedRange(e,t,o,r,n.multiRowGroupHeaders);case CellType.ColumnHeader:var l=e.cellType==CellType.ColumnHeader,i=n._getGroupByColumn(o,l);assert(i instanceof MultiRowCellGroup,"Failed to get the group!");var a=l?i.getMergedRange(e,t-1,o):i.getMergedRange(e,t,o),s=e.columns.frozen;if(s&&a&&a.columnSpan>1&&a.col<s&&a.col2>=s){a=a.clone();o<s?a.col2=s-1:a.col=s}var u=e.rows.frozen;if(u&&a&&a.rowSpan>1&&e.cellType==CellType.Cell&&a.row<u&&a.row2>=u){a=a.clone();t<u?a.row2=u-1:a.row=u}assert(!a||a.contains(t,o),"Merged range must contain source cell");return a;case CellType.RowHeader:var c=n.rowsPerItem,p=t-e.rows[t].recordIndex,d=Math.min(p+c-1,e.rows.length-1);return new CellRange(p,0,d,e.columns.length-1);case CellType.TopLeft:var _=n.collapsedHeaders,h=e.rows.length-1,f=h>0?1:0;return new CellRange(0!=_?0:f,0,1!=_?h:f,e.columns.length-1)}return null};_MergeManager.prototype._getGroupRowMergedRange=function(t,o,r,n,l){void 0===n&&(n=!0);var i=t.grid,a=t.cellType,s=t.rows[o];if(i.showGroups&&!i.childItemsPath&&s instanceof _MultiGroupRow&&s.dataItem instanceof CollectionViewGroup&&a==CellType.Cell){return i._layout._getGroupHeaderMergedRange(t,o,r,l)}return e.prototype.getMergedRange.call(this,t,o,r,n)};return _MergeManager}(MergeManager);export{_MergeManager};var _MultiRowAddNewHandler=function(e){__extends(_MultiRowAddNewHandler,e);function _MultiRowAddNewHandler(t){t._addHdl._detach();return e.call(this,t)||this}_MultiRowAddNewHandler.prototype.updateNewRowTemplate=function(){for(var e=this._g.editableCollectionView,t=this._g,o=t.rows,r=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,n=-1,l=0;l<o.length;l+=t.rowsPerItem)if(o[l]instanceof _MultiRowNewRowTemplate){n=l;break}if(r&&n>-1&&(this._top&&n>0||!this._top&&0==n)){n=-1;this._removeNewRowTemplate()}if(r&&n<0)for(l=0;l<t.rowsPerItem;l++){var i=new _MultiRowNewRowTemplate(l);0==l&&(this._nrt=i);this._top?o.insert(l,i):o.push(i)}!r&&n>-1&&this._removeNewRowTemplate()};_MultiRowAddNewHandler.prototype._keydown=function(t){e.prototype._keydown.call(this,t);t.defaultPrevented||t.keyCode!=Key.Escape||this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._beginningEdit=function(t,o){e.prototype._beginningEdit.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditStarting=function(t,o){e.prototype._rowEditStarting.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditEnded=function(t,o){e.prototype._rowEditEnded.call(this,t,o);this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._copyNewDataItem=function(){if(this._top)for(var e=this._g,t=e.rows,o=0;o<e.rowsPerItem;o++)t[o]instanceof _NewRowTemplate&&(t[o].dataItem=this._nrt.dataItem)};_MultiRowAddNewHandler.prototype._removeNewRowTemplate=function(){for(var e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof _NewRowTemplate){t.removeAt(e);e--}};return _MultiRowAddNewHandler}(_AddNewHandler);export{_MultiRowAddNewHandler};var _MultiRowNewRowTemplate=function(e){__extends(_MultiRowNewRowTemplate,e);function _MultiRowNewRowTemplate(t){var o=e.call(this)||this;o._idxRecord=t;return o}Object.defineProperty(_MultiRowNewRowTemplate.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRowNewRowTemplate}(_NewRowTemplate);export{_MultiRowNewRowTemplate};_registerModule("wijmo.grid.multirow",selfModule); |
/*! | ||
* | ||
* Wijmo Library 5.20241.001-nightly.d20240111.t020133 | ||
* Wijmo Library 5.20241.001-nightly.d20240112.t020133 | ||
* https://developer.mescius.com/wijmo | ||
@@ -5,0 +5,0 @@ * |
/*! | ||
* | ||
* Wijmo Library 5.20241.001-nightly.d20240111.t020133 | ||
* Wijmo Library 5.20241.001-nightly.d20240112.t020133 | ||
* https://developer.mescius.com/wijmo | ||
@@ -14,2 +14,2 @@ * | ||
"use strict";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 __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},__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});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=__importStar(require("@grapecity/wijmo.grid.multirow")),_MultiRowSelectionHandler=function(e){__extends(_MultiRowSelectionHandler,e);function _MultiRowSelectionHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowSelectionHandler.prototype._getNextColumnCell=function(t,o,r,i){void 0===i&&(i=0);var n=this._g,l=n.cells,a=n.columns,s=wijmo_grid_1.SelMove;switch(r){case s.NextEditableCell:for(var u=o+1;u<a.length;u++){if((_=n._getBindingColumn(l,t,a[u])).renderSize>0&&!_.isReadOnly)return u}return o;case s.PrevEditableCell:for(u=o-1;u>=0;u--){var _;if((_=n._getBindingColumn(l,t,a[u])).renderSize>0&&!_.isReadOnly)return u}return o}return e.prototype._getNextColumnCell.call(this,t,o,r,i)};return _MultiRowSelectionHandler}(wijmo_grid_1._SelectionHandler);exports._MultiRowSelectionHandler=_MultiRowSelectionHandler;var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o,r){var i=e.call(this,t)||this;i._idxData=o;i._idxRecord=r;return i}Object.defineProperty(_MultiRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRow}(wijmo_grid_1.Row);exports._MultiRow=_MultiRow;var _MultiGroupRow=function(e){__extends(_MultiGroupRow,e);function _MultiGroupRow(t,o){var r=e.call(this,t)||this;r._idxRecord=o;return r}Object.defineProperty(_MultiGroupRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});Object.defineProperty(_MultiGroupRow.prototype,"hasChildren",{get:function(){return!0},enumerable:!0,configurable:!0});_MultiGroupRow.prototype.getCellRange=function(){var t=this._getLastRowInHeader();return t!=this?t.getCellRange():e.prototype.getCellRange.call(this)};Object.defineProperty(_MultiGroupRow.prototype,"isCollapsed",{get:function(){return this._getLastRowInHeader()._getFlag(wijmo_grid_1.RowColFlags.Collapsed)},set:function(e){var t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(wijmo_1.asBoolean(e))},enumerable:!0,configurable:!0});_MultiGroupRow.prototype._setCollapsed=function(e){var t=this,o=this.grid,r=o.rows,i=this.getCellRange(),n=new wijmo_grid_1.CellRangeEventArgs(o.cells,new wijmo_grid_1.CellRange(this.index,-1));if(o.onGroupCollapsedChanging(n)){o.deferUpdate((function(){r.deferUpdate((function(){t._setFlag(wijmo_grid_1.RowColFlags.Collapsed,e,!0);for(var o=i.topRow+1;o<=i.bottomRow&&o>-1&&o<r.length;o++){r[o]._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);var n=r[o];if(n instanceof _MultiGroupRow){var l=n._getLastRowInHeader();for(o+=1;o<=l.index;o++)(n=r[o])._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);o--}n instanceof wijmo_grid_1.GroupRow&&n.isCollapsed&&(o=n.getCellRange().bottomRow)}}))}));o.onGroupCollapsedChanged(n)}};_MultiGroupRow.prototype._getLastRowInHeader=function(){var e=this.grid,t=this;if(e&&e.multiRowGroupHeaders)for(var o=e.rows,r=this.dataItem,i=this.index+1;i<o.length&&o[i].dataItem==r;i++)t=o[i];wijmo_1.assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t};return _MultiGroupRow}(wijmo_grid_1.GroupRow);exports._MultiGroupRow=_MultiGroupRow;var _MultiRowEditHandler=function(e){__extends(_MultiRowEditHandler,e);function _MultiRowEditHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowEditHandler.prototype._selectionChanging=function(e){var t=this;if(this.finishEditing()){var o=this._g._selHdl.selection.row;if(o!=e.row){var r=this._g.rows.length;if((o>-1&&o<r?this._g.rows[o].dataItem:null)!=(e.row>-1&&e.row<r?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){var i=!this._g.rows[o]||this._g.rows[o]&&Object.getPrototypeOf(this._g.rows[o])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(o);null!==i&&setTimeout((function(){t._g.select(i);t.startEditing(!0,i.row,i.col,!0,e)}))}}}}else e.cancel=!0};return _MultiRowEditHandler}(wijmo_grid_1._EditHandler);exports._MultiRowEditHandler=_MultiRowEditHandler;var MultiRowCellCollection=function(e){__extends(MultiRowCellCollection,e);function MultiRowCellCollection(){return null!==e&&e.apply(this,arguments)||this}MultiRowCellCollection.prototype._setLayout=function(e){this._layout=e;this.forEach((function(t){return t._setLayout(e)}))};MultiRowCellCollection.prototype.onCollectionChanged=function(t){void 0===t&&(t=wijmo_1.NotifyCollectionChangedEventArgs.reset);var o=this._layout;o&&o._onLayoutChanged();e.prototype.onCollectionChanged.call(this,t)};return MultiRowCellCollection}(wijmo_1.ObservableArray);exports.MultiRowCellCollection=MultiRowCellCollection;var _MultiRowLayout=function(){function _MultiRowLayout(e,t,o){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=o;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_MultiRowLayout.prototype._dispose=function(){if(!this._disposed){this._disposed=!0;var e=this._bindingGroups;e.forEach((function(e){e.cells._setLayout(null)}));e._setLayout(null);this._bindingGroups=null}};_MultiRowLayout.prototype._onLayoutChanged=function(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()};_MultiRowLayout.prototype._parseCellGroups=function(e){var t=this,o=this._grid,r=null,i=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){wijmo_1.assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")}));r=e}else{r=new MultiRowCellCollection;for(var n=0;n<e.length;n++){var l=null;l=e[n]instanceof MultiRowCellGroup?e[n]:new MultiRowCellGroup(e[n]);r.push(l)}}r.forEach((function(e){e.openGroup()}));n=0;for(var a=0;n<r.length;n++){(l=r[n])._colstart=a;a+=l._colspanEff;i=Math.max(i,l._rowspanEff)}r.forEach((function(e){e.closeGroup(o,i)}));this._rowsPerItem=i}else r=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(r);r.forEach((function(e){e.cells._setLayout(t)}));r._setLayout(this);return r};_MultiRowLayout.prototype._getMultiRowGroupHeaderRange=function(e){for(var t=this._rowsPerItem,o=new wijmo_grid_1.CellRange(0,0,t-1,0),r=0;r<e.length;r++){var i=e[r];if(i._hasAggregates){0===r&&this._expandMultiRowGroupHeaderToAggregate(o,i);return o}o.col2=i._colstart+i._colspanEff-1}return o};_MultiRowLayout.prototype._expandMultiRowGroupHeaderToAggregate=function(e,t){var o=this._rowsPerItem,r=t._colspanEff,i=t.cells.filter((function(e){return e.col>0&&0!=e.aggregate})).map((function(e){return e.col})).reduce((function(e,t){return t<e?t:e}),r);e.col2=Math.max(t._colstart+i-1,e.col2);for(var n=i;n<r;n++){for(var l=!0,a=0;a<o;a++){var s=t._getCellRange(a,n);l=l&&s.col===n}if(l){e.col2=Math.max(t._colstart+n-1,e.col2);return}}};_MultiRowLayout.prototype._getSingleRowGroupHeaderRange=function(e,t,o){var r=this._bindingGroups;if(0===r.length)return null;var i=this._getGroupByColumn(o);wijmo_1.assert(null!=i,"Failed to get the group!");var n=i._getCellRange(0,o-i._colstart),l=new wijmo_grid_1.CellRange(t,i._colstart+n.col,t,i._colstart+n.col2);if(0!=i.getBindingColumn(e,t,o).aggregate)return l;for(var a=r[0]._colstart,s=o-1;s>=a;s--){var u=this._getGroupByColumn(s);wijmo_1.assert(null!=u,"Failed to get the group!");if(0!=u.getBindingColumn(e,t,s).aggregate)break;n=u._getCellRange(0,s-u._colstart);l.col=u._colstart+n.col}var _=r[r.length-1],c=_._colstart+_._colspanEff;for(s=o+1;s<c;s++){var w=this._getGroupByColumn(s);wijmo_1.assert(null!=w,"Failed to get the group!");if(0!=w.getBindingColumn(e,t,s).aggregate)break;n=w._getCellRange(0,s-w._colstart);l.col2=w._colstart+n.col2}return l};_MultiRowLayout.prototype._getGroupHeaderMergedRange=function(e,t,o,r){if(r){var i=this._multiRowGroupHeaderRange;if(i.containsColumn(o)){var n=this._rowsPerItem,l=Math.floor(t/n)*n;return new wijmo_grid_1.CellRange(l+i.row,i.col,l+i.row2,i.col2)}var a=this._getGroupByColumn(o);wijmo_1.assert(a instanceof MultiRowCellGroup,"Failed to get the group!");return a.getMergedRange(e,t,o)}return this._getSingleRowGroupHeaderRange(e,t,o)};_MultiRowLayout.prototype._getGroupByColumn=function(e){var t=this._groupsByColumn[e];if(!t)for(var o=this._bindingGroups,r=0;r<o.length;r++)if(e>=(t=o[r])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}return t};_MultiRowLayout.prototype._updateCellTypes=function(e){this._bindingGroups.forEach((function(t){t._cols.forEach((function(t){null==t.dataType&&t._binding&&(t.dataType=wijmo_1.getType(t._binding.getValue(e)));if(!t.isReadOnly){var o=wijmo_1.isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=o&&!o.writable&&!o.set}}))}))};return _MultiRowLayout}();exports._MultiRowLayout=_MultiRowLayout;var MultiRowCell=function(e){__extends(MultiRowCell,e);function MultiRowCell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;wijmo_1.copy(o,t);return o}Object.defineProperty(MultiRowCell.prototype,"row",{get:function(){return this._row},set:function(e){var t=wijmo_1.asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"col",{get:function(){return this._col},set:function(e){var t=wijmo_1.asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){var t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){var t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCell.prototype._setLayout=function(e){this._layout=e};MultiRowCell.prototype._onLayoutPropertyChanged=function(){var e=this._layout;e&&e._onLayoutChanged()};return MultiRowCell}(wijmo_grid_1.Column);exports.MultiRowCell=MultiRowCell;var MultiRowCellGroup=function(e){__extends(MultiRowCellGroup,e);function MultiRowCellGroup(t){var o=e.call(this)||this;o._isRowHeader=!1;o._colstart=0;o._cells=new MultiRowCellCollection;wijmo_1.copy(o,t);return o}MultiRowCellGroup.prototype._copy=function(e,t){if("cells"==e){wijmo_1.isArray(t)&&(this._cellsDef=t);return!0}return!1};Object.defineProperty(MultiRowCellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCellGroup.prototype,"isRowHeader",{get:function(){return this._isRowHeader},set:function(e){var t=wijmo_1.asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCellGroup.prototype.openGroup=function(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()};MultiRowCellGroup.prototype.closeGroup=function(e,t){var o=this;if(t>this._rowspanEff){this._cells.forEach((function(e){e.row==o._rowspanEff-1&&(e._rowspanEff=t-e.row)}));this._rowspanEff=t}this._cells.forEach((function(e){for(;e.col+e._colspanEff<o._colspanEff&&!o._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++}));this._cells.forEach((function(e){for(;e.row+e._rowspanEff<o._rowspanEff&&!o._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++}));if(this._cells.length>0)for(var r=0;r<this._rowspanEff;r++)for(var i=0;i<this._colspanEff;i++)wijmo_1.assert(this._slotTaken(r,i),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach((function(e){for(var t=0;t<e._rowspanEff;t++)for(var r=0;r<e._colspanEff;r++){var i=(e.row+t)*o._colspanEff+e.col+r;o._cols.setAt(i,e);var n=new wijmo_grid_1.CellRange(0-t,0-r,0-t+e._rowspanEff-1,0-r+e._colspanEff-1);n.isSingleCell||(o._rng[i]=n)}}));var n=this._colstart;this._rng[-1]=new wijmo_grid_1.CellRange(0,n,0,n+this._colspanEff-1);this._hasAggregates=!1;for(var l=0;l<this._cells.length&&!this._hasAggregates;l++)this._hasAggregates=0!=this._cells[l].aggregate};MultiRowCellGroup.prototype.getColumnWidth=function(e){for(var t=0;t<this._cells.length;t++){var o=this._cells[t];if(o.col==e&&1==o._colspanEff)return o.width}return null};MultiRowCellGroup.prototype.getMergedRange=function(e,t,o){if(t<0)return this._rng[-1];var r=e.rows[t],i=null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,n=o-this._colstart,l=this._rng[i*this._colspanEff+n];e.cellType==wijmo_grid_1.CellType.ColumnHeader&&t++;return l?new wijmo_grid_1.CellRange(t+l.row,o+l.col,t+l.row2,o+l.col2):null};MultiRowCellGroup.prototype.getBindingColumn=function(e,t,o){if(t<0)return this;var r=e.rows[t],i=r&&null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,n=o-this._colstart;return this._cols[i*this._colspanEff+n]};MultiRowCellGroup.prototype.getColumn=function(e){return this._cols.getColumn(e)};MultiRowCellGroup.prototype._getCellRange=function(e,t){var o=this._rng[e*this._colspanEff+t];return o?new wijmo_grid_1.CellRange(e+o.row,t+o.col,e+o.row2,t+o.col2):new wijmo_grid_1.CellRange(e,t)};MultiRowCellGroup.prototype._parseCells=function(e){var t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){wijmo_1.assert(e instanceof MultiRowCell,"cells contain items of invalid type")}));t=e}else e.forEach((function(e){var o=null;o=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(o)}));t.forEach((function(e){e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding))}))}return t};MultiRowCellGroup.prototype._clearCalculations=function(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach((function(e){e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0}))};MultiRowCellGroup.prototype._calculate=function(){var e=this;this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach((function(t){e._colspanEff=Math.max(e._colspanEff,t.colspan);t._colspanEff=t.colspan;t._rowspanEff=t.rowspan}));var t=0,o=0;this._cells.forEach((function(r,i){for(;!e._cellFits(r,i,t,o);)0==(o=(o+1)%e._colspanEff)&&t++;r.row=t;r.col=o}));var r=1,i=1;this._cells.forEach((function(e){r=Math.max(r,e.row+e._rowspanEff);i=Math.max(i,e.col+e._colspanEff)}));this._rowspanEff=r;this._colspanEff=i};MultiRowCellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e._colspanEff>this._colspanEff)return!1;for(var i=0;i<e._colspanEff;i++)if(this._slotTaken(o,r+i,t))return!1;this._colspanEff=Math.max(this._colspanEff,r+e._colspanEff-1);return!0};MultiRowCellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var i=this._cells[r];if(e>=i.row&&e<=i.row+i._rowspanEff-1&&t>=i.col&&t<=i.col+i._colspanEff-1)return!0}return!1};return MultiRowCellGroup}(MultiRowCell);exports.MultiRowCellGroup=MultiRowCellGroup;var MultiRow=function(e){__extends(MultiRow,e);function MultiRow(t,o){var r=e.call(this,t)||this;r._hdrLayoutDef=null;r._centerVert=!0;r._collapsedHeaders=!1;r._multiRowGroupHeaders=!1;r._rowHdrCnt=0;r.collapsedHeadersChanging=new wijmo_1.Event;r.collapsedHeadersChanged=new wijmo_1.Event;r._layoutDef=new MultiRowCellCollection;r._layout=new _MultiRowLayout(r,r._layoutDef,(function(){return r._onLayoutChanged()}));wijmo_1.addClass(r.hostElement,"wj-multirow");var i=r.columnHeaders.hostElement.parentElement,n=wijmo_1.createElement('<div class="wj-hdr-collapse"><span></span></div>');n.style.display="none";i.appendChild(n);r._btnCollapse=n;r._updateButtonGlyph();r.addEventListener(n,"mousedown",(function(e){switch(r.collapsedHeaders){case null:case!1:r._collapsedHeadersWasNull=null==r.collapsedHeaders;r.collapsedHeaders=!0;break;case!0:r.collapsedHeaders=!!r._collapsedHeadersWasNull&&null}e.preventDefault();r.focus()}),!0);var l=r.hostElement;r.addEventListener(l,"mousedown",(function(e){if(!r._mouseHdl._szRowCol){var t=r._layout?r._layout._bindingGroups:null,o=t&&t.length?t[0]:null;if(o&&o.isRowHeader){var i=r.hitTest(e);if(i.panel==r.columnHeaders&&i.col<r.columns.frozen){e.preventDefault();r.selectAll()}}}}),!0);["dragover","dragleave","dragdrop"].forEach((function(e){r.removeEventListener(l,e)}));r._edtHdl=new _MultiRowEditHandler(r);r._addHdl=new _MultiRowAddNewHandler(r);r.formatItem.addHandler(r._formatItem,r);r.autoGenerateColumns=!1;r.allowDragging=wijmo_grid_1.AllowDragging.None;r.mergeManager=new _MergeManager;r.initialize(o);return r}MultiRow.prototype._getProductInfo=function(){return"H87K,MultiRow"};Object.defineProperty(MultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){var t=this;this.finishEditing()||this.finishEditing(!0);this._layoutDef=wijmo_1.asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,(function(){return t._onLayoutChanged()}));this._rowHdrCnt=0;if(this._layout)for(var o=this._layout._bindingGroups,r=0;r<o.length;r++){var i=o[r];if(!i.isRowHeader)break;this._rowHdrCnt=i._colstart+i._colspanEff;i.cells.forEach((function(e){e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"}))}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"recordViewRange",{get:function(){var e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return __assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"headerLayoutDefinition",{get:function(){return this._hdrLayoutDef},set:function(e){var t=this;this._hdrLayoutDef=wijmo_1.asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}var o=null;e&&(o=new _MultiRowLayout(this,e,(function(){return t._onHeaderLayoutChanged()})));this._hdrLayout=o;this._bindGrid(!0)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"rowsPerItem",{get:function(){return this._layout._rowsPerItem},enumerable:!0,configurable:!0});MultiRow.prototype.getBindingColumn=function(e,t,o){return this._getBindingColumn(e,t,e.columns[o])};MultiRow.prototype.getColumn=function(t,o){if(wijmo_1.isString(t)){for(var r=o&&this._hdrLayout,i=(r?this._hdrLayout:this._layout)._bindingGroups,n=null,l=0;l<i.length&&!n;l++)n=i[l].getColumn(t);return!n&&r?this.getColumn(t,!1):n}return e.prototype.getColumn.call(this,t)};Object.defineProperty(MultiRow.prototype,"centerHeadersVertically",{get:function(){return this._centerVert},set:function(e){if(e!=this._centerVert){this._centerVert=wijmo_1.asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"collapsedHeaders",{get:function(){return this._collapsedHeaders},set:function(e){if(e!=this._collapsedHeaders){var t=new wijmo_1.CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=wijmo_1.asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"showHeaderCollapseButton",{get:function(){return""==this._btnCollapse.style.display},set:function(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=wijmo_1.asBoolean(e)?"":"none")},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"multiRowGroupHeaders",{get:function(){return this._multiRowGroupHeaders},set:function(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=wijmo_1.asBoolean(e);this._bindGrid(!0)}},enumerable:!0,configurable:!0});MultiRow.prototype.onCollapsedHeadersChanging=function(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel};MultiRow.prototype.onCollapsedHeadersChanged=function(e){this.collapsedHeadersChanged.raise(this,e)};Object.defineProperty(MultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(e){wijmo_1.assert(!e,"MultiRow does not support pinning.")},enumerable:!0,configurable:!0});MultiRow.prototype.onSelectionChanging=function(t){var o=t._rng;if(o&&o.isValid&&this.selectionMode){var r=this._mouseHdl._htDown,i=this.rows,n=this.columns,l=this._rowHdrCnt;if(l){o.col=Math.max(o.col,l);o.col2=Math.max(o.col2,l)}if(r&&(r.panel==this.rowHeaders||r.panel==this.cells&&r.col<l)){var a=i[o.topRow],s=i[o.bottomRow];if(a&&null!=a.recordIndex){var u=a.index-a.recordIndex,_=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,c=s.index-s.recordIndex+_-1,w=n.length-1,d=o.row!=o.topRow?new wijmo_grid_1.CellRange(c,0,u,w):new wijmo_grid_1.CellRange(u,0,c,w);o.row=d.row;o.row2=d.row2;o.col2=w;switch(this.selectionMode){case wijmo_grid_1.SelectionMode.Cell:o.row2=d.row;o.col2=d.col;break;case wijmo_grid_1.SelectionMode.Row:o.row2=d.row}}}}return e.prototype.onSelectionChanging.call(this,t)};MultiRow.prototype._createSelHdl=function(){return new _MultiRowSelectionHandler(this)};MultiRow.prototype._getDeleteColumnIndex=function(){return this._rowHdrCnt};MultiRow.prototype._getQuickAutoSize=function(){return wijmo_1.isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter};MultiRow.prototype._addBoundRow=function(e,t){for(var o=e[t],r=0;r<this.rowsPerItem;r++)this.rows.push(new _MultiRow(o,t,r))};MultiRow.prototype._addNode=function(e,t,o){this._addBoundRow(e,t)};MultiRow.prototype._addGroupRow=function(e){for(var t=this._multiRowGroupHeaders?this.rowsPerItem:1,o=0;o<t;o++)this.rows.push(new _MultiGroupRow(e,o))};MultiRow.prototype._bindColumns=function(){for(var e=this,t=this.columnHeaders.rows,o=this._layout,r=this._hdrLayout,i=(r?r._rowsPerItem:this.rowsPerItem)+1;t.length>i;)t.removeAt(t.length-1);for(;t.length<i;)t.push(new wijmo_grid_1.Row);this._updateCollapsedHeaders();this.columns.clear();if(o&&o._bindingGroups){var n="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");o._bindingGroups.forEach((function(t){for(var _loop_1=function(o){if(0===t.cells.length)return"continue";for(var r=new wijmo_grid_1.Column,_loop_2=function(e){var i=t.cells[e];i.col==o&&n.forEach((function(e){null!=i[e]&&i[e]!=r[e]&&(r[e]=i[e])}))},i=0;i<t.cells.length;i++)_loop_2(i);e.columns.push(r)},o=0;o<t._colspanEff;o++)_loop_1(o)}))}};MultiRow.prototype._updateCollapsedHeaders=function(){var e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(var o=1;o<e.length;o++)e[o].visible=1!=t};MultiRow.prototype._updateColumnTypes=function(){e.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(wijmo_1.hasItems(t)){var o=t.items[0];this._layout&&this._layout._updateCellTypes(o);this._hdrLayout&&this._hdrLayout._updateCellTypes(o)}};MultiRow.prototype._getBindingColumn=function(e,t,o){if(o&&(e==this.cells||e==this.columnHeaders)){var r=e.cellType==wijmo_grid_1.CellType.ColumnHeader;r&&t--;o=this._getGroupByColumn(o.index,r).getBindingColumn(e,t,o.index)}return o};MultiRow.prototype._getBindingColumns=function(){var e=[];this._layout._bindingGroups.forEach((function(t){t._cols.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))}));return e};MultiRow.prototype._getRowsPerItem=function(){return this.rowsPerItem};MultiRow.prototype._cvCollectionChanged=function(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{var o=wijmo_1.NotifyCollectionChangedAction;switch(t.action){case o.Change:this.invalidate();break;case o.Add:if(t.index==this.collectionView.items.length-1){for(var r=this.rows.length;r>0&&this.rows[r-1]instanceof wijmo_grid_1._NewRowTemplate;)r--;for(var i=0;i<this.rowsPerItem;i++)this.rows.insert(r+i,new _MultiRow(t.item,t.index,i));return}wijmo_1.assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}};MultiRow.prototype._getGroupByColumn=function(e,t){var o=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(o=this._hdrLayout._getGroupByColumn(e));o||(o=this._layout._getGroupByColumn(e));wijmo_1.assert(o instanceof MultiRowCellGroup,"Failed to get the group!");return o};MultiRow.prototype._onLayoutChanged=function(){this.layoutDefinition=this._layoutDef};MultiRow.prototype._onHeaderLayoutChanged=function(){this.headerLayoutDefinition=this._hdrLayoutDef};MultiRow.prototype._formatItem=function(e,t){var o=this.rowsPerItem,r=t.panel,i=r.cellType,n=r.rows[t.range.row],l=r.rows[t.range.row2],a=t.cell,s=wijmo_grid_1.CellType;i==s.ColumnHeader&&wijmo_1.toggleClass(a,"wj-group-header",0==t.range.row);if(i==s.Cell||i==s.ColumnHeader){var u=this._getGroupByColumn(t.col,i==s.ColumnHeader);wijmo_1.toggleClass(a,"wj-group-start",u._colstart==t.range.col);wijmo_1.toggleClass(a,"wj-group-end",u._colstart+u._colspanEff-1==t.range.col2)}if(o>1&&(i==s.Cell||i==s.RowHeader)){var _=n instanceof _MultiRow||n instanceof _MultiRowNewRowTemplate,c=l instanceof _MultiRow||l instanceof _MultiRowNewRowTemplate;wijmo_1.toggleClass(a,"wj-record-start",!!_&&0==n.recordIndex);wijmo_1.toggleClass(a,"wj-record-end",!!c&&l.recordIndex==o-1)}var w=this.alternatingRowStep;if(w){var d=!1;if(n instanceof _MultiRow){d=n.dataIndex%(w+1)==0;1==w&&(d=!d)}wijmo_1.toggleClass(a,"wj-alt",d)}if(this._centerVert&&!a.getAttribute("wj-state-measuring")){var p=t.range.rowSpan>1;if(p&&t.updateContent)if(0==a.childElementCount)a.innerHTML="<div>"+a.innerHTML+"</div>";else{var h=document.createElement("div"),f=document.createRange();f.selectNodeContents(a);f.surroundContents(h)}wijmo_1.toggleClass(a,"wj-center-vert",p)}};MultiRow.prototype._updateButtonGlyph=function(){var e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")};MultiRow.prototype._getError=function(t,o,r,i){if(wijmo_1.isFunction(this.itemValidator)&&t==this.rowHeaders){for(var n=[],l=0;l<this.rowsPerItem;l++)for(r=0;r<this.columns.length;r++){var a=this.itemValidator(o+l,r,i);if(a){var s=this.getMergedRange(this.cells,o+l,r);s&&(s.columnSpan>1&&s.col<r||s.rowSpan>1&&s.row<o+l)||n.push(a)}}if(n.length){var u=this.errorTip,_=!!u&&u.isContentHtml;return n.join(_?"<br/>":"\n")}}return e.prototype._getError.call(this,t,o,r,i)};MultiRow.prototype._getEmptyRequiredCell=function(e){if(e>=0){e-=this.rows[e].recordIndex;for(var t=0;t<this._getRowsPerItem();t++)for(var o=e+t,r=0;r<this.columns.length;r++){var i=this._getBindingColumn(this.cells,o,this.columns[r]),n=this.getCellData(o,r,!1);if(i.getIsRequired(this.rows[o])&&(""===n||null==n)){if(!i.isReadOnly)return new wijmo_grid_1.CellRange(o,r);console.warn("Incorrect data. Column "+r+" is at the same time required, empty and read-only")}}}return null};return MultiRow}(wijmo_grid_1.FlexGrid);exports.MultiRow=MultiRow;var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var i=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:if(e.rows[t]instanceof wijmo_grid_1.GroupRow&&!i.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,o,r,!1)}switch(e.cellType){case wijmo_grid_1.CellType.Cell:if(e.rows[t]instanceof wijmo_grid_1.GroupRow)return this._getGroupRowMergedRange(e,t,o,r,i.multiRowGroupHeaders);case wijmo_grid_1.CellType.ColumnHeader:var n=e.cellType==wijmo_grid_1.CellType.ColumnHeader,l=i._getGroupByColumn(o,n);wijmo_1.assert(l instanceof MultiRowCellGroup,"Failed to get the group!");var a=n?l.getMergedRange(e,t-1,o):l.getMergedRange(e,t,o),s=e.columns.frozen;if(s&&a&&a.columnSpan>1&&a.col<s&&a.col2>=s){a=a.clone();o<s?a.col2=s-1:a.col=s}var u=e.rows.frozen;if(u&&a&&a.rowSpan>1&&e.cellType==wijmo_grid_1.CellType.Cell&&a.row<u&&a.row2>=u){a=a.clone();t<u?a.row2=u-1:a.row=u}wijmo_1.assert(!a||a.contains(t,o),"Merged range must contain source cell");return a;case wijmo_grid_1.CellType.RowHeader:var _=i.rowsPerItem,c=t-e.rows[t].recordIndex,w=Math.min(c+_-1,e.rows.length-1);return new wijmo_grid_1.CellRange(c,0,w,e.columns.length-1);case wijmo_grid_1.CellType.TopLeft:var d=i.collapsedHeaders,p=e.rows.length-1,h=p>0?1:0,f=0!=d?0:h,g=1!=d?p:h;return new wijmo_grid_1.CellRange(f,0,g,e.columns.length-1)}return null};_MergeManager.prototype._getGroupRowMergedRange=function(t,o,r,i,n){void 0===i&&(i=!0);var l=t.grid,a=t.cellType,s=t.rows[o];if(l.showGroups&&!l.childItemsPath&&s instanceof _MultiGroupRow&&s.dataItem instanceof wijmo_1.CollectionViewGroup&&a==wijmo_grid_1.CellType.Cell){return l._layout._getGroupHeaderMergedRange(t,o,r,n)}return e.prototype.getMergedRange.call(this,t,o,r,i)};return _MergeManager}(wijmo_grid_1.MergeManager);exports._MergeManager=_MergeManager;var _MultiRowAddNewHandler=function(e){__extends(_MultiRowAddNewHandler,e);function _MultiRowAddNewHandler(t){t._addHdl._detach();return e.call(this,t)||this}_MultiRowAddNewHandler.prototype.updateNewRowTemplate=function(){for(var e=this._g.editableCollectionView,t=this._g,o=t.rows,r=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,i=-1,n=0;n<o.length;n+=t.rowsPerItem)if(o[n]instanceof _MultiRowNewRowTemplate){i=n;break}if(r&&i>-1&&(this._top&&i>0||!this._top&&0==i)){i=-1;this._removeNewRowTemplate()}if(r&&i<0)for(n=0;n<t.rowsPerItem;n++){var l=new _MultiRowNewRowTemplate(n);0==n&&(this._nrt=l);this._top?o.insert(n,l):o.push(l)}!r&&i>-1&&this._removeNewRowTemplate()};_MultiRowAddNewHandler.prototype._keydown=function(t){e.prototype._keydown.call(this,t);t.defaultPrevented||t.keyCode!=wijmo_1.Key.Escape||this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._beginningEdit=function(t,o){e.prototype._beginningEdit.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditStarting=function(t,o){e.prototype._rowEditStarting.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditEnded=function(t,o){e.prototype._rowEditEnded.call(this,t,o);this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._copyNewDataItem=function(){if(this._top)for(var e=this._g,t=e.rows,o=0;o<e.rowsPerItem;o++)t[o]instanceof wijmo_grid_1._NewRowTemplate&&(t[o].dataItem=this._nrt.dataItem)};_MultiRowAddNewHandler.prototype._removeNewRowTemplate=function(){for(var e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof wijmo_grid_1._NewRowTemplate){t.removeAt(e);e--}};return _MultiRowAddNewHandler}(wijmo_grid_1._AddNewHandler);exports._MultiRowAddNewHandler=_MultiRowAddNewHandler;var _MultiRowNewRowTemplate=function(e){__extends(_MultiRowNewRowTemplate,e);function _MultiRowNewRowTemplate(t){var o=e.call(this)||this;o._idxRecord=t;return o}Object.defineProperty(_MultiRowNewRowTemplate.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRowNewRowTemplate}(wijmo_grid_1._NewRowTemplate);exports._MultiRowNewRowTemplate=_MultiRowNewRowTemplate;wijmo_1._registerModule("wijmo.grid.multirow",selfModule); | ||
"use strict";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 __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},__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});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=__importStar(require("@grapecity/wijmo.grid.multirow")),_MultiRowSelectionHandler=function(e){__extends(_MultiRowSelectionHandler,e);function _MultiRowSelectionHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowSelectionHandler.prototype._getNextColumnCell=function(t,o,r,i){void 0===i&&(i=0);var n=this._g,l=n.cells,a=n.columns,s=wijmo_grid_1.SelMove;switch(r){case s.NextEditableCell:for(var u=o+1;u<a.length;u++){if((_=n._getBindingColumn(l,t,a[u])).renderSize>0&&!_.isReadOnly)return u}return o;case s.PrevEditableCell:for(u=o-1;u>=0;u--){var _;if((_=n._getBindingColumn(l,t,a[u])).renderSize>0&&!_.isReadOnly)return u}return o}return e.prototype._getNextColumnCell.call(this,t,o,r,i)};return _MultiRowSelectionHandler}(wijmo_grid_1._SelectionHandler);exports._MultiRowSelectionHandler=_MultiRowSelectionHandler;var _MultiRow=function(e){__extends(_MultiRow,e);function _MultiRow(t,o,r){var i=e.call(this,t)||this;i._idxData=o;i._idxRecord=r;return i}Object.defineProperty(_MultiRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRow}(wijmo_grid_1.Row);exports._MultiRow=_MultiRow;var _MultiGroupRow=function(e){__extends(_MultiGroupRow,e);function _MultiGroupRow(t,o){var r=e.call(this,t)||this;r._idxRecord=o;return r}Object.defineProperty(_MultiGroupRow.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});Object.defineProperty(_MultiGroupRow.prototype,"hasChildren",{get:function(){return!0},enumerable:!0,configurable:!0});_MultiGroupRow.prototype.getCellRange=function(){var t=this._getLastRowInHeader();return t!=this?t.getCellRange():e.prototype.getCellRange.call(this)};Object.defineProperty(_MultiGroupRow.prototype,"isCollapsed",{get:function(){return this._getLastRowInHeader()._getFlag(wijmo_grid_1.RowColFlags.Collapsed)},set:function(e){var t=this._getLastRowInHeader();e!=t.isCollapsed&&null!=t._list&&t._setCollapsed(wijmo_1.asBoolean(e))},enumerable:!0,configurable:!0});_MultiGroupRow.prototype._setCollapsed=function(e){var t=this,o=this.grid,r=o.rows,i=this.getCellRange(),n=new wijmo_grid_1.CellRangeEventArgs(o.cells,new wijmo_grid_1.CellRange(this.index,-1));if(o.onGroupCollapsedChanging(n)){o.deferUpdate((function(){r.deferUpdate((function(){t._setFlag(wijmo_grid_1.RowColFlags.Collapsed,e,!0);for(var o=i.topRow+1;o<=i.bottomRow&&o>-1&&o<r.length;o++){r[o]._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);var n=r[o];if(n instanceof _MultiGroupRow){var l=n._getLastRowInHeader();for(o+=1;o<=l.index;o++)(n=r[o])._setFlag(wijmo_grid_1.RowColFlags.ParentCollapsed,e,!0);o--}n instanceof wijmo_grid_1.GroupRow&&n.isCollapsed&&(o=n.getCellRange().bottomRow)}}))}));o.onGroupCollapsedChanged(n)}};_MultiGroupRow.prototype._getLastRowInHeader=function(){var e=this.grid,t=this;if(e&&e.multiRowGroupHeaders)for(var o=e.rows,r=this.dataItem,i=this.index+1;i<o.length&&o[i].dataItem==r;i++)t=o[i];wijmo_1.assert(t instanceof _MultiGroupRow,"last row in header should be a _MultiRowGroup");return t};return _MultiGroupRow}(wijmo_grid_1.GroupRow);exports._MultiGroupRow=_MultiGroupRow;var _MultiRowEditHandler=function(e){__extends(_MultiRowEditHandler,e);function _MultiRowEditHandler(){return null!==e&&e.apply(this,arguments)||this}_MultiRowEditHandler.prototype._selectionChanging=function(e){var t=this;if(this.finishEditing()){var o=this._g._selHdl.selection.row;if(o!=e.row){var r=this._g.rows.length;if((o>-1&&o<r?this._g.rows[o].dataItem:null)!=(e.row>-1&&e.row<r?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){var i=!this._g.rows[o]||this._g.rows[o]&&Object.getPrototypeOf(this._g.rows[o])!==_MultiRow.prototype?null:this._g.getEmptyRequiredCell(o);null!==i&&setTimeout((function(){t._g.select(i);t.startEditing(!0,i.row,i.col,!0,e)}))}}}}else e.cancel=!0};return _MultiRowEditHandler}(wijmo_grid_1._EditHandler);exports._MultiRowEditHandler=_MultiRowEditHandler;var MultiRowCellCollection=function(e){__extends(MultiRowCellCollection,e);function MultiRowCellCollection(){return null!==e&&e.apply(this,arguments)||this}MultiRowCellCollection.prototype._setLayout=function(e){this._layout=e;this.forEach((function(t){return t._setLayout(e)}))};MultiRowCellCollection.prototype.onCollectionChanged=function(t){void 0===t&&(t=wijmo_1.NotifyCollectionChangedEventArgs.reset);var o=this._layout;o&&o._onLayoutChanged();e.prototype.onCollectionChanged.call(this,t)};return MultiRowCellCollection}(wijmo_1.ObservableArray);exports.MultiRowCellCollection=MultiRowCellCollection;var _MultiRowLayout=function(){function _MultiRowLayout(e,t,o){this._initialized=!1;this._disposed=!1;this._rowsPerItem=1;this._groupsByColumn={};this._grid=e;this._changeCallback=o;this._bindingGroups=this._parseCellGroups(t);this._initialized=!0}_MultiRowLayout.prototype._dispose=function(){if(!this._disposed){this._disposed=!0;var e=this._bindingGroups;e.forEach((function(e){e.cells._setLayout(null)}));e._setLayout(null);this._bindingGroups=null}};_MultiRowLayout.prototype._onLayoutChanged=function(){this._initialized&&!this._disposed&&this._changeCallback&&this._changeCallback()};_MultiRowLayout.prototype._parseCellGroups=function(e){var t=this,o=this._grid,r=null,i=1;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){wijmo_1.assert(e instanceof MultiRowCellGroup,"groups contain items of invalid type")}));r=e}else{r=new MultiRowCellCollection;for(var n=0;n<e.length;n++){var l=null;l=e[n]instanceof MultiRowCellGroup?e[n]:new MultiRowCellGroup(e[n]);r.push(l)}}r.forEach((function(e){e.openGroup()}));n=0;for(var a=0;n<r.length;n++){(l=r[n])._colstart=a;a+=l._colspanEff;i=Math.max(i,l._rowspanEff)}r.forEach((function(e){e.closeGroup(o,i)}));this._rowsPerItem=i}else r=new MultiRowCellCollection;this._multiRowGroupHeaderRange=this._getMultiRowGroupHeaderRange(r);r.forEach((function(e){e.cells._setLayout(t)}));r._setLayout(this);return r};_MultiRowLayout.prototype._getMultiRowGroupHeaderRange=function(e){for(var t=this._rowsPerItem,o=new wijmo_grid_1.CellRange(0,0,t-1,0),r=0;r<e.length;r++){var i=e[r];if(i._hasAggregates){0===r&&this._expandMultiRowGroupHeaderToAggregate(o,i);return o}o.col2=i._colstart+i._colspanEff-1}return o};_MultiRowLayout.prototype._expandMultiRowGroupHeaderToAggregate=function(e,t){var o=this._rowsPerItem,r=t._colspanEff,i=t.cells.filter((function(e){return e.col>0&&0!=e.aggregate})).map((function(e){return e.col})).reduce((function(e,t){return t<e?t:e}),r);e.col2=Math.max(t._colstart+i-1,e.col2);for(var n=i;n<r;n++){for(var l=!0,a=0;a<o;a++){var s=t._getCellRange(a,n);l=l&&s.col===n}if(l){e.col2=Math.max(t._colstart+n-1,e.col2);return}}};_MultiRowLayout.prototype._getSingleRowGroupHeaderRange=function(e,t,o){var r=this._bindingGroups;if(0===r.length)return null;var i=this._getGroupByColumn(o);wijmo_1.assert(null!=i,"Failed to get the group!");var n=i._getCellRange(0,o-i._colstart),l=new wijmo_grid_1.CellRange(t,i._colstart+n.col,t,i._colstart+n.col2);if(0!=i.getBindingColumn(e,t,o).aggregate)return l;for(var a=r[0]._colstart,s=o-1;s>=a;s--){var u=this._getGroupByColumn(s);wijmo_1.assert(null!=u,"Failed to get the group!");if(0!=u.getBindingColumn(e,t,s).aggregate)break;n=u._getCellRange(0,s-u._colstart);l.col=u._colstart+n.col}var _=r[r.length-1],c=_._colstart+_._colspanEff;for(s=o+1;s<c;s++){var w=this._getGroupByColumn(s);wijmo_1.assert(null!=w,"Failed to get the group!");var d=w.getBindingColumn(e,t,s);if(d&&0!=d.aggregate)break;n=w._getCellRange(0,s-w._colstart);l.col2=w._colstart+n.col2}return l};_MultiRowLayout.prototype._getGroupHeaderMergedRange=function(e,t,o,r){if(r){var i=this._multiRowGroupHeaderRange;if(i.containsColumn(o)){var n=this._rowsPerItem,l=Math.floor(t/n)*n;return new wijmo_grid_1.CellRange(l+i.row,i.col,l+i.row2,i.col2)}var a=this._getGroupByColumn(o);wijmo_1.assert(a instanceof MultiRowCellGroup,"Failed to get the group!");return a.getMergedRange(e,t,o)}return this._getSingleRowGroupHeaderRange(e,t,o)};_MultiRowLayout.prototype._getGroupByColumn=function(e){var t=this._groupsByColumn[e];if(!t)for(var o=this._bindingGroups,r=0;r<o.length;r++)if(e>=(t=o[r])._colstart&&e<=t._colstart+t._colspanEff-1){this._groupsByColumn[e]=t;break}return t};_MultiRowLayout.prototype._updateCellTypes=function(e){this._bindingGroups.forEach((function(t){t._cols.forEach((function(t){null==t.dataType&&t._binding&&(t.dataType=wijmo_1.getType(t._binding.getValue(e)));if(!t.isReadOnly){var o=wijmo_1.isIE()?null:Object.getOwnPropertyDescriptor(e,t.binding);t.isReadOnly=o&&!o.writable&&!o.set}}))}))};return _MultiRowLayout}();exports._MultiRowLayout=_MultiRowLayout;var MultiRowCell=function(e){__extends(MultiRowCell,e);function MultiRowCell(t){var o=e.call(this)||this;o._row=o._col=0;o._rowspan=o._colspan=1;wijmo_1.copy(o,t);return o}Object.defineProperty(MultiRowCell.prototype,"row",{get:function(){return this._row},set:function(e){var t=wijmo_1.asInt(e,!1,!0);if(this._row!=t){this._row=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"col",{get:function(){return this._col},set:function(e){var t=wijmo_1.asInt(e,!1,!0);if(this._col!=t){this._col=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"colspan",{get:function(){return this._colspan},set:function(e){var t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"colspan must be >= 1");if(this._colspan!=t){this._colspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCell.prototype,"rowspan",{get:function(){return this._rowspan},set:function(e){var t=wijmo_1.asInt(e,!1,!0);wijmo_1.assert(t>0,"rowspan must be >= 1");if(this._rowspan!=t){this._rowspan=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCell.prototype._setLayout=function(e){this._layout=e};MultiRowCell.prototype._onLayoutPropertyChanged=function(){var e=this._layout;e&&e._onLayoutChanged()};return MultiRowCell}(wijmo_grid_1.Column);exports.MultiRowCell=MultiRowCell;var MultiRowCellGroup=function(e){__extends(MultiRowCellGroup,e);function MultiRowCellGroup(t){var o=e.call(this)||this;o._isRowHeader=!1;o._colstart=0;o._cells=new MultiRowCellCollection;wijmo_1.copy(o,t);return o}MultiRowCellGroup.prototype._copy=function(e,t){if("cells"==e){wijmo_1.isArray(t)&&(this._cellsDef=t);return!0}return!1};Object.defineProperty(MultiRowCellGroup.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});Object.defineProperty(MultiRowCellGroup.prototype,"isRowHeader",{get:function(){return this._isRowHeader},set:function(e){var t=wijmo_1.asBoolean(e);if(this._isRowHeader!=t){this._isRowHeader=t;this._onLayoutPropertyChanged()}},enumerable:!0,configurable:!0});MultiRowCellGroup.prototype.openGroup=function(){if(!this._isParsed){this._cells=this._parseCells(this._cellsDef);this._isParsed=!0}this._calculate()};MultiRowCellGroup.prototype.closeGroup=function(e,t){var o=this;if(t>this._rowspanEff){this._cells.forEach((function(e){e.row==o._rowspanEff-1&&(e._rowspanEff=t-e.row)}));this._rowspanEff=t}this._cells.forEach((function(e){for(;e.col+e._colspanEff<o._colspanEff&&!o._slotTaken(e.row,e.col+e._colspanEff);)e._colspanEff++}));this._cells.forEach((function(e){for(;e.row+e._rowspanEff<o._rowspanEff&&!o._slotTaken(e.row+e._rowspanEff,e.col);)e._rowspanEff++}));if(this._cells.length>0)for(var r=0;r<this._rowspanEff;r++)for(var i=0;i<this._colspanEff;i++)wijmo_1.assert(this._slotTaken(r,i),"Invalid layout (empty cells).");this._cols=new wijmo_grid_1.ColumnCollection(e,e.columns.defaultSize);this._rng=new Array(t*this._colspanEff);this._cells.forEach((function(e){for(var t=0;t<e._rowspanEff;t++)for(var r=0;r<e._colspanEff;r++){var i=(e.row+t)*o._colspanEff+e.col+r;o._cols.setAt(i,e);var n=new wijmo_grid_1.CellRange(0-t,0-r,0-t+e._rowspanEff-1,0-r+e._colspanEff-1);n.isSingleCell||(o._rng[i]=n)}}));var n=this._colstart;this._rng[-1]=new wijmo_grid_1.CellRange(0,n,0,n+this._colspanEff-1);this._hasAggregates=!1;for(var l=0;l<this._cells.length&&!this._hasAggregates;l++)this._hasAggregates=0!=this._cells[l].aggregate};MultiRowCellGroup.prototype.getColumnWidth=function(e){for(var t=0;t<this._cells.length;t++){var o=this._cells[t];if(o.col==e&&1==o._colspanEff)return o.width}return null};MultiRowCellGroup.prototype.getMergedRange=function(e,t,o){if(t<0)return this._rng[-1];var r=e.rows[t],i=null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,n=o-this._colstart,l=this._rng[i*this._colspanEff+n];e.cellType==wijmo_grid_1.CellType.ColumnHeader&&t++;return l?new wijmo_grid_1.CellRange(t+l.row,o+l.col,t+l.row2,o+l.col2):null};MultiRowCellGroup.prototype.getBindingColumn=function(e,t,o){if(t<0)return this;var r=e.rows[t],i=r&&null!=r.recordIndex?r.recordIndex:t%this._rowspanEff,n=o-this._colstart;return this._cols[i*this._colspanEff+n]};MultiRowCellGroup.prototype.getColumn=function(e){return this._cols.getColumn(e)};MultiRowCellGroup.prototype._getCellRange=function(e,t){var o=this._rng[e*this._colspanEff+t];return o?new wijmo_grid_1.CellRange(e+o.row,t+o.col,e+o.row2,t+o.col2):new wijmo_grid_1.CellRange(e,t)};MultiRowCellGroup.prototype._parseCells=function(e){var t=this._cells;if(e){if(e instanceof MultiRowCellCollection){e.forEach((function(e){wijmo_1.assert(e instanceof MultiRowCell,"cells contain items of invalid type")}));t=e}else e.forEach((function(e){var o=null;o=e instanceof MultiRowCell?e:new MultiRowCell(e);t.push(o)}));t.forEach((function(e){e.binding&&!e.header&&(e.header=wijmo_1.toHeaderCase(e.binding))}))}return t};MultiRowCellGroup.prototype._clearCalculations=function(){this._colstart=0;this._cols=null;this._hasAggregates=!1;this._rng=null;this.row=0;this.col=0;this._colspanEff=0;this._rowspanEff=0;this._cells.forEach((function(e){e.row=0;e.col=0;e._colspanEff=0;e._rowspanEff=0}))};MultiRowCellGroup.prototype._calculate=function(){var e=this;this._clearCalculations();this._colspanEff=this.colspan;this._rowspanEff=this.rowspan;this._cells.forEach((function(t){e._colspanEff=Math.max(e._colspanEff,t.colspan);t._colspanEff=t.colspan;t._rowspanEff=t.rowspan}));var t=0,o=0;this._cells.forEach((function(r,i){for(;!e._cellFits(r,i,t,o);)0==(o=(o+1)%e._colspanEff)&&t++;r.row=t;r.col=o}));var r=1,i=1;this._cells.forEach((function(e){r=Math.max(r,e.row+e._rowspanEff);i=Math.max(i,e.col+e._colspanEff)}));this._rowspanEff=r;this._colspanEff=i};MultiRowCellGroup.prototype._cellFits=function(e,t,o,r){if(r>0&&r+e._colspanEff>this._colspanEff)return!1;for(var i=0;i<e._colspanEff;i++)if(this._slotTaken(o,r+i,t))return!1;this._colspanEff=Math.max(this._colspanEff,r+e._colspanEff-1);return!0};MultiRowCellGroup.prototype._slotTaken=function(e,t,o){void 0===o&&(o=this._cells.length);for(var r=0;r<o;r++){var i=this._cells[r];if(e>=i.row&&e<=i.row+i._rowspanEff-1&&t>=i.col&&t<=i.col+i._colspanEff-1)return!0}return!1};return MultiRowCellGroup}(MultiRowCell);exports.MultiRowCellGroup=MultiRowCellGroup;var MultiRow=function(e){__extends(MultiRow,e);function MultiRow(t,o){var r=e.call(this,t)||this;r._hdrLayoutDef=null;r._centerVert=!0;r._collapsedHeaders=!1;r._multiRowGroupHeaders=!1;r._rowHdrCnt=0;r.collapsedHeadersChanging=new wijmo_1.Event;r.collapsedHeadersChanged=new wijmo_1.Event;r._layoutDef=new MultiRowCellCollection;r._layout=new _MultiRowLayout(r,r._layoutDef,(function(){return r._onLayoutChanged()}));wijmo_1.addClass(r.hostElement,"wj-multirow");var i=r.columnHeaders.hostElement.parentElement,n=wijmo_1.createElement('<div class="wj-hdr-collapse"><span></span></div>');n.style.display="none";i.appendChild(n);r._btnCollapse=n;r._updateButtonGlyph();r.addEventListener(n,"mousedown",(function(e){switch(r.collapsedHeaders){case null:case!1:r._collapsedHeadersWasNull=null==r.collapsedHeaders;r.collapsedHeaders=!0;break;case!0:r.collapsedHeaders=!!r._collapsedHeadersWasNull&&null}e.preventDefault();r.focus()}),!0);var l=r.hostElement;r.addEventListener(l,"mousedown",(function(e){if(!r._mouseHdl._szRowCol){var t=r._layout?r._layout._bindingGroups:null,o=t&&t.length?t[0]:null;if(o&&o.isRowHeader){var i=r.hitTest(e);if(i.panel==r.columnHeaders&&i.col<r.columns.frozen){e.preventDefault();r.selectAll()}}}}),!0);["dragover","dragleave","dragdrop"].forEach((function(e){r.removeEventListener(l,e)}));r._edtHdl=new _MultiRowEditHandler(r);r._addHdl=new _MultiRowAddNewHandler(r);r.formatItem.addHandler(r._formatItem,r);r.autoGenerateColumns=!1;r.allowDragging=wijmo_grid_1.AllowDragging.None;r.mergeManager=new _MergeManager;r.initialize(o);return r}MultiRow.prototype._getProductInfo=function(){return"H87K,MultiRow"};Object.defineProperty(MultiRow.prototype,"layoutDefinition",{get:function(){return this._layoutDef},set:function(e){var t=this;this.finishEditing()||this.finishEditing(!0);this._layoutDef=wijmo_1.asArray(e);if(this._layout){this._layout._dispose();this._layout=null}this._layout=new _MultiRowLayout(this,e,(function(){return t._onLayoutChanged()}));this._rowHdrCnt=0;if(this._layout)for(var o=this._layout._bindingGroups,r=0;r<o.length;r++){var i=o[r];if(!i.isRowHeader)break;this._rowHdrCnt=i._colstart+i._colspanEff;i.cells.forEach((function(e){e.isReadOnly=!0;!e.header||e.binding||e.cellTemplate||(e.cellTemplate=e.header);e.cssClass?e.cssClass.indexOf("wj-header")<0&&(e.cssClass+=" wj-header"):e.cssClass="wj-header"}))}this._rowHdrCnt&&(this.columns.frozen=this._rowHdrCnt);this._bindGrid(!0);this._rowHdrCnt&&this.selectionMode&&this.select(this.selection.row,this._rowHdrCnt)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"recordViewRange",{get:function(){var e=Math.floor(this.viewRange.row/this.rowsPerItem),t=Math.ceil(this.viewRange.row2/this.rowsPerItem);return __assign({},this.viewRange,{row:e,row2:t,_row:e,_row2:t})},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"headerLayoutDefinition",{get:function(){return this._hdrLayoutDef},set:function(e){var t=this;this._hdrLayoutDef=wijmo_1.asArray(e);if(this._hdrLayout){this._hdrLayout._dispose();this._hdrLayout=null}var o=null;e&&(o=new _MultiRowLayout(this,e,(function(){return t._onHeaderLayoutChanged()})));this._hdrLayout=o;this._bindGrid(!0)},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"rowsPerItem",{get:function(){return this._layout._rowsPerItem},enumerable:!0,configurable:!0});MultiRow.prototype.getBindingColumn=function(e,t,o){return this._getBindingColumn(e,t,e.columns[o])};MultiRow.prototype.getColumn=function(t,o){if(wijmo_1.isString(t)){for(var r=o&&this._hdrLayout,i=(r?this._hdrLayout:this._layout)._bindingGroups,n=null,l=0;l<i.length&&!n;l++)n=i[l].getColumn(t);return!n&&r?this.getColumn(t,!1):n}return e.prototype.getColumn.call(this,t)};Object.defineProperty(MultiRow.prototype,"centerHeadersVertically",{get:function(){return this._centerVert},set:function(e){if(e!=this._centerVert){this._centerVert=wijmo_1.asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"collapsedHeaders",{get:function(){return this._collapsedHeaders},set:function(e){if(e!=this._collapsedHeaders){var t=new wijmo_1.CancelEventArgs;if(this.onCollapsedHeadersChanging(t)){this._collapsedHeaders=wijmo_1.asBoolean(e,!0);this._updateCollapsedHeaders();this._updateButtonGlyph();this.onCollapsedHeadersChanged(t)}}},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"showHeaderCollapseButton",{get:function(){return""==this._btnCollapse.style.display},set:function(e){e!=this.showHeaderCollapseButton&&(this._btnCollapse.style.display=wijmo_1.asBoolean(e)?"":"none")},enumerable:!0,configurable:!0});Object.defineProperty(MultiRow.prototype,"multiRowGroupHeaders",{get:function(){return this._multiRowGroupHeaders},set:function(e){if(e!=this._multiRowGroupHeaders){this._multiRowGroupHeaders=wijmo_1.asBoolean(e);this._bindGrid(!0)}},enumerable:!0,configurable:!0});MultiRow.prototype.onCollapsedHeadersChanging=function(e){this.collapsedHeadersChanging.raise(this,e);return!e.cancel};MultiRow.prototype.onCollapsedHeadersChanged=function(e){this.collapsedHeadersChanged.raise(this,e)};Object.defineProperty(MultiRow.prototype,"allowPinning",{get:function(){return!1},set:function(e){wijmo_1.assert(!e,"MultiRow does not support pinning.")},enumerable:!0,configurable:!0});MultiRow.prototype.onSelectionChanging=function(t){var o=t._rng;if(o&&o.isValid&&this.selectionMode){var r=this._mouseHdl._htDown,i=this.rows,n=this.columns,l=this._rowHdrCnt;if(l){o.col=Math.max(o.col,l);o.col2=Math.max(o.col2,l)}if(r&&(r.panel==this.rowHeaders||r.panel==this.cells&&r.col<l)){var a=i[o.topRow],s=i[o.bottomRow];if(a&&null!=a.recordIndex){var u=a.index-a.recordIndex,_=s instanceof _MultiGroupRow&&!this._multiRowGroupHeaders?1:this.rowsPerItem,c=s.index-s.recordIndex+_-1,w=n.length-1,d=o.row!=o.topRow?new wijmo_grid_1.CellRange(c,0,u,w):new wijmo_grid_1.CellRange(u,0,c,w);o.row=d.row;o.row2=d.row2;o.col2=w;switch(this.selectionMode){case wijmo_grid_1.SelectionMode.Cell:o.row2=d.row;o.col2=d.col;break;case wijmo_grid_1.SelectionMode.Row:o.row2=d.row}}}}return e.prototype.onSelectionChanging.call(this,t)};MultiRow.prototype._createSelHdl=function(){return new _MultiRowSelectionHandler(this)};MultiRow.prototype._getDeleteColumnIndex=function(){return this._rowHdrCnt};MultiRow.prototype._getQuickAutoSize=function(){return wijmo_1.isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter};MultiRow.prototype._addBoundRow=function(e,t){for(var o=e[t],r=0;r<this.rowsPerItem;r++)this.rows.push(new _MultiRow(o,t,r))};MultiRow.prototype._addNode=function(e,t,o){this._addBoundRow(e,t)};MultiRow.prototype._addGroupRow=function(e){for(var t=this._multiRowGroupHeaders?this.rowsPerItem:1,o=0;o<t;o++)this.rows.push(new _MultiGroupRow(e,o))};MultiRow.prototype._bindColumns=function(){for(var e=this,t=this.columnHeaders.rows,o=this._layout,r=this._hdrLayout,i=(r?r._rowsPerItem:this.rowsPerItem)+1;t.length>i;)t.removeAt(t.length-1);for(;t.length<i;)t.push(new wijmo_grid_1.Row);this._updateCollapsedHeaders();this.columns.clear();if(o&&o._bindingGroups){var n="width,minWidth,maxWidth,binding,header,format,dataMap,name,aggregate,cellTemplate".split(",");o._bindingGroups.forEach((function(t){for(var _loop_1=function(o){if(0===t.cells.length)return"continue";for(var r=new wijmo_grid_1.Column,_loop_2=function(e){var i=t.cells[e];i.col==o&&n.forEach((function(e){null!=i[e]&&i[e]!=r[e]&&(r[e]=i[e])}))},i=0;i<t.cells.length;i++)_loop_2(i);e.columns.push(r)},o=0;o<t._colspanEff;o++)_loop_1(o)}))}};MultiRow.prototype._updateCollapsedHeaders=function(){var e=this.columnHeaders.rows,t=this.collapsedHeaders;e[0].visible=0!=t;for(var o=1;o<e.length;o++)e[o].visible=1!=t};MultiRow.prototype._updateColumnTypes=function(){e.prototype._updateColumnTypes.call(this);var t=this.collectionView;if(wijmo_1.hasItems(t)){var o=t.items[0];this._layout&&this._layout._updateCellTypes(o);this._hdrLayout&&this._hdrLayout._updateCellTypes(o)}};MultiRow.prototype._getBindingColumn=function(e,t,o){if(o&&(e==this.cells||e==this.columnHeaders)){var r=e.cellType==wijmo_grid_1.CellType.ColumnHeader;r&&t--;o=this._getGroupByColumn(o.index,r).getBindingColumn(e,t,o.index)}return o};MultiRow.prototype._getBindingColumns=function(){var e=[];this._layout._bindingGroups.forEach((function(t){t._cols.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))}));return e};MultiRow.prototype._getRowsPerItem=function(){return this.rowsPerItem};MultiRow.prototype._cvCollectionChanged=function(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{var o=wijmo_1.NotifyCollectionChangedAction;switch(t.action){case o.Change:this.invalidate();break;case o.Add:if(t.index==this.collectionView.items.length-1){for(var r=this.rows.length;r>0&&this.rows[r-1]instanceof wijmo_grid_1._NewRowTemplate;)r--;for(var i=0;i<this.rowsPerItem;i++)this.rows.insert(r+i,new _MultiRow(t.item,t.index,i));return}wijmo_1.assert(!1,"added item should be the last one.");break;default:this._bindGrid(!1)}}};MultiRow.prototype._getGroupByColumn=function(e,t){var o=null;t&&this._hdrLayout&&!this.collapsedHeaders&&(o=this._hdrLayout._getGroupByColumn(e));o||(o=this._layout._getGroupByColumn(e));wijmo_1.assert(o instanceof MultiRowCellGroup,"Failed to get the group!");return o};MultiRow.prototype._onLayoutChanged=function(){this.layoutDefinition=this._layoutDef};MultiRow.prototype._onHeaderLayoutChanged=function(){this.headerLayoutDefinition=this._hdrLayoutDef};MultiRow.prototype._formatItem=function(e,t){var o=this.rowsPerItem,r=t.panel,i=r.cellType,n=r.rows[t.range.row],l=r.rows[t.range.row2],a=t.cell,s=wijmo_grid_1.CellType;i==s.ColumnHeader&&wijmo_1.toggleClass(a,"wj-group-header",0==t.range.row);if(i==s.Cell||i==s.ColumnHeader){var u=this._getGroupByColumn(t.col,i==s.ColumnHeader);wijmo_1.toggleClass(a,"wj-group-start",u._colstart==t.range.col);wijmo_1.toggleClass(a,"wj-group-end",u._colstart+u._colspanEff-1==t.range.col2)}if(o>1&&(i==s.Cell||i==s.RowHeader)){var _=n instanceof _MultiRow||n instanceof _MultiRowNewRowTemplate,c=l instanceof _MultiRow||l instanceof _MultiRowNewRowTemplate;wijmo_1.toggleClass(a,"wj-record-start",!!_&&0==n.recordIndex);wijmo_1.toggleClass(a,"wj-record-end",!!c&&l.recordIndex==o-1)}var w=this.alternatingRowStep;if(w){var d=!1;if(n instanceof _MultiRow){d=n.dataIndex%(w+1)==0;1==w&&(d=!d)}wijmo_1.toggleClass(a,"wj-alt",d)}if(this._centerVert&&!a.getAttribute("wj-state-measuring")){var p=t.range.rowSpan>1;if(p&&t.updateContent)if(0==a.childElementCount)a.innerHTML="<div>"+a.innerHTML+"</div>";else{var h=document.createElement("div"),f=document.createRange();f.selectNodeContents(a);f.surroundContents(h)}wijmo_1.toggleClass(a,"wj-center-vert",p)}};MultiRow.prototype._updateButtonGlyph=function(){var e=this._btnCollapse.querySelector("span");e instanceof HTMLElement&&(e.className=this.collapsedHeaders?"wj-glyph-left":"wj-glyph-down-left")};MultiRow.prototype._getError=function(t,o,r,i){if(wijmo_1.isFunction(this.itemValidator)&&t==this.rowHeaders){for(var n=[],l=0;l<this.rowsPerItem;l++)for(r=0;r<this.columns.length;r++){var a=this.itemValidator(o+l,r,i);if(a){var s=this.getMergedRange(this.cells,o+l,r);s&&(s.columnSpan>1&&s.col<r||s.rowSpan>1&&s.row<o+l)||n.push(a)}}if(n.length){var u=this.errorTip,_=!!u&&u.isContentHtml;return n.join(_?"<br/>":"\n")}}return e.prototype._getError.call(this,t,o,r,i)};MultiRow.prototype._getEmptyRequiredCell=function(e){if(e>=0){e-=this.rows[e].recordIndex;for(var t=0;t<this._getRowsPerItem();t++)for(var o=e+t,r=0;r<this.columns.length;r++){var i=this._getBindingColumn(this.cells,o,this.columns[r]),n=this.getCellData(o,r,!1);if(i.getIsRequired(this.rows[o])&&(""===n||null==n)){if(!i.isReadOnly)return new wijmo_grid_1.CellRange(o,r);console.warn("Incorrect data. Column "+r+" is at the same time required, empty and read-only")}}}return null};return MultiRow}(wijmo_grid_1.FlexGrid);exports.MultiRow=MultiRow;var _MergeManager=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,t,o,r){void 0===r&&(r=!0);var i=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:if(e.rows[t]instanceof wijmo_grid_1.GroupRow&&!i.multiRowGroupHeaders)return this._getGroupRowMergedRange(e,t,o,r,!1)}switch(e.cellType){case wijmo_grid_1.CellType.Cell:if(e.rows[t]instanceof wijmo_grid_1.GroupRow)return this._getGroupRowMergedRange(e,t,o,r,i.multiRowGroupHeaders);case wijmo_grid_1.CellType.ColumnHeader:var n=e.cellType==wijmo_grid_1.CellType.ColumnHeader,l=i._getGroupByColumn(o,n);wijmo_1.assert(l instanceof MultiRowCellGroup,"Failed to get the group!");var a=n?l.getMergedRange(e,t-1,o):l.getMergedRange(e,t,o),s=e.columns.frozen;if(s&&a&&a.columnSpan>1&&a.col<s&&a.col2>=s){a=a.clone();o<s?a.col2=s-1:a.col=s}var u=e.rows.frozen;if(u&&a&&a.rowSpan>1&&e.cellType==wijmo_grid_1.CellType.Cell&&a.row<u&&a.row2>=u){a=a.clone();t<u?a.row2=u-1:a.row=u}wijmo_1.assert(!a||a.contains(t,o),"Merged range must contain source cell");return a;case wijmo_grid_1.CellType.RowHeader:var _=i.rowsPerItem,c=t-e.rows[t].recordIndex,w=Math.min(c+_-1,e.rows.length-1);return new wijmo_grid_1.CellRange(c,0,w,e.columns.length-1);case wijmo_grid_1.CellType.TopLeft:var d=i.collapsedHeaders,p=e.rows.length-1,h=p>0?1:0,f=0!=d?0:h,g=1!=d?p:h;return new wijmo_grid_1.CellRange(f,0,g,e.columns.length-1)}return null};_MergeManager.prototype._getGroupRowMergedRange=function(t,o,r,i,n){void 0===i&&(i=!0);var l=t.grid,a=t.cellType,s=t.rows[o];if(l.showGroups&&!l.childItemsPath&&s instanceof _MultiGroupRow&&s.dataItem instanceof wijmo_1.CollectionViewGroup&&a==wijmo_grid_1.CellType.Cell){return l._layout._getGroupHeaderMergedRange(t,o,r,n)}return e.prototype.getMergedRange.call(this,t,o,r,i)};return _MergeManager}(wijmo_grid_1.MergeManager);exports._MergeManager=_MergeManager;var _MultiRowAddNewHandler=function(e){__extends(_MultiRowAddNewHandler,e);function _MultiRowAddNewHandler(t){t._addHdl._detach();return e.call(this,t)||this}_MultiRowAddNewHandler.prototype.updateNewRowTemplate=function(){for(var e=this._g.editableCollectionView,t=this._g,o=t.rows,r=e&&e.canAddNew&&t.allowAddNew&&!t.isReadOnly,i=-1,n=0;n<o.length;n+=t.rowsPerItem)if(o[n]instanceof _MultiRowNewRowTemplate){i=n;break}if(r&&i>-1&&(this._top&&i>0||!this._top&&0==i)){i=-1;this._removeNewRowTemplate()}if(r&&i<0)for(n=0;n<t.rowsPerItem;n++){var l=new _MultiRowNewRowTemplate(n);0==n&&(this._nrt=l);this._top?o.insert(n,l):o.push(l)}!r&&i>-1&&this._removeNewRowTemplate()};_MultiRowAddNewHandler.prototype._keydown=function(t){e.prototype._keydown.call(this,t);t.defaultPrevented||t.keyCode!=wijmo_1.Key.Escape||this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._beginningEdit=function(t,o){e.prototype._beginningEdit.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditStarting=function(t,o){e.prototype._rowEditStarting.call(this,t,o);this._top&&this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._rowEditEnded=function(t,o){e.prototype._rowEditEnded.call(this,t,o);this._copyNewDataItem()};_MultiRowAddNewHandler.prototype._copyNewDataItem=function(){if(this._top)for(var e=this._g,t=e.rows,o=0;o<e.rowsPerItem;o++)t[o]instanceof wijmo_grid_1._NewRowTemplate&&(t[o].dataItem=this._nrt.dataItem)};_MultiRowAddNewHandler.prototype._removeNewRowTemplate=function(){for(var e=0,t=this._g.rows;e<t.length;e++)if(t[e]instanceof wijmo_grid_1._NewRowTemplate){t.removeAt(e);e--}};return _MultiRowAddNewHandler}(wijmo_grid_1._AddNewHandler);exports._MultiRowAddNewHandler=_MultiRowAddNewHandler;var _MultiRowNewRowTemplate=function(e){__extends(_MultiRowNewRowTemplate,e);function _MultiRowNewRowTemplate(t){var o=e.call(this)||this;o._idxRecord=t;return o}Object.defineProperty(_MultiRowNewRowTemplate.prototype,"recordIndex",{get:function(){return this._idxRecord},enumerable:!0,configurable:!0});return _MultiRowNewRowTemplate}(wijmo_grid_1._NewRowTemplate);exports._MultiRowNewRowTemplate=_MultiRowNewRowTemplate;wijmo_1._registerModule("wijmo.grid.multirow",selfModule); |
{ | ||
"name": "@grapecity/wijmo.grid.multirow", | ||
"version": "5.20241.001-nightly.d20240111.t020133", | ||
"version": "5.20241.001-nightly.d20240112.t020133", | ||
"description": "UI library for pure JS, Angular, React, Vue and more...", | ||
@@ -10,5 +10,5 @@ "author": "MESCIUS inc", | ||
"dependencies": { | ||
"@grapecity/wijmo": "5.20241.001-nightly.d20240111.t020133", | ||
"@grapecity/wijmo.input": "5.20241.001-nightly.d20240111.t020133", | ||
"@grapecity/wijmo.grid": "5.20241.001-nightly.d20240111.t020133" | ||
"@grapecity/wijmo": "5.20241.001-nightly.d20240112.t020133", | ||
"@grapecity/wijmo.input": "5.20241.001-nightly.d20240112.t020133", | ||
"@grapecity/wijmo.grid": "5.20241.001-nightly.d20240112.t020133" | ||
}, | ||
@@ -15,0 +15,0 @@ "homepage": "https://developer.mescius.com/wijmo", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
186801
2