@mescius/wijmo.grid 5.20232.939
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMMERCIAL-LICENSE.html +485 -0
- package/README.md +363 -0
- package/es2015-commonjs.js +14 -0
- package/es2015-esm.js +14 -0
- package/es5-esm.js +14 -0
- package/index.d.ts +5152 -0
- package/index.js +14 -0
- package/package.json +45 -0
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use strict";var _a,__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 i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});var DataMapEditor,wijmo_1=require("@mescius/wijmo"),wijmo_input_1=require("@mescius/wijmo.input"),mInput=__importStar(require("@mescius/wijmo.input")),selfModule=__importStar(require("@mescius/wijmo.grid")),_safariVer=null;function _getSafariVer(){return _safariVer}exports._getSafariVer=_getSafariVer;if(wijmo_1.isSafari()){var match=navigator.userAgent.match(/version\/([\d\.]+)/i);if(null!=match){var version=match[1],parts=(match=version.match(/(\d+)/g)).map((function(e){return parseInt(e)}));_safariVer={full:version,major:parts[0],minor:parts[1]}}}!function(e){e[e.AutoComplete=0]="AutoComplete";e[e.DropDownList=1]="DropDownList";e[e.RadioButtons=2]="RadioButtons"}(DataMapEditor=exports.DataMapEditor||(exports.DataMapEditor={}));var DataMap=function(){function DataMap(e,t,i){this._keyPath="";this._displayPath="";this._sortByVal=!0;this._editable=!1;this._serK=!0;this.mapChanged=new wijmo_1.Event;if(wijmo_1.isArray(e)&&!t&&!i){e=e.map((function(e){return{value:e}}));t=i="value"}this._cv=wijmo_1.asCollectionView(e);this._keyPath=wijmo_1.asString(t,!1);this._displayPath=wijmo_1.asString(i,!1);this._cv.collectionChanged.addHandler(this.onMapChanged,this)}Object.defineProperty(DataMap.prototype,"sortByDisplayValues",{get:function(){return this._sortByVal},set:function(e){this._sortByVal=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(DataMap.prototype,"serializeKeys",{get:function(){return this._serK},set:function(e){if((e=wijmo_1.asBoolean(e))!==this._serK){var t=this._map,i=t&&t.size;this._map=null;this._serK=e;i&&this.onMapChanged(wijmo_1.EventArgs.empty)}},enumerable:!0,configurable:!0});Object.defineProperty(DataMap.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0});Object.defineProperty(DataMap.prototype,"selectedValuePath",{get:function(){return this._keyPath},enumerable:!0,configurable:!0});Object.defineProperty(DataMap.prototype,"displayMemberPath",{get:function(){return this._displayPath},enumerable:!0,configurable:!0});DataMap.prototype.getDataItem=function(e){var t=this;if(!this._map){var i=this._cv.sourceCollection,o=new wijmo_1._Map(this.serializeKeys);wijmo_1.isArray(i)&&this._keyPath&&i.forEach((function(e){var i=e[t._keyPath];o.has(i)||o.set(i,e)}));this._map=o}return this._map.get(e)};DataMap.prototype.getDisplayValue=function(e){var t=this._displayPath,i=this.getDataItem(e);return t&&i?i[t]:e};DataMap.prototype.getKeyValue=function(e,t){var i=this._displayPath,o=this._indexOf(e,i,t,!0);o<0&&(o=this._indexOf(e,i,t,!1));return o>-1?this._cv.sourceCollection[o][this._keyPath]:null};DataMap.prototype.getDisplayValues=function(e){var t=this;return this._cv&&this._displayPath?this._cv.items.map((function(e){return e[t._displayPath]})):[]};DataMap.prototype.getKeyValues=function(){var e=this;return this._cv&&this._keyPath?this._cv.items.map((function(t){return t[e._keyPath]})):[]};Object.defineProperty(DataMap.prototype,"isEditable",{get:function(){return this._editable},set:function(e){this._editable=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(DataMap.prototype,"search",{get:function(){return this._search},set:function(e){e&&(this._search=wijmo_1.asFunction(e))},enumerable:!0,configurable:!0});DataMap.prototype.onMapChanged=function(e){this._map=null;this.mapChanged.raise(this,e)};DataMap.prototype._indexOf=function(e,t,i,o){var n=-1,l=-1;if(this._cv&&t){var r=null!=e?e.toString():"";r&&i&&(e=wijmo_1.toPlainText(r));for(var s=o?r:r.toLowerCase(),a=this._cv.sourceCollection,c=0;c<a.length;c++){var u=a[c],d=u[t];null!=d&&null!=d||(d="");i&&wijmo_1.isString(d)&&(d=wijmo_1.toPlainText(d));d==e?n=c:o||d.length!=s.length||d.toLowerCase()!=s?null!=d&&d.toString()==r&&(n=c):n=c;if(n==c){if(!this._cv.filter||this._cv.filter(u))return n;l<0&&(l=n)}}}return l};return DataMap}();exports.DataMap=DataMap;var CellType,CellRange=function(){function CellRange(e,t,i,o){void 0===e&&(e=-1);void 0===t&&(t=-1);void 0===i&&(i=e);void 0===o&&(o=t);this.setRange(e,t,i,o)}CellRange.prototype.setRange=function(e,t,i,o){void 0===e&&(e=-1);void 0===t&&(t=-1);void 0===i&&(i=e);void 0===o&&(o=t);this._row=wijmo_1.asInt(e);this._col=wijmo_1.asInt(t);this._row2=wijmo_1.asInt(i);this._col2=wijmo_1.asInt(o)};Object.defineProperty(CellRange.prototype,"row",{get:function(){return this._row},set:function(e){this._row=wijmo_1.asInt(e)},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"col",{get:function(){return this._col},set:function(e){this._col=wijmo_1.asInt(e)},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"row2",{get:function(){return this._row2},set:function(e){this._row2=wijmo_1.asInt(e)},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"col2",{get:function(){return this._col2},set:function(e){this._col2=wijmo_1.asInt(e)},enumerable:!0,configurable:!0});CellRange.prototype.clone=function(){return new CellRange(this._row,this._col,this._row2,this._col2)};CellRange.prototype.copy=function(e){this.setRange(e._row,e._col,e._row2,e._col2)};Object.defineProperty(CellRange.prototype,"rowSpan",{get:function(){return Math.abs(this._row2-this._row)+1},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"columnSpan",{get:function(){return Math.abs(this._col2-this._col)+1},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"topRow",{get:function(){return Math.min(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"bottomRow",{get:function(){return Math.max(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"leftCol",{get:function(){return Math.min(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"rightCol",{get:function(){return Math.max(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"isValid",{get:function(){return this._row>-1&&this._col>-1&&this._row2>-1&&this._col2>-1},enumerable:!0,configurable:!0});Object.defineProperty(CellRange.prototype,"isSingleCell",{get:function(){return this._row==this._row2&&this._col==this._col2},enumerable:!0,configurable:!0});CellRange.prototype.contains=function(e,t){var i=wijmo_1.tryCast(e,CellRange);if(i)return i.topRow>=this.topRow&&i.bottomRow<=this.bottomRow&&i.leftCol>=this.leftCol&&i.rightCol<=this.rightCol;if(wijmo_1.isInt(e)&&wijmo_1.isInt(t))return e>=this.topRow&&e<=this.bottomRow&&t>=this.leftCol&&t<=this.rightCol;throw"contains expects a CellRange or row/column indices."};CellRange.prototype.containsRow=function(e){return wijmo_1.asInt(e)>=this.topRow&&e<=this.bottomRow};CellRange.prototype.containsColumn=function(e){return wijmo_1.asInt(e)>=this.leftCol&&e<=this.rightCol};CellRange.prototype.intersects=function(e){return this.intersectsRow(e)&&this.intersectsColumn(e)};CellRange.prototype.intersectsRow=function(e){return e&&!(this.bottomRow<e.topRow||this.topRow>e.bottomRow)};CellRange.prototype.intersectsColumn=function(e){return e&&!(this.rightCol<e.leftCol||this.leftCol>e.rightCol)};CellRange.prototype.getRenderSize=function(e){var t=new wijmo_1.Size(0,0);if(this.isValid){for(var i=this.topRow;i<=this.bottomRow;i++)e.rows[i]&&(t.height+=e.rows[i].renderSize);for(var o=this.leftCol;o<=this.rightCol;o++)e.columns[o]&&(t.width+=e.columns[o].renderSize)}return t};CellRange.prototype.equals=function(e){return e instanceof CellRange&&this._row==e._row&&this._col==e._col&&this._row2==e._row2&&this._col2==e._col2};CellRange.prototype.combine=function(e){return e?new CellRange(Math.min(this.topRow,e.topRow),Math.min(this.leftCol,e.leftCol),Math.max(this.bottomRow,e.bottomRow),Math.max(this.rightCol,e.rightCol)):this};CellRange.prototype.toString=function(){return wijmo_1.format("({row}, {col})-({row2}, {col2})",this)};return CellRange}();exports.CellRange=CellRange;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.TopLeft=4]="TopLeft";e[e.ColumnFooter=5]="ColumnFooter";e[e.BottomLeft=6]="BottomLeft"}(CellType=exports.CellType||(exports.CellType={}));var GridPanel=function(){function GridPanel(e,t,i,o,n){this._offsetY=0;this._rng=new CellRange;this._g=wijmo_1.asType(e,FlexGrid);this._ct=wijmo_1.asInt(t);this._rows=wijmo_1.asType(i,RowCollection);this._cols=wijmo_1.asType(o,ColumnCollection);this._e=wijmo_1.asType(n,HTMLElement);this._vrb=new CellRange;this._uid=wijmo_1.uidGenerator()}Object.defineProperty(GridPanel.prototype,"grid",{get:function(){return this._g},enumerable:!0,configurable:!0});Object.defineProperty(GridPanel.prototype,"cellType",{get:function(){return this._ct},enumerable:!0,configurable:!0});Object.defineProperty(GridPanel.prototype,"viewRange",{get:function(){return this._getViewRange()},enumerable:!0,configurable:!0});Object.defineProperty(GridPanel.prototype,"width",{get:function(){return this._cols.getTotalSize()},enumerable:!0,configurable:!0});Object.defineProperty(GridPanel.prototype,"height",{get:function(){return this._rows.getTotalSize()},enumerable:!0,configurable:!0});Object.defineProperty(GridPanel.prototype,"rows",{get:function(){return this._rows},enumerable:!0,configurable:!0});Object.defineProperty(GridPanel.prototype,"columns",{get:function(){return this._cols},enumerable:!0,configurable:!0});GridPanel.prototype.getCellData=function(e,t,i){var o,n=this._g,l=this._rows[wijmo_1.asNumber(e,!1,!0)],r=null;if(!l)return null;t=this._toIndex(t);o=this._cols[wijmo_1.asNumber(t,!1,!0)];var s=n?n._getBindingColumn(this,e,o):o,a=null;l instanceof GroupRow&&l.dataItem instanceof wijmo_1.CollectionViewGroup&&!n.childItemsPath&&(a=l.dataItem);s.binding&&l.dataItem&&!a?r=s._binding.getValue(l.dataItem):l._ubv&&(r=l._ubv[o._hash]);if(null==r){var c=CellType;switch(this._ct){case c.TopLeft:case c.ColumnHeader:e!=this._rows.length-1&&s==o||(r=s.header);break;case c.ColumnFooter:if(l instanceof GroupRow&&s.aggregate!=wijmo_1.Aggregate.None){var u=this._g.collectionView;if(u){var d=wijmo_1.tryCast(u,wijmo_1.CollectionView);r=d?d.getAggregate(s.aggregate,s.binding):wijmo_1.getAggregate(s.aggregate,u.items,s.binding)}}break;case c.Cell:l instanceof GroupRow&&(t==this._cols.firstVisibleIndex?r=l.getGroupHeader():a&&s.aggregate!=wijmo_1.Aggregate.None&&(r=a.getAggregate(s.aggregate,s.binding,this._g.collectionView,this._g)))}}if(i){var h=s.dataMap||l.dataMap;if(this.cellType==CellType.Cell&&s._edt&&s._edt._ctl instanceof wijmo_input_1.MultiSelect&&r){var _=new wijmo_1.Binding(s._edt._ctl.displayMemberPath),p=_&&wijmo_1.isArray(r)?r.map((function(e){return _.getValue(e)})):r;if(wijmo_1.isArray(p)&&p.length>0){var f=p.join(", ");r=wijmo_1.format(f||wijmo_1.culture.MultiSelect.itemsSelected,{count:p.length})}}else this.cellType==CellType.Cell&&h&&(r=h.getDisplayValue(r));r=null!=r?wijmo_1.Globalize.format(r,s.format||l.format):""}return r};GridPanel.prototype.setCellData=function(e,t,i,o,n,l){void 0===o&&(o=!0);void 0===n&&(n=!0);void 0===l&&(l=!1);var r=this._g,s=this._rows[wijmo_1.asNumber(e,!1,!0)],a=this._cols[wijmo_1.asNumber(this._toIndex(t),!1,!0)],c=wijmo_1.DataType;if(!s)return!1;var u=r?r._getBindingColumn(this,e,a):a,d=u.dataMap||s.dataMap;if(this._ct==CellType.Cell){var h=u.getIsRequired(s),_=u.isContentHtml||s.isContentHtml;if(!l&&d&&null!=i){var p=d.getKeyValue(i,_);if(null==p&&null==d.getDisplayValue(null)){if(d.getDisplayValue(i)!=i);else if(!d.isEditable||d.displayMemberPath!=d.selectedValuePath){if(""!=i||h||!r.commitEmptyEdits)return!1;i=null}}else i=p}var f=c.Object,g=u.dataType||s.dataType,m=this.getCellData(e,t,!1);f=g||wijmo_1.getType(m);if(null==i||""===i&&o&&!d){if(h||!r.commitEmptyEdits&&(null==m||""===m))return!1;f!=c.String&&(i=null);o=!1}if("NaN"==i&&Number.isNaN(m)&&!r.commitEmptyEdits)return!1;if(o){var w=u.format||s.format;w||f!=c.Date||(w="d");u.mask&&wijmo_1.isString(i)&&f!=c.String&&(i=i.replace(/_/g,""));i=wijmo_1.changeType(i,f,w,m);if(f!=c.Object&&wijmo_1.getType(i)!=f)return!1}}if(s.dataItem&&u.binding){var C=u._binding,v=s.dataItem,y=C.getValue(v);if(i!==y&&(d&&!d.serializeKeys||!wijmo_1.DateTime.equals(i,y))){var b=r.collectionView,R=b instanceof wijmo_1.CollectionView&&v!=b.currentEditItem&&b.trackChanges,j=null;R&&(j=b._extend({},v));C.setValue(v,i);if(R){var E=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,v,b.items.indexOf(v));b.onCollectionChanged(E,j)}}}else{s._ubv||(s._ubv={});s._ubv[a._hash]=i}n&&r&&r.invalidate();return!0};GridPanel.prototype.getCellBoundingRect=function(e,t,i){var o=this._g,n=this.rows[e],l=this.columns[this._toIndex(t)],r=new wijmo_1.Rect(l.pos,n.pos,l.renderSize,n.renderSize);if(o.rightToLeft){r.left=this.hostElement.clientWidth-r.right;wijmo_1.isIE()||(r.left-=o._root.offsetWidth-o._root.clientWidth)}if(!i){var s=this.hostElement.getBoundingClientRect();r.left+=s.left;r.top+=s.top-this._offsetY}e<this.rows.frozen&&(r.top-=o.scrollPosition.y);Number(t)<Number(this.columns.frozen)&&(r.left-=o.scrollPosition.x*(o.rightToLeft?-1:1));return r};GridPanel.prototype.getCellElement=function(e,t){var i=this.hostElement.children,o=Math.min(e+2,i.length);t=this._toIndex(t);for(var n=0;n<o;n++)for(var l=i[n].children,r=Math.min(t+2,l.length),s=0;s<r;s++){var a=l[s],c=a[GridPanel._INDEX_KEY];if(c&&(c.row==e&&c.col==t||c.rng&&c.rng.contains(e,t)))return a}return null};GridPanel.prototype.getSelectedState=function(e,t,i){var o=this._g,n=o.selectionMode,l=o._selHdl.selection,r=SelectionMode,s=SelectedState;if(n==r.None)return s.None;t=this._toIndex(t);switch(this._ct){case CellType.Cell:i||(i=o.getMergedRange(this,e,t));var a=o._getAnchorCell();if(i){if(i.contains(l.row,l.col)){if(!o.anchorCursor||null==a)return o.showMarquee?s.Active:s.Cursor;if(e==a.y&&t==a.x||i.row==a.y&&i.col==a.x)return o.showMarquee?s.Active:s.Cursor}if(i.intersects(l)&&o.anchorCursor&&null!=a&&(e==a.y&&t==a.x||i.row==a.y&&i.col==a.x))return o.showMarquee?s.Active:s.Cursor;if(i.intersects(l)&&n!=r.ListBox)return s.Selected;for(var c=i.leftCol;c<=i.rightCol;c++)if(o.columns[c]&&o.columns[c].isSelected)return s.Selected;for(var u=i.topRow;u<=i.bottomRow;u++)if(o.rows[u].isSelected)return s.Selected}if(o.anchorCursor&&null!=a){if(e==a.y&&t==a.x)return o.showMarquee?s.Active:s.Cursor}else if(l.row==e&&l.col==t)return o.showMarquee?s.Active:s.Cursor;if(o.rows[e].isSelected||o.columns[t].isSelected)return s.Selected;if(n==r.MultiRange)for(var d=o._selHdl.extendedSelection,h=0;h<d.length;h++)if(d[h].contains(e,t)||i&&i.intersects(d[h]))return s.Selected;if(i)switch(n){case r.Row:case r.RowRange:if(i.containsRow(l.row))return s.Selected}return n==r.ListBox?s.None:(l=this._getAdjustedSelection(l)).containsRow(e)&&l.containsColumn(t)?s.Selected:s.None;case CellType.ColumnHeader:if(o.showSelectedHeaders&HeadersVisibility.Column&&(o.columns[t].isSelected||l.containsColumn(t)||l.intersectsColumn(i))){i&&(e=i.bottomRow);if(e==this.rows.length-1)return s.Selected}break;case CellType.RowHeader:if(o.showSelectedHeaders&HeadersVisibility.Row&&(o.rows[e].isSelected||l.containsRow(e)||l.intersectsRow(i))){i&&(t=i.rightCol);if(t==this.columns.length-1)return s.Selected}}return s.None};Object.defineProperty(GridPanel.prototype,"hostElement",{get:function(){return this._e},enumerable:!0,configurable:!0});GridPanel.prototype._toIndex=function(e){if(wijmo_1.isString(e)&&(e=this._cols.indexOf(e))<0)throw"Invalid column name or binding.";return e};GridPanel.prototype._getAdjustedSelection=function(e){var t=this._g,i=this._rng,o=SelectionMode;switch(t.selectionMode){case o.Cell:i.setRange(e.row,e.col,e.row,e.col);break;case o.Row:i.setRange(e.row,0,e.row,t.columns.length-1);break;case o.RowRange:case o.ListBox:i.setRange(e.row,0,e.row2,t.columns.length-1);break;default:i.copy(e)}return i};GridPanel.prototype._getOffsetY=function(){return this._offsetY};GridPanel.prototype._updateContent=function(e,t,i){var o=this._g,n=this._e,l=this._rows,r=this._cols,s=this._ct;if(s==CellType.ColumnHeader||s==CellType.ColumnFooter||s==CellType.RowHeader){var a=o._ptScrl,c=n.style;s==CellType.RowHeader?c.top=a.y+"px":o.rightToLeft?c.right=a.x+"px":c.left=a.x+"px"}if(this._offsetY!=i){e=!1;this._offsetY=i}var u=this._getViewRange(),d=u;if(d.isValid){var h=l.length<=o._vtRows?l.length:0,_=r.length<=o._vtCols?r.length:0;d=new CellRange(Math.max(u.row-h,l.frozen),Math.max(u.col-_,r.frozen),Math.min(u.row2+h,l.length-1),Math.min(u.col2+_,r.length-1))}if(e&&!t&&this._vrb.contains(u)&&!l.frozen&&!r.frozen)return this._activeCell;e&&d.equals(this._vrb)||(t=!1);e&&!t&&this._ct!=CellType.TopLeft&&this._reorderCells(d,this._vrb);this._activeCell=null;this._vru=u;this._vrb=d;this._recycle=e;var p=0;this._ct!=CellType.Cell||[HeadersFocusability.All,HeadersFocusability.Column].includes(this._g.headersFocusability)||(p=this._renderColHdrRow(d,t));this._updateCells(t,p);return this._activeCell};GridPanel.prototype._updateCells=function(e,t){this._e;for(var i=this._rows,o=0;o<i.frozen&&o<i.length;o++)t=this._renderRow(o,this._vrb,e,t);for(o=this._vrb.topRow;o<=this._vrb.bottomRow&&o>-1;o++)t=this._renderRow(o,this._vrb,e,t);this._scanAndRemoveExtraCells(t)};GridPanel.prototype._scanAndRemoveExtraCells=function(e){for(var t=this._e;t.childElementCount>e;){var i=t.lastElementChild;wijmo_1.removeChild(i);this._removeExtraCells(i,0)}};GridPanel.prototype._clearCells=function(){for(var e=this.hostElement,t=this._g.cellFactory,i=e.childElementCount-1;i>=0;i--){var o=e.children[i];wijmo_1.removeChild(o);for(var n=o.childElementCount-1;n>=0;n--)t.disposeCell(o.children[n])}};GridPanel.prototype._reorderCells=function(e,t){var i=this;if(this._g._reorderCells&&t.isValid&&e.isValid&&e.intersects(t)){var relocateForScrollToBeginning=function(e,t,o,n,l,r){wijmo_1.assert(o<0,"Scroll delta must be a negative number");var s,a,c=-o,u=t+(n-l+1),d=e.childElementCount-u;if(d<c&&d>0){s=d;a=c-d}else{s=c;a=0}if(s>0){var h=i._createRange(e,u,u+s);h&&e.insertBefore(h.extractContents(),e.children[t])}if(a>0)for(var _=e.children[t],p=0;p<a;p++){var f=document.createElement("div");f.className=r;e.insertBefore(f,_)}};if(e.row!=t.row){var o=this._e;if(0!=(a=e.row-t.row)){var n=this._ct==CellType.Cell?1:0,l=o.childElementCount;n+=this.rows.frozen;if(a>0){var r=n,s=Math.min(n+a,l);(d=this._createRange(o,r,s))&&o.appendChild(d.extractContents())}else relocateForScrollToBeginning(o,n,a,e.row2,t.row,"wj-row")}}if(e.col!=t.col){var a;o=this._e;if(0!=(a=e.col-t.col)){n=this._ct==CellType.Cell&&this._g.rowHeaderPath?1:0;n+=this.columns.frozen;for(var c=0;c<o.children.length;c++){var u=o.children[c];l=u.children.length;if(wijmo_1.hasClass(u,"wj-row"))if(a>0){var d;r=n,s=Math.min(n+a,l);(d=this._createRange(u,r,s))&&u.appendChild(d.extractContents())}else relocateForScrollToBeginning(u,n,a,e.col2,t.col,"wj-cell")}}}}};GridPanel.prototype._createRange=function(e,t,i){if(i>t&&i<=e.children.length&&t>-1){this._docRange||(this._docRange=document.createRange());var o=this._docRange;o.setStart(e,t);o.setEnd(e,i);return o}return null};GridPanel.prototype._renderColHdrRow=function(e,t){if(t)return 1;var i=this._e.children[0];i||(i=wijmo_1.createElement('<div class="wj-row" role="row"></div>',this._e));var o=this._g,n=o?o.columnHeaders.rows.ariaLabel:null;wijmo_1.setAttribute(i,"aria-label",n);wijmo_1.setAttribute(i,"aria-selected",null);var l=0,r=this._g._getRowHeaderPath();r&&(l=this._renderRowHdrCell(i,-1,r.path));for(var s=0;s<this.columns.frozen&&s<this.columns.length;s++)l=this._renderColHdrCell(i,s,e,t,l);for(s=e.leftCol;s<=e.rightCol&&s>-1;s++)l=this._renderColHdrCell(i,s,e,t,l);[HeadersVisibility.None,HeadersVisibility.Row].includes(o.headersVisibility)&&wijmo_1.setAttribute(i.closest(".wj-row"),"aria-hidden","true");this._removeExtraCells(i,l);return 1};GridPanel.prototype._renderColHdrCell=function(e,t,i,o,n){var l=this.grid,r=this.columns[t];if(r.renderSize<=0)return n;if(o)return n+1;var s=e.children[n];s||(s=wijmo_1.createElement(GridPanel._HTML_CELL,e));if(s&&this._recycle&&l._lazyRender){var a=s[GridPanel._INDEX_KEY];if(a&&-1==a.row&&a.col==t&&t>=this.columns.frozen)return n+1}s.textContent=this.columns[t].header;wijmo_1.setCss(s,{position:"fixed",left:r.pos,top:-32e3,width:r.renderSize,height:.1,overflow:"hidden",opacity:"0",pointerEvents:"none"});exports.colHdrAriaAttributes(s,r,this,l);s[GridPanel._INDEX_KEY]={row:-1,col:t,panel:this};return n+1};GridPanel.prototype._renderRowHdrCell=function(e,t,i){var o=e.children[0];o||(o=wijmo_1.createElement(GridPanel._HTML_CELL,e));o.setAttribute("role",t<0?"columnheader":"rowheader");o.textContent=i?i.toString():"";wijmo_1.setCss(o,{position:"fixed",left:-32e3,top:-32e3,width:.1,height:.1,overflow:"hidden",opacity:"0"});o[GridPanel._INDEX_KEY]={row:t,col:-1,panel:this};return 1};GridPanel.prototype._renderRow=function(e,t,i,o){var n=this._g,l=this.rows[e];if(l.renderSize<=0)return o;var r=this._e.children[o];r||(r=wijmo_1.createElement('<div class="wj-row"></div>',this._e));if(this._ct==CellType.Cell){r.setAttribute("role","row");var s=SelectionMode,a=l.isSelected;switch(n.selectionMode){case s.Row:case s.RowRange:a=a||this._g._selHdl.selection.containsRow(e)}wijmo_1.setAttribute(r,"aria-selected",!!a||null);wijmo_1.setAttribute(r,"aria-level",l instanceof GroupRow?l.level+1:null);wijmo_1.setAttribute(r,"aria-expanded",l instanceof GroupRow?!l.isCollapsed:null);this.rows.ariaLabel&&wijmo_1.setAttribute(r,"aria-label",this.rows.ariaLabel)}var c=0;if(this._ct==CellType.Cell){var u=this._g._getRowHeaderPath();u&&(c=this._renderRowHdrCell(r,e,u.getValue(l.dataItem)))}for(var d=0;d<this.columns.frozen&&d<this.columns.length;d++)c=this._renderCell(r,e,d,t,i,c);for(d=t.leftCol;d<=t.rightCol&&d>-1;d++)c=this._renderCell(r,e,d,t,i,c);this._removeExtraCells(r,c);return o+1};GridPanel.prototype._renderCell=function(e,t,i,o,n,l){var r=this._g,s=this._ct==CellType.Cell?r.getMergedRange(this,t,i,!1):r.getMergedRange(this,t,i);if(s){for(var a=Math.max(o.row,s.row);a<t;a++)if(this.rows[a].renderSize)return l;for(a=Math.max(o.col,s.col);a<i;a++)if(this.columns[a].renderSize)return l;if(t>=s.row&&t<=s.row2&&i>s.col&&i<=s.col2&&this._ct===CellType.Cell&&s.isSingleCell)return l;var c=this.columns.frozen;if(c&&s.col<c&&s.col2>=c&&i>s.col)return l}var u=this.columns[i];if((!u||u.renderSize<=0)&&(!s||s.getRenderSize(this).width<=0))return l;var d=e.children[l];if(d&&!n&&this._recycle&&r._lazyRender&&!r.activeEditor){var h=d[GridPanel._INDEX_KEY];h&&h.row==t&&h.col==i&&h.rng==s&&t>=this.rows.frozen&&i>=this.columns.frozen&&(n=!0)}var _=SelectedState,p=this.getSelectedState(t,i,s),f=p==_.Cursor||p==_.Active;if(d&&n){wijmo_1.toggleClass(d,"wj-state-active",f);wijmo_1.toggleClass(d,"wj-state-selected",p==_.Cursor);wijmo_1.toggleClass(d,"wj-state-multi-selected",p==_.Selected);var g=d.querySelector(".wj-column-selector");g?f||p!=_.None?wijmo_1.setAttribute(d,"aria-selected",!!g.checked):wijmo_1.setAttribute(d,"aria-selected",null):wijmo_1.setAttribute(d,"aria-selected",!(!f&&p==_.None)||null);f&&(this._activeCell=d);return l+1}d||(d=wijmo_1.createElement(GridPanel._HTML_CELL,e));f&&(this._activeCell=d);if(this._ct==CellType.Cell){wijmo_1.setAttribute(d,"role","gridcell");wijmo_1.setAttribute(d,"aria-selected",!(p==_.None&&!f)||null);var m=!r.canEditCell(t,i)||null;wijmo_1.setAttribute(d,"aria-readonly",m);wijmo_1.setAttribute(d,"aria-required",m?null:u.getIsRequired())}r.cellFactory.updateCell(this,t,i,d,s);d[GridPanel._INDEX_KEY]={row:t,col:i,rng:s,panel:this};return l+1};GridPanel.prototype._removeExtraCells=function(e,t){for(var i=this._g.cellFactory;e.childElementCount>t;){var o=e.lastElementChild;wijmo_1.removeChild(o);i.disposeCell(o)}for(var n=e.childElementCount-1;n>-1;--n){var l=[e.children[n],e.children[n-1]],r=l[1];if((o=l[0])&&r){var s=o.getAttribute("style")===r.getAttribute("style"),a=o.innerHTML===r.innerHTML;if(!s||!a)break;wijmo_1.removeChild(o);i.disposeCell(o)}}};GridPanel.prototype._getViewRange=function(){var e=this._g,t=e._ptScrl,i=e._szClientSB,o=this._rows,n=this._cols,l=new CellRange(0,0,o.length-1,n.length-1);if(this._ct==CellType.Cell||this._ct==CellType.RowHeader){var r=-t.y+this._offsetY,s=i.height;if((d=Math.min(o.frozen,o.length-1))>0){r+=p=o[d-1].pos;s-=p}if(d>0&&o[d].pos>i.height)l.row=l.row2=-1;else{l.row=Math.min(o.length-1,Math.max(d,o.getItemAt(r)));l.row2=Math.max(l.row,o.getItemAt(r+s))}var a=e.hostElement;if(e._clipToScreen&&a){var c=a.getBoundingClientRect(),u=-c.top-e.cells._e.offsetTop;c.top<0&&(l.row=Math.max(l.row,o.getItemAt(u)-1));c.bottom>innerHeight&&(l.row2=Math.min(l.row2,o.getItemAt(u+innerHeight)+1))}}if(this._ct==CellType.Cell||this._ct==CellType.ColumnHeader){var d,h=-t.x,_=i.width;if((d=Math.min(n.frozen,n.length-1))>0){var p;h+=p=n[d-1].pos;_-=p}if(d>0&&n[d].pos>i.width)l.col=l.col2=-1;else{l.col=Math.min(n.length-1,Math.max(d,n.getItemAt(h)));l.col2=Math.max(l.col,n.getItemAt(h+_))}}o.length<=o.frozen&&(l.row=l.row2=-1);n.length<=n.frozen&&(l.col=l.col2=-1);return l};GridPanel.prototype._getFrozenPos=function(){var e=this._rows.frozen,t=this._cols.frozen,i=e>0?this._rows[e-1]:null,o=t>0?this._cols[t-1]:null,n=i?i.pos+i.renderSize:0,l=o?o.pos+o.renderSize:0;return new wijmo_1.Point(l,n)};GridPanel._INDEX_KEY="wj-cell-index";GridPanel._HTML_CELL='<div class="wj-cell" tabindex="-1"></div>';return GridPanel}();exports.GridPanel=GridPanel;var CellRangeEventArgs=function(e){__extends(CellRangeEventArgs,e);function CellRangeEventArgs(t,i,o){var n=e.call(this)||this;n._p=wijmo_1.asType(t,GridPanel,!0);n._rng=wijmo_1.asType(i,CellRange,!0);n._data=o;return n}Object.defineProperty(CellRangeEventArgs.prototype,"panel",{get:function(){return this._p},enumerable:!0,configurable:!0});Object.defineProperty(CellRangeEventArgs.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(CellRangeEventArgs.prototype,"row",{get:function(){return this._rng.row},enumerable:!0,configurable:!0});Object.defineProperty(CellRangeEventArgs.prototype,"col",{get:function(){return this._rng.col},enumerable:!0,configurable:!0});Object.defineProperty(CellRangeEventArgs.prototype,"data",{get:function(){return this._data},set:function(e){this._data=e},enumerable:!0,configurable:!0});CellRangeEventArgs.prototype.getRow=function(){return this._p&&this.row>-1?this._p.rows[this.row]:null};CellRangeEventArgs.prototype.getColumn=function(e){var t=this._p,i=t&&this.col>-1?t.columns[this.col]:null;if(i&&e){var o=t.grid;i=t.cellType===CellType.ColumnHeader&&o._hasColumnGroups()?o._getColumnGroup(this.row,this.col):t.grid._getBindingColumn(t,this.row,i)}return i};return CellRangeEventArgs}(wijmo_1.CancelEventArgs);exports.CellRangeEventArgs=CellRangeEventArgs;var FormatItemEventArgs=function(e){__extends(FormatItemEventArgs,e);function FormatItemEventArgs(t,i,o,n){void 0===n&&(n=!0);var l=e.call(this,t,i)||this;l._updateContent=!0;l._cell=wijmo_1.asType(o,HTMLElement);return l}Object.defineProperty(FormatItemEventArgs.prototype,"cell",{get:function(){return this._cell},enumerable:!0,configurable:!0});Object.defineProperty(FormatItemEventArgs.prototype,"updateContent",{get:function(){return this._updateContent},enumerable:!0,configurable:!0});return FormatItemEventArgs}(CellRangeEventArgs);exports.FormatItemEventArgs=FormatItemEventArgs;var SelectionMode,SelectedState,SelMove,CellEditEndingEventArgs=function(e){__extends(CellEditEndingEventArgs,e);function CellEditEndingEventArgs(){var t=null!==e&&e.apply(this,arguments)||this;t._stayInEditMode=!1;t._refresh=!0;return t}Object.defineProperty(CellEditEndingEventArgs.prototype,"stayInEditMode",{get:function(){return this._stayInEditMode},set:function(e){this._stayInEditMode=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(CellEditEndingEventArgs.prototype,"refresh",{get:function(){return this._refresh},set:function(e){this._refresh=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(CellEditEndingEventArgs.prototype,"previousData",{get:function(){return null!=this._previousData?this._previousData:this._data},set:function(e){this._previousData=e},enumerable:!0,configurable:!0});return CellEditEndingEventArgs}(CellRangeEventArgs);exports.CellEditEndingEventArgs=CellEditEndingEventArgs;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.CellRange=2]="CellRange";e[e.Row=3]="Row";e[e.RowRange=4]="RowRange";e[e.ListBox=5]="ListBox";e[e.MultiRange=6]="MultiRange"}(SelectionMode=exports.SelectionMode||(exports.SelectionMode={}));!function(e){e[e.None=0]="None";e[e.Selected=1]="Selected";e[e.Cursor=2]="Cursor";e[e.Active=3]="Active"}(SelectedState=exports.SelectedState||(exports.SelectedState={}));!function(e){e[e.None=0]="None";e[e.Next=1]="Next";e[e.Prev=2]="Prev";e[e.NextPage=3]="NextPage";e[e.PrevPage=4]="PrevPage";e[e.Home=5]="Home";e[e.End=6]="End";e[e.NextCell=7]="NextCell";e[e.PrevCell=8]="PrevCell";e[e.NextEditableCell=9]="NextEditableCell";e[e.PrevEditableCell=10]="PrevEditableCell"}(SelMove=exports.SelMove||(exports.SelMove={}));var RowColFlags,_SelectionHandler=function(){function _SelectionHandler(e){this._sel=new CellRange(0,0);this._xSel=new wijmo_1.ObservableArray;this._mode=SelectionMode.CellRange;this._g=e;this._e=new CellRangeEventArgs(e.cells,new CellRange(0,0));this._xSel.collectionChanged.addHandler((function(){e.invalidate()}))}Object.defineProperty(_SelectionHandler.prototype,"selectionMode",{get:function(){return this._mode},set:function(e){e!=this._mode&&this._setSelectionMode(e)},enumerable:!0,configurable:!0});Object.defineProperty(_SelectionHandler.prototype,"selection",{get:function(){return this._sel},set:function(e){this.select(e)},enumerable:!0,configurable:!0});Object.defineProperty(_SelectionHandler.prototype,"extendedSelection",{get:function(){return this._xSel},enumerable:!0,configurable:!0});_SelectionHandler.prototype.select=function(e,t,i){void 0===t&&(t=!0);void 0===i&&(i=!1);var o=this._g,n=this._e.range,l=this._sel,r=n,s=!1,a=SelectionMode;if(wijmo_1.isNumber(e)&&wijmo_1.isString(t)){var c=o.columns.indexOf(t);if(c<0)throw"Invalid column name or binding.";n.setRange(e,c);t=!0}else if(wijmo_1.isNumber(e)&&wijmo_1.isNumber(t)){n.setRange(e,t);t=!0}else e instanceof CellRange?n.copy(e):wijmo_1.assert(!1,"CellRange expected");switch(o.selectionMode){case a.Cell:r.row2=r.row;r.col2=r.col;break;case a.Row:r.row2=r.row;break;case a.ListBox:s=!0}var u=r.equals(l);if(u&&s)for(var d=0;d<o.rows.length;d++)if(o.rows[d].isSelected!==r.containsRow(d)){u=!1;break}if(u){t&&o.isRangeValid(r)&&this._showSelection();return!0}var h=wijmo_1.Control.getControl(wijmo_1.closest(wijmo_1.getActiveElement(),".wj-flexgrid"));if(h&&h.activeEditor&&!h.finishEditing())return!1;var _=this._e;_._rng=r;_.cancel=!1;if(!o.onSelectionChanging(_)&&!i)return!1;s&&o.rows.forEach((function(e,t){e._setFlag(RowColFlags.Selected,r.containsRow(t),!0)}));r.row=Math.min(r.row,o.rows.length-1);r.row2=Math.min(r.row2,o.rows.length-1);this._sel.copy(r);o.refreshCells(!1,!0,!0);t&&this._showSelection();var p=o.collectionView;if(p){var f=o._getCvIndex(r.row);p.moveCurrentToPosition(f)}this._g.errorTip.hide();var g=wijmo_1.getActiveElement();g.classList.contains("wj-state-invalid")&&this._g.errorTip._showAutoTip(void 0,g);o.onSelectionChanged(_);return!0};_SelectionHandler.prototype.moveSelection=function(e,t,i){var o=this._g,n=this._sel,l=i&&o.anchorCursor?new CellRange(n.row2,n.col2):new CellRange(n.row,n.col),r=l.row,s=l.col,a=o.columns,c=Math.max(0,o._szClient.height-o.columnHeaders.height),u=SelMove,d=-1,h=o.getMergedRange(o.cells,r,s);h&&(t==u.NextCell||t==u.NextEditableCell?s=h.rightCol:t!=u.PrevCell&&t!=u.PrevEditableCell||(s=h.leftCol));switch(t){case u.NextCell:case u.NextEditableCell:d=s;(s=this._getNextColumnCell(r,d,t))!=d&&(h=o.getMergedRange(o.cells,r,s))&&s<h.col2&&(s=h.col2);if(s==d)for(;;){if(r==o.rows.length-1){s=l.col;r=l.row;break}var _=!1;if((r=this._getNextRowCell(r,s,t))>l.row){d=-1;for(;d<a.length;){if((s=this._getNextColumnCell(r,d,t))==d){_=!0;break}(h=o.getMergedRange(o.cells,r,s))&&s<h.col2&&(s=h.col2);break}if(_)continue}break}o.select(r,s);break;case u.PrevCell:case u.PrevEditableCell:d=s;(s=this._getNextColumnCell(r,d,t))!=d&&(h=o.getMergedRange(o.cells,r,s))&&s>h.col&&(s=h.col);if(s==d)for(;;){if(0==r){s=l.col;r=l.row;break}_=!1;if((r=this._getNextRowCell(r,s,t))<l.row){d=a.length;for(;d>-1;){(s=this._getNextColumnCell(r,d,t))!=d?(h=o.getMergedRange(o.cells,r,s))&&s>h.col&&(s=h.col):_=!0;break}if(_)continue}break}o.select(r,s);break;default:if(!this.moveHeaderCells(e,t,r,s)){r=this._getNextRowCell(r,s,e,c);s=this._getNextColumnCell(r,s,t,c);i?o.selection=o.anchorCursor?new CellRange(n.row,n.col,r,s):new CellRange(r,s,n.row2,n.col2):o.select(r,s);break}}};_SelectionHandler.prototype.moveHeaderCells=function(e,t,i,o){var n=this._g,l=[HeadersFocusability.Column,HeadersFocusability.All].includes(n.headersFocusability),r=[HeadersFocusability.Row,HeadersFocusability.All].includes(n.headersFocusability),s=n.activePanelType===CellType.ColumnHeader,a=n.activePanelType===CellType.RowHeader,c=n.activePanelType===CellType.TopLeft,u=n.activePanelType===CellType.Cell,d=2===e?"up":1===e?"down":2===t?"left":1===t?"right":void 0,h=Array.from(n.activePanel.hostElement.getElementsByClassName("wj-focus-header-cell"))[0];if(u&&l&&0===i&&"up"===d){n.activePanelType=CellType.ColumnHeader;var _=Array.from(n.activePanel.hostElement.getElementsByClassName("wj-row")),p=Array.from(n._gpCells.hostElement.getElementsByClassName("wj-row"))[0],f=_[_.length-1];(Array.from(p.getElementsByClassName("wj-cell")).find((function(e){return e["wj-cell-index"].col===o}))||Array.from(p.getElementsByClassName("wj-cell"))[0]).setAttribute("tabindex","-1");(m=Array.from(f.getElementsByClassName("wj-cell")).find((function(e){return e["wj-cell-index"].col===o}))).classList.add("wj-focus-header-cell");m.setAttribute("tabindex","0");n._hideMarquee();m.focus();return!0}if(u&&r&&0===o&&"left"===d){n.activePanelType=CellType.RowHeader;var g=(_=Array.from(n.activePanel.hostElement.getElementsByClassName("wj-row"))).find((function(e){return Array.from(e.getElementsByClassName("wj-cell")).some((function(e){return e["wj-cell-index"].row===i}))}));if(!g)return!0;var m,w=Array.from(g.getElementsByClassName("wj-cell"));(m=w[w.length-1]).classList.add("wj-focus-header-cell");m.setAttribute("tabindex","0");n._hideMarquee();m.focus();return!0}if(s&&h){var C=h.nextElementSibling,v=h.previousElementSibling;if(h&&"right"===d&&C){h.classList.remove("wj-focus-header-cell");h.setAttribute("tabindex","-1");n.scrollIntoView(0,h["wj-cell-index"].col+1);setTimeout((function(){C.classList.add("wj-focus-header-cell");C.setAttribute("tabindex","0");n._hideMarquee();C.focus()}),10)}else if(h&&"left"===d){h.classList.remove("wj-focus-header-cell");h.setAttribute("tabindex","-1");if(v){n.scrollIntoView(0,h["wj-cell-index"].col-1);setTimeout((function(){v.classList.add("wj-focus-header-cell");v.setAttribute("tabindex","0");n._hideMarquee();v.focus()}),10)}else{n.activePanelType=CellType.TopLeft;var y=Array.from(n.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];y&&setTimeout((function(){y.classList.add("wj-focus-header-cell");y.setAttribute("tabindex","0");n._hideMarquee();y.focus()}),10)}}else if(h&&"down"===d){var b=Array.from(h.parentElement.children).indexOf(h);n.activePanelType=CellType.Cell;n.focus();n.select(0,b);n._updateMarquee()}return!0}if(a&&h){b=Array.from(h.parentElement.children).indexOf(h);var R=h["wj-cell-index"].row,j=h.parentElement.nextElementSibling&&Array.from(h.parentElement.nextElementSibling.children)[b],E=h.parentElement.previousElementSibling&&Array.from(h.parentElement.previousElementSibling.children)[b];if("up"===d){h.classList.remove("wj-focus-header-cell");h.setAttribute("tabindex","-1");if(E){n.scrollIntoView(R-1,0);setTimeout((function(){E.classList.add("wj-focus-header-cell");E.setAttribute("tabindex","0");E.focus()}),10)}else{n.activePanelType=CellType.TopLeft;var x=Array.from(n.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];x&&setTimeout((function(){x.classList.add("wj-focus-header-cell");x.setAttribute("tabindex","0");n._hideMarquee();x.focus()}),10)}}else if("down"===d&&j){h.classList.remove("wj-focus-header-cell");h.setAttribute("tabindex","-1");n.scrollIntoView(R+1,0);setTimeout((function(){j.classList.add("wj-focus-header-cell");j.setAttribute("tabindex","0");j.focus()}),10)}else if(h&&"right"===d){n.activePanelType=CellType.Cell;h.classList.remove("wj-focus-header-cell");h.setAttribute("tabindex","-1");n.focus();n.select(R,0)}return!0}if(c&&h){if("down"===d&&r){n.activePanelType=CellType.RowHeader;h.classList.remove("wj-focus-header-cell");h.setAttribute("tabindex","-1");var S=Array.from(n.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];S&&setTimeout((function(){S.classList.add("wj-focus-header-cell");S.setAttribute("tabindex","0");S.focus()}),10)}if("right"===d&&l){n.activePanelType=CellType.ColumnHeader;h.classList.remove("wj-focus-header-cell");h.setAttribute("tabindex","-1");var H=Array.from(n.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];H&&setTimeout((function(){H.classList.add("wj-focus-header-cell");H.setAttribute("tabindex","0");H.focus()}),10)}return!0}return!1};_SelectionHandler.prototype._getNextColumnCell=function(e,t,i,o){void 0===o&&(o=0);return this._g.columns.getNextCell(t,i,o)};_SelectionHandler.prototype._getNextRowCell=function(e,t,i,o){void 0===o&&(o=0);return this._g.rows.getNextCell(e,i,o)};_SelectionHandler.prototype._setSelectionMode=function(e){var t=this._g,i=t.rows;this._mode=e;this._xSel.clear();if(i.length){this._adjustSelection(this._sel,e,!0);t.invalidate()}};_SelectionHandler.prototype._adjustSelection=function(e,t,i){void 0===i&&(i=!1);var o=this._g.rows,n=SelectionMode,l=this._g.hostElement.querySelector("input.wj-column-selector")instanceof HTMLInputElement;if(!l)for(var r=0;r<o.length;r++)o[r]._setFlag(RowColFlags.Selected,!1,!0);var s=e.clone();switch(t){case n.None:s=new CellRange;break;case n.Cell:s=new CellRange(e.row,e.col);break;case n.ListBox:if(l)return;for(r=0;r<o.length;r++)o[r]._setFlag(RowColFlags.Selected,s.containsRow(r),!0)}this.select(s,!1,i)};_SelectionHandler.prototype._expandSelection=function(){var e=this._g,t=e.selectionMode;if(e.expandSelectionOnCopyPaste&&t){var i=this.selection,o=SelectionMode;switch(t){case o.Cell:case o.Row:break;case o.ListBox:this._expandSelectedRows();break;case o.RowRange:i=new CellRange(i.topRow,0,i.bottomRow,e.columns.length-1);default:var n=this._expandSelectionRange(i);n&&this.select(n,!1)}}};_SelectionHandler.prototype._deselectRange=function(e){var t=this.selection,i=this.extendedSelection;if(t.contains(e)){var o=i.length;this._sel=o?i[o-1]:new CellRange;o&&i.removeAt(o-1);return!0}for(var n=0;n<i.length;n++)if(i[n].contains(e)){i.removeAt(n);return!0}return!1};_SelectionHandler.prototype._expandSelectedRows=function(){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"ListBox mode expected");for(var e=this._g,t=e.selectedRows.map((function(e){return e.index})),i=[],o=0;o<t.length;o++)for(var n=new CellRange(t[o],0,t[o],e.columns.length-1),l=this._expandSelectionRange(n)||n,r=l.topRow;r<=l.bottomRow;r++)-1===i.indexOf(r)&&i.push(r);i.sort();this._selectRows(i)};_SelectionHandler.prototype._expandSelectionRange=function(e){var t=this._g,i=t.cells,o=t.getMergedRange(i,e.topRow,e.leftCol,!1),n=t.getMergedRange(i,e.bottomRow,e.leftCol,!1),l=t.getMergedRange(i,e.topRow,e.rightCol,!1),r=t.getMergedRange(i,e.bottomRow,e.rightCol,!1);if(o||n||l||r){o=o||new CellRange(e.topRow,e.leftCol);n=n||new CellRange(e.bottomRow,e.leftCol);l=l||new CellRange(e.topRow,e.rightCol);r=r||new CellRange(e.bottomRow,e.rightCol);return new CellRange(Math.min(o.topRow,n.topRow,l.topRow,r.topRow),Math.min(o.leftCol,n.leftCol,l.leftCol,r.leftCol),Math.max(o.bottomRow,n.bottomRow,l.bottomRow,r.bottomRow),Math.max(o.rightCol,n.rightCol,l.rightCol,r.rightCol))}return null};_SelectionHandler.prototype._selectRows=function(e){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"ListBox mode expected");for(var t=this._g,i=0,o=!0;i<t.rows.length;i++){var n=t.rows[i],l=e&&e.indexOf(n.index)>-1;if(l&&o){o=!1;this.select(i,this.selection.col)}n.isSelected=l}};_SelectionHandler.prototype._showSelection=function(){var e=this._g,t=this._sel;e.anchorCursor?e.scrollIntoView(t.row2,t.col2):e.scrollIntoView(t.row,t.col)};_SelectionHandler.prototype._adjustReferenceCell=function(e,t,i){var o=this._g,n=o.getMergedRange(o.cells,e.row,e.col);if(n&&!n.isSingleCell){var l=SelMove;switch(t){case l.Next:case l.NextCell:case l.NextEditableCell:e.row=n.bottomRow;break;case l.Prev:case l.PrevCell:case l.PrevEditableCell:e.row=n.topRow}switch(i){case l.Next:case l.NextCell:case l.NextEditableCell:e.col=n.rightCol;break;case l.Prev:case l.PrevCell:case l.PrevEditableCell:e.col=n.leftCol}}};return _SelectionHandler}();exports._SelectionHandler=_SelectionHandler;!function(e){e[e.Visible=1]="Visible";e[e.AllowResizing=2]="AllowResizing";e[e.AllowDragging=4]="AllowDragging";e[e.AllowMerging=8]="AllowMerging";e[e.AllowSorting=16]="AllowSorting";e[e.AutoGenerated=32]="AutoGenerated";e[e.Collapsed=64]="Collapsed";e[e.ParentCollapsed=128]="ParentCollapsed";e[e.Selected=256]="Selected";e[e.ReadOnly=512]="ReadOnly";e[e.HtmlContent=1024]="HtmlContent";e[e.WordWrap=2048]="WordWrap";e[e.MultiLine=4096]="MultiLine";e[e.HasTemplate=8192]="HasTemplate";e[e.RowDefault=3]="RowDefault";e[e.ColumnDefault=23]="ColumnDefault"}(RowColFlags=exports.RowColFlags||(exports.RowColFlags={}));var RowCol=function(){function RowCol(){this._type=null;this._align=null;this._inpType=null;this._mask=null;this._maxLen=null;this._required=null;this._fmt=null;this._map=null;this._ddCssClass=null;this._cssClass=null;this._cssClassAll=null;this._szMin=null;this._szMax=null;this._sz=null;this._pos=0;this._idx=-1;this._idxVis=-1;this._idxData=-1;this.gridChanged=new wijmo_1.Event}Object.defineProperty(RowCol.prototype,"binding",{get:function(){return this._binding?this._binding.path:null},set:function(e){if(e!=this.binding){var t=wijmo_1.asString(e);this._binding=t?new wijmo_1.Binding(t):null;if(!this._type&&this.grid&&this._binding){var i=this.grid.collectionView;if(i&&i.sourceCollection&&i.sourceCollection.length){var o=i.sourceCollection[0];this._type=wijmo_1.getType(this._binding.getValue(o))}}this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"sortMemberPath",{get:function(){return this._bindingSort?this._bindingSort.path:null},set:function(e){if(e!=this.sortMemberPath){var t=wijmo_1.asString(e);this._bindingSort=t?new wijmo_1.Binding(t):null;this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"dataType",{get:function(){return this._type},set:function(e){e=wijmo_1.asEnum(e,wijmo_1.DataType,!0);if(this._type!=e){this._type=e;this.grid&&this.grid.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"inputType",{get:function(){return this._inpType},set:function(e){this._inpType=wijmo_1.asString(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"mask",{get:function(){return this._mask},set:function(e){this._mask=wijmo_1.asString(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"maxLength",{get:function(){return this._maxLen},set:function(e){this._maxLen=wijmo_1.asNumber(e,!0,!0)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"align",{get:function(){return this._align},set:function(e){if(this._align!=e){this._align=e;this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"format",{get:function(){return this._fmt},set:function(e){if(this._fmt!=e){this._fmt=e;this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"dataMap",{get:function(){return this._map},set:function(e){if(this._map!=e){this._map&&this._map.mapChanged.removeHandler(this.onPropertyChanged,this);wijmo_1.isArray(e)&&(e=new DataMap(e,null,null));this._map=wijmo_1.asType(e,DataMap,!0);this._map&&this._map.mapChanged.addHandler(this.onPropertyChanged,this);this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"dataMapEditor",{get:function(){return null!=this._mapEditor?this._mapEditor:DataMapEditor.DropDownList},set:function(e){if(e!=this._mapEditor){this._mapEditor=wijmo_1.asEnum(e,DataMapEditor);this.grid&&this.grid.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"showDropDown",{get:function(){return this.dataMapEditor==DataMapEditor.DropDownList},set:function(e){wijmo_1._deprecated("showDropDown","dataMapEditor");this.dataMapEditor=e?DataMapEditor.DropDownList:DataMapEditor.AutoComplete},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"dropDownCssClass",{get:function(){return this._ddCssClass},set:function(e){this._ddCssClass=wijmo_1.asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"visible",{get:function(){return this._getFlag(RowColFlags.Visible)},set:function(e){this._setFlag(RowColFlags.Visible,e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"isVisible",{get:function(){return!!this._getFlag(RowColFlags.Visible)&&(!this._getFlag(RowColFlags.ParentCollapsed)||this instanceof _NewRowTemplate)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"pos",{get:function(){this._list&&this._list._dirty&&this._list._update();return this._pos},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"index",{get:function(){this._list&&this._list._dirty&&this._list._update();return this._idx},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"visibleIndex",{get:function(){this._list&&this._list._dirty&&this._list._update();return this.isVisible?this._idxVis:-1},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"size",{get:function(){return this._sz},set:function(e){if(e!=this._sz){this._sz=wijmo_1.asNumber(e,!0);this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"renderSize",{get:function(){var e=0,t=this._list;if(this.isVisible){(null==(e=this._sz)||e<0)&&(e=t?t.defaultSize:0);t&&null!=t.minSize&&e<t.minSize&&(e=t.minSize);t&&null!=t.maxSize&&e>t.maxSize&&(e=t.maxSize);null!=this._szMin&&e<this._szMin&&(e=this._szMin);null!=this._szMax&&e>this._szMax&&(e=this._szMax)}return e},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"allowResizing",{get:function(){return this._getFlag(RowColFlags.AllowResizing)},set:function(e){this._setFlag(RowColFlags.AllowResizing,e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"allowDragging",{get:function(){return this._getFlag(RowColFlags.AllowDragging)},set:function(e){this._setFlag(RowColFlags.AllowDragging,e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"allowMerging",{get:function(){return this._getFlag(RowColFlags.AllowMerging)},set:function(e){this._setFlag(RowColFlags.AllowMerging,e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"isSelected",{get:function(){return this._getFlag(RowColFlags.Selected)},set:function(e){if(!!e!=this.isSelected){var t=this.grid;if(t){var i=new CellRangeEventArgs(t?t.cells:null,t.selection);if(t.onSelectionChanging(i)&&this._setFlag(RowColFlags.Selected,e,!0)){t.refreshCells(!1,!0,!0);t.onSelectionChanged(i)}}else this._setFlag(RowColFlags.Selected,e)}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"isReadOnly",{get:function(){return this._getFlag(RowColFlags.ReadOnly)},set:function(e){this._setFlag(RowColFlags.ReadOnly,e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"isRequired",{get:function(){return this._required},set:function(e){this._required=wijmo_1.asBoolean(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"isContentHtml",{get:function(){return this._getFlag(RowColFlags.HtmlContent)},set:function(e){if(this.isContentHtml!=e){this._setFlag(RowColFlags.HtmlContent,e);this.grid&&this.grid.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"wordWrap",{get:function(){return this._getFlag(RowColFlags.WordWrap)},set:function(e){this._setFlag(RowColFlags.WordWrap,e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"multiLine",{get:function(){return this._getFlag(RowColFlags.MultiLine)},set:function(e){this._setFlag(RowColFlags.MultiLine,e)},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"cssClass",{get:function(){return this._cssClass},set:function(e){if(e!=this._cssClass){this._cssClass=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"cssClassAll",{get:function(){return this._cssClassAll},set:function(e){if(e!=this._cssClassAll){this._cssClassAll=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"grid",{get:function(){return this._list?this._list._g:null},enumerable:!0,configurable:!0});Object.defineProperty(RowCol.prototype,"collectionView",{get:function(){return this.grid?this.grid.collectionView:null},enumerable:!0,configurable:!0});RowCol.prototype.onPropertyChanged=function(){if(this._list){this._list._dirty=!0;this.grid.invalidate()}};RowCol.prototype.onGridChanged=function(e){this.gridChanged.raise(this,e)};RowCol.prototype._setList=function(e){if(e!=this._list){this._list=e;this.onGridChanged()}};RowCol.prototype._getFlag=function(e){return 0!=(this._f&e)};RowCol.prototype._setFlag=function(e,t,i){if(!!t!=this._getFlag(e)){this._f=t?this._f|e:this._f&~e;i||this.onPropertyChanged();return!0}return!1};return RowCol}();exports.RowCol=RowCol;var Column=function(e){__extends(Column,e);function Column(t){var i=e.call(this)||this;i._hdr=null;i._name=null;i._agg=null;i._quickSize=null;i._descById=null;i._tpl=null;i._f=RowColFlags.ColumnDefault;i._hash=Column._ctr.toString(36);Column._ctr++;wijmo_1.copy(i,t);i._uid=wijmo_1.uidGenerator();return i}Object.defineProperty(Column.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"width",{get:function(){return null!=this._szStar?this._szStar:this.size},set:function(e){if(null!=Column._parseStarSize(e)){this._szStar=e;this.onPropertyChanged()}else{this._szStar=null;this.size=wijmo_1.asNumber(e,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"minWidth",{get:function(){return this._szMin},set:function(e){if(e!=this._szMin){this._szMin=wijmo_1.asNumber(e,!0,!0);this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"maxWidth",{get:function(){return this._szMax},set:function(e){if(e!=this._szMax){this._szMax=wijmo_1.asNumber(e,!0,!0);this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"quickAutoSize",{get:function(){return this._quickSize},set:function(e){this._quickSize=wijmo_1.asBoolean(e,!0)},enumerable:!0,configurable:!0});Column.prototype._getQuickAutoSize=function(){return!!this.grid._getQuickAutoSize()&&(wijmo_1.isBoolean(this._quickSize)?this._quickSize:!(this.isContentHtml||this.wordWrap||this.multiLine||this._getFlag(RowColFlags.HasTemplate)))};Object.defineProperty(Column.prototype,"renderWidth",{get:function(){return this.renderSize},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"header",{get:function(){return this._hdr?this._hdr:this.binding},set:function(e){if(this._hdr!=e){this._hdr=e;this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"cellTemplate",{get:function(){return this._tpl},set:function(e){if(e!=this._tpl){wijmo_1.assert(null==e||wijmo_1.isString(e)||wijmo_1.isFunction(e),"cellTemplate should be a string or an ICellTemplateFunction.");this._tpl=e;this._setFlag(RowColFlags.HasTemplate,null!=e&&""!=e);this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"editor",{get:function(){var e=this._edt;return e?e.control:null},set:function(e){if(e!=this.editor){if(this._edt){this._edt.dispose();this._edt=null}if(null!=e){e=wijmo_1.asType(e,wijmo_1.Control);this._edt=new _CustomEditor(this,e)}}},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"allowSorting",{get:function(){return this._getFlag(RowColFlags.AllowSorting)},set:function(e){this._setFlag(RowColFlags.AllowSorting,e)},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"currentSort",{get:function(){var e=this.currentSortIndex;if(e>-1){return this.grid.collectionView.sortDescriptions[e].ascending?"+":"-"}return null},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"currentSortIndex",{get:function(){var e=this.grid?this.grid.collectionView:null,t=e?e.sortDescriptions:null,i=t&&t.length?this._getBindingSort():null;if(i)for(var o=0;o<t.length;o++)if(t[o].property==i)return o;return-1},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"aggregate",{get:function(){return null!=this._agg?this._agg:wijmo_1.Aggregate.None},set:function(e){if((e=wijmo_1.asEnum(e,wijmo_1.Aggregate))!=this._agg){this._agg=e;this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Column.prototype,"describedById",{get:function(){return this._descById},set:function(e){if(e!=this._descById){this._descById=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}},enumerable:!0,configurable:!0});Column.prototype.getIsRequired=function(e){return null!=this._required?this._required:e&&null!=e.isRequired?e.isRequired:this.dataType==wijmo_1.DataType.String?null!=this.dataMap||null!=this._mask&&this._mask.length>0:!e||e.dataType!=wijmo_1.DataType.String||(null!=e.dataMap||null!=e.mask&&e.mask.length>0)};Column.prototype.getAlignment=function(e){if(null!=this._align)return this._align;if(e&&null!=e.align)return e.align;if(!this._map)switch(this.dataType){case wijmo_1.DataType.Boolean:return"center";case wijmo_1.DataType.Number:return"right"}if(e&&!e.dataMap)switch(e.dataType){case wijmo_1.DataType.Boolean:return"center";case wijmo_1.DataType.Number:return"right"}return""};Column.prototype._getBindingSort=function(){return this.sortMemberPath?this.sortMemberPath:this.binding?this.binding:null};Column._parseStarSize=function(e){if(wijmo_1.isString(e)){var t=e.length;if(t>0&&"*"==e[t-1]){var i=1==t?1:parseFloat(e);if(i>0&&!isNaN(i))return i}}return null};Column._ctr=0;return Column}(RowCol);exports.Column=Column;var Row=function(e){__extends(Row,e);function Row(t){var i=e.call(this)||this;i.resizedManually=!1;i._f=RowColFlags.ColumnDefault;i._data=t||null;return i}Object.defineProperty(Row.prototype,"dataItem",{get:function(){return this._data},set:function(e){this._data=e},enumerable:!0,configurable:!0});Object.defineProperty(Row.prototype,"dataIndex",{get:function(){this._list&&this._list._dirty&&this._list._update();return this._idxData},enumerable:!0,configurable:!0});Object.defineProperty(Row.prototype,"height",{get:function(){return this.size},set:function(e){this.size=e},enumerable:!0,configurable:!0});Object.defineProperty(Row.prototype,"renderHeight",{get:function(){return this.renderSize},enumerable:!0,configurable:!0});return Row}(RowCol);exports.Row=Row;var GroupRow=function(e){__extends(GroupRow,e);function GroupRow(t){var i=e.call(this,t)||this;i._level=-1;i.level=t instanceof wijmo_1.CollectionViewGroup?t.level:-1;i.isReadOnly=!0;return i}Object.defineProperty(GroupRow.prototype,"level",{get:function(){return this._level},set:function(e){wijmo_1.asInt(e);if(e!=this._level){this._level=e;this.onPropertyChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupRow.prototype,"hasChildren",{get:function(){if(null!=this.grid&&null!=this._list){this._list._update();var e=this.index<this._list.length-1?this._list[this.index+1]:null,t=wijmo_1.tryCast(e,GroupRow),i=wijmo_1.tryCast(e,_NewRowTemplate);return null!=e&&null==i&&(null==t||t.level>this.level)}return!0},enumerable:!0,configurable:!0});Object.defineProperty(GroupRow.prototype,"isCollapsed",{get:function(){return this._getFlag(RowColFlags.Collapsed)},set:function(e){!!e!=this.isCollapsed&&null!=this._list&&this._setCollapsed(wijmo_1.asBoolean(e))},enumerable:!0,configurable:!0});GroupRow.prototype.getGroupHeader=function(){var e=this.grid,t=e.groupHeaderFormat||wijmo_1.culture.FlexGrid.groupHeaderFormat,i=this.dataItem;if(i instanceof wijmo_1.CollectionViewGroup&&t&&e.showGroups&&!e.childItemsPath){var o=i.groupDescription.propertyName,n=i.name,l=e.getColumn(o),r=this.isContentHtml;if(l){r=r||l.isContentHtml;l.header&&(o=l.header);var s=l.dataMap;s&&(n=s.getDisplayValue(n));l.dataType==wijmo_1.getType(n)&&(n=wijmo_1.Globalize.format(n,l.format))}else o=wijmo_1.toHeaderCase(o);var a=i.getAggregate(wijmo_1.Aggregate.CntAll,null,e.collectionView);return wijmo_1.format(t,{name:wijmo_1.escapeHtml(o),value:r?n:wijmo_1.escapeHtml(n),level:i.level,count:a})}return""};GroupRow.prototype._setCollapsed=function(e){var t=this,i=this.grid,o=i.rows,n=this.getCellRange(),l=new CellRangeEventArgs(i.cells,new CellRange(this.index,-1));if(i.onGroupCollapsedChanging(l)){i.deferUpdate((function(){o.deferUpdate((function(){t._setFlag(RowColFlags.Collapsed,e,!0);for(var i=n.topRow+1;i<=n.bottomRow&&i>-1&&i<o.length;i++){o[i]._setFlag(RowColFlags.ParentCollapsed,e,!0);var l=o[i];l instanceof GroupRow&&l.isCollapsed&&(i=l.getCellRange().bottomRow)}}))}));i.onGroupCollapsedChanged(l)}};GroupRow.prototype.getCellRange=function(){for(var e=this._list,t=this.index,i=e.length-1,o=t+1;o<=i;o++){var n=e[o];if(n instanceof GroupRow&&n.level<=this.level){i=o-1;break}}return new CellRange(t,0,i,this.grid.columns.length-1)};return GroupRow}(Row);exports.GroupRow=GroupRow;var RowColCollection=function(e){__extends(RowColCollection,e);function RowColCollection(t,i){var o=e.call(this)||this;o.frozenDetailChildren=0;o._frozen=0;o._lastFrozen=-1;o._firstVisible=-1;o._vlen=0;o._szDef=28;o._szTot=0;o._szCustom=!1;o._dirty=!1;o._g=wijmo_1.asType(t,FlexGrid);o._szDef=wijmo_1.asNumber(i,!1,!0);o._uid=wijmo_1.uidGenerator();return o}Object.defineProperty(RowColCollection.prototype,"grid",{get:function(){return this._g},enumerable:!0,configurable:!0});Object.defineProperty(RowColCollection.prototype,"defaultSize",{get:function(){return this._szDef},set:function(e){this._szCustom=!0;if(this._szDef!=e){this._szDef=wijmo_1.asNumber(e,!1,!0);this._dirty=!0;this._g.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RowColCollection.prototype,"frozen",{get:function(){return this._frozen},set:function(e){if(e!=this._frozen){this._frozen=wijmo_1.asNumber(e,!1,!0);this._dirty=!0;this._g.invalidate()}},enumerable:!0,configurable:!0});RowColCollection.prototype.isFrozen=function(e){return e<this.frozen};Object.defineProperty(RowColCollection.prototype,"minSize",{get:function(){return this._szMin},set:function(e){if(e!=this._szMin){this._szMin=wijmo_1.asNumber(e,!0,!0);this._dirty=!0;this._g.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RowColCollection.prototype,"maxSize",{get:function(){return this._szMax},set:function(e){if(e!=this._szMax){this._szMax=wijmo_1.asNumber(e,!0,!0);this._dirty=!0;this._g.invalidate()}},enumerable:!0,configurable:!0});RowColCollection.prototype.getTotalSize=function(){this._dirty&&this._update();return this._szTot};Object.defineProperty(RowColCollection.prototype,"visibleLength",{get:function(){this._dirty&&this._update();return this._vlen},enumerable:!0,configurable:!0});RowColCollection.prototype.getItemAt=function(e){this._dirty&&this._update();if(e<=0&&this.length>0&&this[0].renderSize)return 0;for(var t,i,o=this.length,n=0,l=o-1;n<=l;)if((i=this[t=n+l>>>1])._pos>=e&&t>0)l=t-1;else{if(!(i._pos+i.renderSize<=e&&t<o-1)){for(;t>0&&!this[t].renderSize;)t--;for(;t<o-1&&!this[t].renderSize;)t++;return t}n=t+1}return l};RowColCollection.prototype.getNextCell=function(e,t,i){void 0===i&&(i=0);var o,n=SelMove;switch(t){case n.Next:case n.NextCell:for(o=e+1;o<this.length;o++)if(this[o].renderSize>0)return o;break;case n.NextEditableCell:for(o=e+1;o<this.length;o++)if(this[o].renderSize>0&&!this[o].isReadOnly)return o;break;case n.Prev:case n.PrevCell:for(o=e-1;o>=0;o--)if(this[o].renderSize>0)return o;break;case n.PrevEditableCell:for(o=e-1;o>=0;o--)if(this[o].renderSize>0&&!this[o].isReadOnly)return o;break;case n.End:for(o=this.length-1;o>=0;o--)if(this[o].renderSize>0)return o;break;case n.Home:for(o=0;o<this.length;o++)if(this[o].renderSize>0)return o;break;case n.NextPage:return(o=this.getItemAt(this[e].pos+this[e].renderSize+i))<0?this.getNextCell(e,SelMove.End,i):o==e&&o<this.length-1&&this[o+1].renderSize?o+1:o;case n.PrevPage:return(o=this.getItemAt(this[e].pos-i))<0?this.getNextCell(e,SelMove.Home,i):o==e&&o>0&&this[o-1].renderSize?o-1:o}return e};RowColCollection.prototype.canMoveElement=function(e,t,i){void 0===i&&(i=!0);if(t==e)return!1;if(e<0||e>=this.length||t>=this.length)return!1;if(i){t<0&&(t=this.length-1);for(var o=Math.min(e,t),n=Math.max(e,t),l=o;l<=n;l++)if(!this[l].allowDragging)return!1}return!(this[t]instanceof _NewRowTemplate)};RowColCollection.prototype.moveElement=function(e,t,i){void 0===i&&(i=!0);if(this.canMoveElement(e,t,i)){var o=this[e];this.removeAt(e);t<0&&(t=this.length);this.insert(t,o);if(i){var n=this.frozen;e<n&&t>=n?this.frozen--:e>=n&&t<n&&this.frozen++}return!0}return!1};RowColCollection.prototype.onCollectionChanged=function(t){void 0===t&&(t=wijmo_1.NotifyCollectionChangedEventArgs.reset);this._dirty=!0;this._g.invalidate();e.prototype.onCollectionChanged.call(this,t)};RowColCollection.prototype.push=function(t){t._setList(this);return e.prototype.push.call(this,t)};RowColCollection.prototype.splice=function(t,i){for(var o=this,n=[],l=2;l<arguments.length;l++)n[l-2]=arguments[l];for(var r=t;r<t+i&&r<this.length;r++){var s=this[r];s instanceof RowCol&&s._setList(null)}n.forEach((function(e){return e._setList(o)}));return e.prototype.splice.apply(this,[t,i].concat(n))};RowColCollection.prototype.beginUpdate=function(){this._update();e.prototype.beginUpdate.call(this)};RowColCollection.prototype._setDefaultSize=function(e){if(!this._szCustom){this.defaultSize=e;this._szCustom=!1}};RowColCollection.prototype._update=function(){if(this._dirty&&!this.isUpdating){this._dirty=!1;this._lastFrozen=-1;this._firstVisible=-1;for(var e=0,t=0,i=void 0,o=void 0,n=0;n<this.length;n++){(o=this[n])._idx=n;o._idxVis=e;o._pos=t;o._setList(this);if((i=o.renderSize)>0){t+=i;e++;n<this._frozen&&(this._lastFrozen=n)}this._firstVisible<0&&o.visible&&(this._firstVisible=n)}this._vlen=e;this._szTot=t;return!0}return!1};return RowColCollection}(wijmo_1.ObservableArray);exports.RowColCollection=RowColCollection;var ColumnCollection=function(e){__extends(ColumnCollection,e);function ColumnCollection(){return null!==e&&e.apply(this,arguments)||this}ColumnCollection.prototype.getColumn=function(e){var t=wijmo_1.isNumber(e)?e:this.indexOf(e);return t>-1?this[t]:null};ColumnCollection.prototype.indexOf=function(t){if(t instanceof Column)return e.prototype.indexOf.call(this,t);for(var i=0;i<this.length;i++)if(this[i].name==t)return i;for(i=0;i<this.length;i++)if(this[i].binding==t)return i;return-1};Object.defineProperty(ColumnCollection.prototype,"describedById",{get:function(){return this._descById},set:function(e){if(e!=this._descById){this._descById=wijmo_1.asString(e);this._g&&this._g.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ColumnCollection.prototype,"firstVisibleIndex",{get:function(){this._dirty&&this._update();return this._firstVisible},enumerable:!0,configurable:!0});ColumnCollection.prototype._updateStarSizes=function(e){var t,i=!1,o=0;e-=.5;for(var n=0;n<this.length;n++){if((r=this[n]).isVisible)if(r._szStar){o+=Column._parseStarSize(r._szStar);t=r}else e-=r.renderWidth}if(t){var l=e;for(n=0;n<this.length;n++){var r;if((r=this[n]).isVisible&&r._szStar){var s=r._sz;r==t&&l>0?s=l:l-=s=Math.max(0,Math.round(Column._parseStarSize(r._szStar)/o*e));if(s!=r._sz){r._sz=s;i=!0}}}if(i){this._dirty=!0;this._update()}return i}return!1};return ColumnCollection}(RowColCollection);exports.ColumnCollection=ColumnCollection;var RowCollection=function(e){__extends(RowCollection,e);function RowCollection(){var t=null!==e&&e.apply(this,arguments)||this;t._maxLevel=-1;return t}Object.defineProperty(RowCollection.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(e!=this.ariaLabel){this._ariaLabel=wijmo_1.asString(e);this._g&&this._g.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(RowCollection.prototype,"maxGroupLevel",{get:function(){this._dirty&&this._update();return this._maxLevel},enumerable:!0,configurable:!0});RowCollection.prototype._update=function(){var t=this;if(e.prototype._update.call(this)){var i=this.grid?this.grid.collectionView:null,o=i?i.items:null,n=0;this._maxLevel=-1;this.forEach((function(e){e instanceof GroupRow&&e.level>t._maxLevel&&(t._maxLevel=e.level);var i=e.dataItem;i&&o?i===o[n]?e._idxData=n:i===o[n+1]?e._idxData=++n:i!==o[e._idxData]&&(e._idxData=-1):e._idxData=-1}));return!0}return!1};return RowCollection}(RowColCollection);exports.RowCollection=RowCollection;exports.colHdrAriaAttributes=function(e,t,i,o,n){void 0===n&&(n=!1);wijmo_1.setAttribute(e,"role",n?"rowheader":"columnheader");if(t.describedById||i.columns.describedById){var l=[t.describedById,i.columns.describedById].join(" ").trim();wijmo_1.setAttribute(e,"aria-describedby",l||null)}if(o.allowSorting){var r="none";switch(o._getBindingColumn(i,0,t).currentSort){case"+":r="ascending";break;case"-":r="descending"}wijmo_1.setAttribute(e,"aria-sort",r)}if(!o.isReadOnly){wijmo_1.setAttribute(e,"aria-readonly",t.isReadOnly);wijmo_1.setAttribute(e,"aria-required",t.isReadOnly?null:t.getIsRequired())}var s=e.closest(".wj-row");wijmo_1.setAttribute(s,"role","row")};var _ColumnGroupHandler=function(){function _ColumnGroupHandler(e){this._updatingCollection=0;this._initialized=!1;this._grid=e;this._initializeColumnGroups();this._initialized=!0}Object.defineProperty(_ColumnGroupHandler.prototype,"columnGroups",{get:function(){return this._colGroups},enumerable:!0,configurable:!0});_ColumnGroupHandler.prototype.createColumnGroups=function(e){this._initialized=!1;this._createColumnGroups(e);this._initialized=!0};_ColumnGroupHandler.prototype.hasColumnGroups=function(){return null!=this._colGroups&&this._colGroups.length>0};_ColumnGroupHandler.prototype.getGroupDefinitions=function(){return this._groupDefs};_ColumnGroupHandler.prototype.getColumnGroup=function(e,t){return this._getColumnGroup(e,t)};_ColumnGroupHandler.prototype.canMoveColumnGroup=function(e,t,i,o){if(e==i&&t==o)return!1;var n=this._grid,l=n.columnHeaders.rows,r=n.columns;if(e<0||e>=l.length||t<0||t>=r.length||i<0||i>=l.length||o<0||o>=r.length)return!1;var s=this._getColumnGroup(e,t),a=this._getColumnGroup(i,o);if(!s||!a||s==a)return!1;if(s.level<a.level&&s._containsGroup(a))return!1;var c=s.parentGroup,u=a.parentGroup;return!c||c===u||!c._isCollapseTo(s)};_ColumnGroupHandler.prototype.moveColumnGroup=function(e,t,i,o,n){if(this.canMoveColumnGroup(e,t,i,o)){var l=this._getColumnGroup(e,t),r=this._getColumnGroup(i,o);if(!l||!r||l==r)return!1;if(n&&!r.isEmpty)return!1;var s=this._getCollection(l),a=n?r.columns:this._getCollection(r);if(!s||!a)return!1;var c=n?0:a.indexOf(r);if(c<0)return!1;!n&&s!=a&&o>t&&c++;this._deferCollectionUpdate((function(){if(!s.remove(l))return!1;a.insert(c,l)}));return!0}return!1};_ColumnGroupHandler.prototype.handleCollectionChange=function(){if(this._initialized&&!this._updatingCollection){this._initialized=!1;this._buildColumnGroups();this._initialized=!0}};_ColumnGroupHandler.prototype.handlePropertyChange=function(e){if(e&&this._initialized){var t=this._grid,i=e._rng,o=e.header;if(o!=e._curr_header)for(var n=i.topRow;n<=i.bottomRow;n++)for(var l=i.leftCol;l<=i.rightCol;l++){t.columnHeaders.setCellData(n,l,o);e._curr_header=o}e.columns.length>0&&t.invalidate()}};_ColumnGroupHandler.prototype._initializeColumnGroups=function(){var e=this._grid,t=new ColumnGroupCollection;this._groupDefs=t;this._colGroups=t;this._colGroups._setOwner(e);this._colGroups._setChangeHandler(this)};_ColumnGroupHandler.prototype._createColumnGroups=function(e){this._grid;this._groupDefs=wijmo_1.asArray(e);this._colGroups&&this._colGroups._setOwner(null);this._colGroups=ColumnGroupCollection._parse(e);this._buildColumnGroups()};_ColumnGroupHandler.prototype._buildColumnGroups=function(){var e=this,t=this._grid;this._colGroups._removeChangeHandler();this._assertColumnGroups(this._colGroups);t.autoGenerateColumns=!1;t.columns.clear();this._colGroups._setOwner(t);this._colGroups.forEach((function(e){e._beginBuild()}));var i=0;this._colGroups.forEach((function(t){e._addColumnGroup(t);i=Math.max(i,t._getMaxLevel())}));this._colGroups.forEach((function(e){e._expandRange(i)}));var o=t.columnHeaders.rows;o.clear();for(var n=0;n<=i;n++){var l=new Row;o.splice(n,0,l);n<i&&(l.cssClassAll="wj-colgroup")}for(n=0;n<o.length;n++)for(var r=0;r<t.columns.length;r++){var s=this._getColumnGroup(n,r);if(s){var a=s.header||wijmo_1.toHeaderCase(s.binding);t.columnHeaders.setCellData(n,r,a);if(s.height){var c=t.columnHeaders.rows[n].height;t.columnHeaders.rows[n].height=c<=s.height?s.height:c}s._curr_header=s.header}}this._colGroups._setChangeHandler(this);this._colGroups.forEach((function(e){e._checkIfCollapsed()}))};_ColumnGroupHandler.prototype._getColumnGroup=function(e,t){var i=this._grid;if(e<i.columnHeaders.rows.length&&t<i.columns.length)for(var o=this._colGroups;o;){for(var n=o,l=0;l<o.length;l++){var r=o[l],s=r._rng;if(s.containsColumn(t)){if(s.containsRow(e)||0==r.columns.length)return r;o=r.columns;break}}if(o==n)break}return null};_ColumnGroupHandler.prototype._getCollection=function(e){var t=e.parentGroup;return t?t.columns:this._colGroups};_ColumnGroupHandler.prototype._assertColumnGroups=function(e){var t=this;wijmo_1.assert(e instanceof ColumnGroupCollection,"column groups contain items of invalid collection type");e.forEach((function(e){wijmo_1.assert(e instanceof ColumnGroup,"column groups contain items of invalid type");t._assertColumnGroups(e.columns)}))};_ColumnGroupHandler.prototype._addColumnGroup=function(e){var t=this,i=this._grid;e._rng.col=i.columns.length;0==e.columns.length?i.columns.push(e):e.columns.forEach((function(e){t._addColumnGroup(e)}));e._rng.col2=i.columns.length-1};_ColumnGroupHandler.prototype._beginCollectionUpdate=function(){this._updatingCollection++};_ColumnGroupHandler.prototype._endCollectionUpdate=function(){this._updatingCollection--;this._updatingCollection<=0&&this.handleCollectionChange()};_ColumnGroupHandler.prototype._deferCollectionUpdate=function(e){try{this._beginCollectionUpdate();e()}finally{this._endCollectionUpdate()}};return _ColumnGroupHandler}();exports._ColumnGroupHandler=_ColumnGroupHandler;var ColumnGroup=function(e){__extends(ColumnGroup,e);function ColumnGroup(t,i){var o=e.call(this)||this;o._rng=new CellRange(0,-1);o._lvl=0;o._collapsed=!1;o._cols=new ColumnGroupCollection;wijmo_1.copy(o,t);var n=i&&i.columns;n&&n.indexOf(o)<0&&n.push(o);return o}ColumnGroup.prototype._copy=function(e,t){if("columns"==e){var i=wijmo_1.asArray(t);this._cols=ColumnGroupCollection._parse(i);return!0}return!1};Object.defineProperty(ColumnGroup.prototype,"columns",{get:function(){return this._cols},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"columnGroups",{get:function(){return this._cols},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"height",{get:function(){return this._cgHeight},set:function(e){this._cgHeight=e},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"isEmpty",{get:function(){return 0===this._cols.length},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"parentGroup",{get:function(){var e=this._ownerList,t=e&&e.owner;return t instanceof ColumnGroup?t:null},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"level",{get:function(){for(var e=this,t=0;e.parentGroup;){e=e.parentGroup;t++}return t},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"collapseTo",{get:function(){return this._collTo},set:function(e){wijmo_1.assert(wijmo_1.isArray(e)||wijmo_1.isString(e),"collapseTo should be an array or a string.");if(this._collTo!=e){this._collTo=e;this._updateCollapsedState()}},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"isCollapsed",{get:function(){return this._collapsed},set:function(e){var t=this.grid,i=null;if(e!=this._collapsed)if(t){i=new CellRangeEventArgs(t.columnHeaders,this._rng,this);t.onColumnGroupCollapsedChanging(i)?this._collapsed=wijmo_1.asBoolean(e):i=null}else this._collapsed=wijmo_1.asBoolean(e);this._updateCollapsedState();t&&i&&t.onColumnGroupCollapsedChanged(i)},enumerable:!0,configurable:!0});Object.defineProperty(ColumnGroup.prototype,"grid",{get:function(){var e=this._ownerList,t=e&&e.owner;return t instanceof ColumnGroup?t.grid:t instanceof FlexGrid?t:null},enumerable:!0,configurable:!0});ColumnGroup.prototype._beginBuild=function(){var e=this;this._lvl=0;for(var t=this.parentGroup;t;t=t.parentGroup)this._lvl++;setTimeout((function(){if(e.parentGroup&&0!==e._lvl&&e.parentGroup.width&&(null===e.width||void 0===e.width)){var t=0,i=0;e.parentGroup._cols.forEach((function(e){t+=e.width;null!==e.width&&void 0!==e.width||i++}));e.width=(e.parentGroup.width-t)/i}}),0);this._rng=new CellRange(0,-1);this._rng.row=this._rng.row2=this._lvl;this._cols.forEach((function(e){e._beginBuild()}))};ColumnGroup.prototype._setChangeHandler=function(e){this._changeHdl=e;this._cols._setChangeHandler(e)};ColumnGroup.prototype._removeChangeHandler=function(){this._changeHdl=null;this._cols._removeChangeHandler()};ColumnGroup.prototype._setOwnerList=function(e){e!=this._ownerList&&(this._ownerList=e)};ColumnGroup.prototype._checkIfCollapsed=function(){var e=this.grid;(e?e.columns:null)&&(this._collapsed?this._updateCollapsedState():this._cols.forEach((function(e){e._checkIfCollapsed()})))};ColumnGroup.prototype._updateCollapsedState=function(){var e=this.grid,t=e?e.columns:null,i=this._rng,o=this._collapsed;if(t){this._cols.forEach((function(e){if(e instanceof ColumnGroup){e._collapsed=o;e._updateCollapsedState()}}));for(var n=this._getCollapseToIndices(),l=i.leftCol;l<=i.rightCol;l++){var r=!o||n.indexOf(l)>-1;t[l]._setFlag(RowColFlags.ParentCollapsed,!r)}}};ColumnGroup.prototype._getMaxLevel=function(){var e=this._lvl;this.columns.forEach((function(t){e=Math.max(e,t._getMaxLevel())}));return e};ColumnGroup.prototype._expandRange=function(e){var t=e-this._getMaxLevel();if(t>0){this._rng.row2+=t;this._cols.forEach((function(e){e._shiftRange(t)}))}for(var i=this.grid.columns,o=this._rng,n=o.col;n<=o.col2;n++){i[n]._rng.row2=e}};ColumnGroup.prototype._shiftRange=function(e){this._rng.row+=e;this._rng.row2+=e;this._cols.forEach((function(t){t._shiftRange(e)}))};ColumnGroup.prototype._containsGroup=function(e){for(var t=0;t<this._cols.length;t++){var i=this._cols[t];if(i==e||i._containsGroup(e))return!0}return!1};ColumnGroup.prototype._isCollapseTo=function(e){var t=this.grid,i=t?t.columns:null;if(!e||!i)return!1;var o=this._getCollapseToBindings();if(o&&o.length)for(var n=0;n<o.length;n++)switch(o[n]){case"$first":case"$last":continue;default:if(e===i.getColumn(o[n]))return!0}return!1};ColumnGroup.prototype._getCollapseToBindings=function(){var e=this.collapseTo;return wijmo_1.isString(e)?[e]:e};ColumnGroup.prototype._getCollapseToIndices=function(){var e=this.grid,t=this._rng,i=this._getCollapseToBindings();if(i&&i.length){for(var o=[],n=e.columns,l=0;l<i.length;l++)switch(i[l]){case"$first":o.push(t.leftCol);break;case"$last":o.push(t.rightCol);break;default:var r=n.getColumn(i[l]),s=n.indexOf(r);r&&t.containsColumn(s)&&o.push(s)}if(o.length)return o}return[t.rightCol]};ColumnGroup.prototype.onPropertyChanged=function(){var t=this._changeHdl;t&&t.handlePropertyChange(this);e.prototype.onPropertyChanged.call(this)};return ColumnGroup}(Column);exports.ColumnGroup=ColumnGroup;var AllowSorting,AllowPinning,HeadersVisibility,ClipStringOptions,HeadersFocusability,FrozenRowCol,ColumnGroupCollection=function(e){__extends(ColumnGroupCollection,e);function ColumnGroupCollection(){return null!==e&&e.apply(this,arguments)||this}ColumnGroupCollection.prototype.getColumn=function(e){return wijmo_1.isNumber(e)?this._getColByIdx(e):this._findColByProp("name",e)||this._findColByProp("binding",e)};Object.defineProperty(ColumnGroupCollection.prototype,"owner",{get:function(){return this._owner},enumerable:!0,configurable:!0});ColumnGroupCollection.prototype.push=function(t){t._setOwnerList(this);return e.prototype.push.call(this,t)};ColumnGroupCollection.prototype.splice=function(t,i){for(var o=this,n=[],l=2;l<arguments.length;l++)n[l-2]=arguments[l];for(var r=t;r<t+i&&r<this.length;r++){var s=this[r];s instanceof ColumnGroup&&s._setOwnerList(null)}n.forEach((function(e){return e._setOwnerList(o)}));return e.prototype.splice.apply(this,[t,i].concat(n))};ColumnGroupCollection._parse=function(e){var t=null;if(e)if(e instanceof ColumnGroupCollection)t=e;else{t=new ColumnGroupCollection;e.forEach((function(e){var i=e instanceof ColumnGroup?e:new ColumnGroup(e);t.indexOf(i)<0&&t.push(i)}))}else t=new ColumnGroupCollection;return t};ColumnGroupCollection.prototype._setChangeHandler=function(e){this._changeHdl=e;this.forEach((function(t){return t._setChangeHandler(e)}))};ColumnGroupCollection.prototype._removeChangeHandler=function(){this._changeHdl=null;this.forEach((function(e){return e._removeChangeHandler()}))};ColumnGroupCollection.prototype._setOwner=function(e){this._owner=e;this.forEach((function(e){return e.columns._setOwner(e)}))};ColumnGroupCollection.prototype._getColByIdx=function(e){return e>-1&&e<this.length?this[e]:null};ColumnGroupCollection.prototype._findColByProp=function(e,t){for(var i=0;i<this.length;i++){var o=this[i];if(o[e]===t)return o;if(null!==(o=o.columns._findColByProp(e,t)))return o}return null};ColumnGroupCollection.prototype.onCollectionChanged=function(t){void 0===t&&(t=wijmo_1.NotifyCollectionChangedEventArgs.reset);var i=this._changeHdl;i&&i.handleCollectionChange();e.prototype.onCollectionChanged.call(this,t)};return ColumnGroupCollection}(wijmo_1.ObservableArray);exports.ColumnGroupCollection=ColumnGroupCollection;wijmo_1._addCultureInfo("FlexGrid",{groupHeaderFormat:"{name}: <b>{value}</b> ({count:n0} items)",ariaLabels:{toggleDropDown:"Toggle Dropdown",toggleGroup:"Toggle Group"}});!function(e){e[e.None=0]="None";e[e.SingleColumn=1]="SingleColumn";e[e.MultiColumn=2]="MultiColumn"}(AllowSorting=exports.AllowSorting||(exports.AllowSorting={}));!function(e){e[e.None=0]="None";e[e.SingleColumn=1]="SingleColumn";e[e.ColumnRange=2]="ColumnRange";e[e.Both=3]="Both"}(AllowPinning=exports.AllowPinning||(exports.AllowPinning={}));!function(e){e[e.None=0]="None";e[e.Column=1]="Column";e[e.Row=2]="Row";e[e.All=3]="All"}(HeadersVisibility=exports.HeadersVisibility||(exports.HeadersVisibility={}));!function(e){e[e.Default=0]="Default";e[e.CSV=1]="CSV";e[e.QuoteAll=2]="QuoteAll";e[e.SkipMerged=4]="SkipMerged";e[e.Unformatted=8]="Unformatted";e[e.InvisibleRows=16]="InvisibleRows";e[e.InvisibleColumns=32]="InvisibleColumns";e[e.InvisibleCells=48]="InvisibleCells"}(ClipStringOptions=exports.ClipStringOptions||(exports.ClipStringOptions={}));!function(e){e[e.None=0]="None";e[e.Column=1]="Column";e[e.Row=2]="Row";e[e.All=3]="All"}(HeadersFocusability=exports.HeadersFocusability||(exports.HeadersFocusability={}));!function(e){e[e.Column=0]="Column";e[e.Row=1]="Row"}(FrozenRowCol=exports.FrozenRowCol||(exports.FrozenRowCol={}));var FlexGrid=function(e){__extends(FlexGrid,e);function FlexGrid(t,i){var o=e.call(this,t,null,!0)||this;o._activeCell=null;o._activePanelType=CellType.Cell;o._szClient=new wijmo_1.Size(0,0);o._szClientSB=new wijmo_1.Size(0,0);o._offsetY=0;o._cssPage=0;o._ptScrl=new wijmo_1.Point(0,0);o._cellPadLeft=3;o._cellPadHorz=3;o._cellPadVert=0;o._clipToScreen=!1;o._anchorCell=null;o._autoGenCols=!0;o._autoClipboard=!0;o._xOnCopyPaste=!0;o._autoScroll=!0;o._autoSearch=!1;o._caseSensitive=!1;o._readOnly=!1;o._indent=14;o._autoSizeMode=AutoSizeMode.Both;o._autoHeights=!1;o._quickSize=null;o._hdrVis=HeadersVisibility.All;o._hdrFoc=HeadersFocusability.None;o._alSorting=AllowSorting.SingleColumn;o._alPinning=AllowPinning.None;o._alAddNew=!1;o._alDelete=!1;o._alResizing=AllowResizing.Columns;o._alDragging=AllowDragging.Columns;o._alMerging=AllowMerging.None;o._ssHdr=HeadersVisibility.None;o._shSort=!0;o._shGroups=!0;o._shMarquee=!1;o._shPlcHld=!1;o._altStep=1;o._shErr=!0;o._shDropDown=!0;o._valEdt=!0;o._gHdrFmt=null;o._childItemsPath=null;o._sortRowIndex=null;o._editColIndex=null;o._deferResizing=!1;o._pSel=!0;o._pOutline=!0;o._stickyHdr=!1;o._anchorCursor=!1;o._copyHeaders=HeadersVisibility.None;o._bigChecks=!1;o._skipMerged=!1;o._commitEmptyEdits=!0;o._fzClone=null;o._vt=0;o._vtRows=0;o._vtCols=0;o._lazyRender=!0;o._refreshOnEdit=!0;o._reorderCells=!0;o._isISChanging=!1;o._isScrollingByWheel=!1;o._touchEdit=!1;o.itemsSourceChanging=new wijmo_1.Event;o.itemsSourceChanged=new wijmo_1.Event;o.scrollPositionChanged=new wijmo_1.Event;o.selectionChanging=new wijmo_1.Event;o.selectionChanged=new wijmo_1.Event;o.loadingRows=new wijmo_1.Event;o.loadedRows=new wijmo_1.Event;o.updatingLayout=new wijmo_1.Event;o.updatedLayout=new wijmo_1.Event;o.resizingColumn=new wijmo_1.Event;o.resizedColumn=new wijmo_1.Event;o.autoSizingColumn=new wijmo_1.Event;o.autoSizedColumn=new wijmo_1.Event;o.starSizedColumns=new wijmo_1.Event;o.draggingColumn=new wijmo_1.Event;o.draggingColumnOver=new wijmo_1.Event;o.draggedColumn=new wijmo_1.Event;o.pinningColumn=new wijmo_1.Event;o.pinnedColumn=new wijmo_1.Event;o.resizingRow=new wijmo_1.Event;o.resizedRow=new wijmo_1.Event;o.autoSizingRow=new wijmo_1.Event;o.autoSizedRow=new wijmo_1.Event;o.draggingRow=new wijmo_1.Event;o.draggingRowOver=new wijmo_1.Event;o.draggedRow=new wijmo_1.Event;o.groupCollapsedChanging=new wijmo_1.Event;o.groupCollapsedChanged=new wijmo_1.Event;o.columnGroupCollapsedChanging=new wijmo_1.Event;o.columnGroupCollapsedChanged=new wijmo_1.Event;o.sortingColumn=new wijmo_1.Event;o.sortedColumn=new wijmo_1.Event;o.beginningEdit=new wijmo_1.Event;o.prepareCellForEdit=new wijmo_1.Event;o.cellEditEnding=new wijmo_1.Event;o.cellEditEnded=new wijmo_1.Event;o.rowEditStarting=new wijmo_1.Event;o.rowEditStarted=new wijmo_1.Event;o.rowEditEnding=new wijmo_1.Event;o.rowEditEnded=new wijmo_1.Event;o.rowAdded=new wijmo_1.Event;o.deletingRow=new wijmo_1.Event;o.deletedRow=new wijmo_1.Event;o.copying=new wijmo_1.Event;o.copied=new wijmo_1.Event;o.pasting=new wijmo_1.Event;o.pasted=new wijmo_1.Event;o.pastingCell=new wijmo_1.Event;o.pastedCell=new wijmo_1.Event;o.formatItem=new wijmo_1.Event((function(){o._clearCells()}));o.updatingView=new wijmo_1.Event;o.updatedView=new wijmo_1.Event;o._mappedColumns=null;var n=o.hostElement;wijmo_1.isIE()&&(n.style.borderRadius="0");var l=o.getTemplate();o.applyTemplate("wj-control wj-content wj-flexgrid",l,{_root:"root",_eSz:"sz",_eCt:"cells",_fCt:"fcells",_eTL:"tl",_eBL:"bl",_eCHdr:"ch",_eRHdr:"rh",_eCFtr:"cf",_eTLCt:"tlcells",_eBLCt:"blcells",_eCHdrCt:"chcells",_eCFtrCt:"cfcells",_eRHdrCt:"rhcells",_eMarquee:"marquee",_eFocus:"focus"});wijmo_1.setCss(o._root.parentElement,{position:"relative",left:"0",top:"0",width:"100%",height:"100%",overflow:"hidden",minWidth:"inherit",minHeight:"inherit",maxWidth:"inherit",maxHeight:"inherit"});wijmo_1.setCss(o._root,{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",minWidth:"inherit",minHeight:"inherit",maxWidth:"inherit",maxHeight:"inherit",overflow:"auto",webkitOverflowScrolling:"touch"});wijmo_1.setCss(o._eCt,{position:"absolute"});wijmo_1.setCss(o._eMarquee,{display:"none"});wijmo_1.setCss(o._eMarquee.firstChild,{width:"100%",height:"100%"});wijmo_1.setCss(o._fCt,{position:"absolute",top:0,left:0,overflow:"hidden",pointerEvents:"none"});wijmo_1.setCss(o._eFocus,{position:"fixed",left:"-32000px"});wijmo_1.setCss(o._eSz,{position:"relative",visibility:"hidden"});[o._eRHdr,o._eCFtr,o._eCHdr,o._eBL,o._eTL].forEach((function(e){wijmo_1.setAttribute(e,"aria-hidden",!0);wijmo_1.setCss(e,{position:"absolute",overflow:"hidden",outline:"none"});wijmo_1.setCss(e.firstElementChild,{position:"relative"})}));[o._eFocus,o._eMarquee,o._fCt,o._eSz].forEach((function(e){wijmo_1.setAttribute(e,"aria-hidden",!0)}));if(wijmo_1.isIE9()||wijmo_1.isIE10()){var r=o._eMarquee;["click","dblclick","mousedown","mouseup"].forEach((function(e){o.addEventListener(r,e,(function(t){var i=r.style.display;r.style.display="none";var o=document.elementFromPoint(t.clientX,t.clientY);r.style.display=i;var n=document.createEvent("Event");n.initEvent(e,!0,!0);for(var l in t)try{n[l]=t[l]}catch(e){}o.dispatchEvent(n)}))}))}n.tabIndex=-1;o._uid=wijmo_1.uidGenerator();o.deferUpdate((function(){var e=o._getDefaultRowHeight();o._rows=new RowCollection(o,e);o._cols=new ColumnCollection(o,4*e);o._hdrRows=new RowCollection(o,e);o._hdrCols=new ColumnCollection(o,Math.round(1.25*e));o._ftrRows=new RowCollection(o,e);var t=CellType;o._gpTL=new GridPanel(o,t.TopLeft,o._hdrRows,o._hdrCols,o._eTLCt);o._gpCHdr=new GridPanel(o,t.ColumnHeader,o._hdrRows,o._cols,o._eCHdrCt);o._gpRHdr=new GridPanel(o,t.RowHeader,o._rows,o._hdrCols,o._eRHdrCt);o._gpCells=new GridPanel(o,t.Cell,o._rows,o._cols,o._eCt);o._gpBL=new GridPanel(o,t.BottomLeft,o._ftrRows,o._hdrCols,o._eBLCt);o._gpCFtr=new GridPanel(o,t.ColumnFooter,o._ftrRows,o._cols,o._eCFtrCt);o.activePanel=o._gpCells;o._hdrRows.push(new Row);o._hdrCols.push(new Column({align:"center"}));o._cf=new CellFactory;o._keyHdl=new _KeyboardHandler(o);o._mouseHdl=new _MouseHandler(o);o._edtHdl=new _EditHandler(o);o._selHdl=o._createSelHdl();o._addHdl=new _AddNewHandler(o);o._grpHdl=new _ColumnGroupHandler(o);o._mrgMgr=new MergeManager;o._bndSortConverter=o._sortConverter.bind(o);o._errorTip=new wijmo_1.Tooltip({isContentHtml:!1,showDelay:0,cssClass:"wj-error-tip"});o.selectionMode=SelectionMode.CellRange;o._root.tabIndex=-1;o.initialize(i)}));o.addEventListener(o._root,"scroll",(function(e){if(o._updateScrollPosition()||o._forceScrollUpdate){var t=o.activeEditor,i=o.activeCell,n=i?i.className:null;if((wijmo_1.hasClass(i,"wj-detail")||wijmo_1.hasClass(t,"wj-numeric"))&&wijmo_1.Control.sharedState.InvalidScroll){setTimeout((function(){wijmo_1.Control.sharedState.InvalidScroll=!1}),0);return}o._forceScrollUpdate||wijmo_1.Control.sharedState.InvalidScroll||o.finishEditing();o._forceScrollUpdate=!1;if("React"===o.workingAs)requestAnimationFrame((function(){o._updateContent(!0);setTimeout((function(){wijmo_1.Control.sharedState.InvalidScroll=!1}),0)}));else{o._updateContent(!0);setTimeout((function(){wijmo_1.Control.sharedState.InvalidScroll=!1}),0)}var l=o.activeEditor,r=o.activeCell;if(l&&r&&t&&n){l.value=t.value;r.className=n;o._setFocusNoScroll(l)}else l&&!r&&(wijmo_1.Control.sharedState.InvalidScroll||o.finishEditing(!0));o.columns.frozen&&setTimeout((function(){var e=o.columnHeaders.hostElement.style,t=parseInt(e.left),i=o._ptScrl.x;Math.abs(t-i)>1&&o.invalidate()}));setTimeout((function(){o._isScrollingByWheel=!1;wijmo_1.Control.sharedState.InvalidScroll=!1}),0)}}));o.addEventListener(n,"focus",(function(e){if(n.tabIndex>-1){var t=e.target;t instanceof HTMLElement&&t.tabIndex<0&&o._setFocus(!0)}}),!0);return o}Object.defineProperty(FlexGrid.prototype,"activePanel",{get:function(){return this._activePanel},set:function(e){this._activePanel=e},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"activePanelType",{get:function(){return this._activePanelType},set:function(e){if(this._activePanelType!==e){Array.from(this.hostElement.getElementsByClassName("wj-focus-header-cell")).forEach((function(e){e.classList.remove("wj-focus-header-cell");e.setAttribute("tabindex","-1")}));this._activePanelType=e;e!==CellType.Cell?e!==CellType.ColumnHeader?e!==CellType.RowHeader?e!==CellType.TopLeft||(this.activePanel=this._gpTL):this.activePanel=this._gpRHdr:this.activePanel=this._gpCHdr:this.activePanel=this._gpCells}},enumerable:!0,configurable:!0});FlexGrid.prototype._handleResize=function(){var t=this;this._rcBounds=null;this.activeEditor&&this.isTouching||this._touchEdit?setTimeout((function(){if(!t.activeEditor){t._touchEdit=!0;t.startEditing(!0)}}),50):e.prototype._handleResize.call(this);this._touchEdit=!1};Object.defineProperty(FlexGrid.prototype,"headersVisibility",{get:function(){return this._hdrVis},set:function(e){if((e=wijmo_1.asEnum(e,HeadersVisibility))!=this._hdrVis){this._hdrVis=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"headersFocusability",{get:function(){return this._hdrFoc},set:function(e){if((e=wijmo_1.asEnum(e,HeadersFocusability))!=this._hdrFoc){this._hdrFoc=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"stickyHeaders",{get:function(){return this._stickyHdr},set:function(e){if(e!=this._stickyHdr){this._stickyHdr=wijmo_1.asBoolean(e);this._updateStickyHeaders();this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"preserveSelectedState",{get:function(){return this._pSel},set:function(e){this._pSel=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"preserveOutlineState",{get:function(){return this._pOutline},set:function(e){this._pOutline=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"anchorCursor",{get:function(){return this._anchorCursor},set:function(e){this._anchorCursor=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"copyHeaders",{get:function(){return this._copyHeaders},set:function(e){this._copyHeaders=wijmo_1.asEnum(e,HeadersVisibility)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"lazyRender",{get:function(){return this._lazyRender},set:function(e){this._lazyRender=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"refreshOnEdit",{get:function(){return this._refreshOnEdit},set:function(e){this._refreshOnEdit=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"virtualizationThreshold",{get:function(){return this._vt},set:function(e){this._vt=e;if(wijmo_1.isNumber(e))this._vtRows=this._vtCols=wijmo_1.asNumber(e);else if(e)if(wijmo_1.isArray(e)&&2==e.length){this._vtRows=wijmo_1.asNumber(e[0]);this._vtCols=wijmo_1.asNumber(e[1])}else wijmo_1.assert(!1,"virtualizationThreshold should be a number or an array with two numbers.");else this._vtRows=this._vtCols=0},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"autoGenerateColumns",{get:function(){return this._autoGenCols},set:function(e){this._autoGenCols=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"autoClipboard",{get:function(){return this._autoClipboard},set:function(e){this._autoClipboard=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"expandSelectionOnCopyPaste",{get:function(){return this._xOnCopyPaste},set:function(e){this._xOnCopyPaste=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"autoScroll",{get:function(){return this._autoScroll},set:function(e){this._autoScroll=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"autoSearch",{get:function(){return this._autoSearch},set:function(e){this._autoSearch=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"caseSensitiveSearch",{get:function(){return this._caseSensitive},set:function(e){this._caseSensitive=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"columnLayout",{get:function(){var e,t=this._hasColumnGroups(),i=t?ColumnGroup:Column,o=t?"columnGroups":"columns",n=FlexGrid._getSerializableProperties(i),l=t?["collapseTo"]:[],r=["size"],s=new i,a=t?this.getColumnGroups():this.columns,serializeColumns=function(e){var i=[];e.forEach((function(e){var o={};n.forEach((function(t){var i=e[t];(function(e,t){return t!=s[e]&&r.indexOf(e)<0&&(wijmo_1.isPrimitive(t)||l.indexOf(e)>-1)})(t,i)&&(o[t]=i)}));if(t){var a=e.columns;a.length&&(o.columns=serializeColumns(a))}i.push(o)}));return i},c=serializeColumns(a);return JSON.stringify(((e={})[o]=c,e))},set:function(e){var t=this,i=JSON.parse(wijmo_1.asString(e));wijmo_1.assert(i,"Invalid columnLayout data.");this.columns.deferUpdate((function(){t.columns.clear();t._hasColumnGroups()&&(t.columnGroups=new ColumnGroupCollection);t.initialize(i)}))},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"columnGroups",{get:function(){return this._grpHdl.getGroupDefinitions()},set:function(e){this.columns.clear();this._grpHdl.createColumnGroups(wijmo_1.asArray(e))},enumerable:!0,configurable:!0});FlexGrid.prototype.getColumnGroups=function(){return this._grpHdl.columnGroups};Object.defineProperty(FlexGrid.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){if(e!=this._readOnly){this._readOnly=wijmo_1.asBoolean(e);this.finishEditing();this.invalidate(!0);this._addHdl.updateNewRowTemplate();wijmo_1.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly);this._setAria("readonly",this.isReadOnly?"true":null)}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"bigCheckboxes",{get:function(){return this._bigChecks},set:function(e){this._bigChecks=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"skipMerged",{get:function(){return this._skipMerged},set:function(e){this._skipMerged=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"isDisabled",{get:function(){return this._e&&null!=this._e.getAttribute("disabled")},set:function(e){if((e=wijmo_1.asBoolean(e,!0))!=this.isDisabled){var t=this._e;if(t){wijmo_1.enable(t,!e);this._updateTabIndex();this.invalidate()}}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"imeEnabled",{get:function(){return null!=this._imeHdl},set:function(e){if(wijmo_1.asBoolean(e)!=this.imeEnabled&&this.finishEditing()){var t=this.containsFocus();if(this._imeHdl){this._imeHdl.dispose();this._imeHdl=null}e&&(this._imeHdl=new _ImeHandler(this));t&&this.focus()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"allowResizing",{get:function(){return this._alResizing},set:function(e){this._alResizing=wijmo_1.asEnum(e,AllowResizing)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"deferResizing",{get:function(){return this._deferResizing},set:function(e){this._deferResizing=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"autoSizeMode",{get:function(){return this._autoSizeMode},set:function(e){this._autoSizeMode=wijmo_1.asEnum(e,AutoSizeMode)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"autoRowHeights",{get:function(){return this._autoHeights},set:function(e){this._autoHeights=wijmo_1.asBoolean(e);this._autoRowHeights()},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"quickAutoSize",{get:function(){return this._quickSize},set:function(e){this._quickSize=wijmo_1.asBoolean(e,!0)},enumerable:!0,configurable:!0});FlexGrid.prototype._getQuickAutoSize=function(){return wijmo_1.isBoolean(this._quickSize)?this._quickSize:!this.formatItem.hasHandlers&&null==this.itemFormatter};Object.defineProperty(FlexGrid.prototype,"allowSorting",{get:function(){return this._alSorting},set:function(e){wijmo_1.isBoolean(e)&&(e=e?AllowSorting.SingleColumn:AllowSorting.None);this._alSorting=wijmo_1.asEnum(e,AllowSorting)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"allowPinning",{get:function(){return this._alPinning},set:function(e){if(e!=this._alPinning){wijmo_1.isBoolean(e)&&(e=e?AllowPinning.SingleColumn:AllowPinning.None);this._alPinning=wijmo_1.asEnum(e,AllowPinning);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"allowAddNew",{get:function(){return this._alAddNew},set:function(e){if(e!=this._alAddNew){this._alAddNew=wijmo_1.asBoolean(e);this._addHdl.updateNewRowTemplate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"newRowAtTop",{get:function(){return this._addHdl.newRowAtTop},set:function(e){this._addHdl.newRowAtTop=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"allowDelete",{get:function(){return this._alDelete},set:function(e){e!=this._alDelete&&(this._alDelete=wijmo_1.asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"allowMerging",{get:function(){return this._alMerging},set:function(e){if((e=wijmo_1.asEnum(e,AllowMerging))!=this._alMerging){this._alMerging=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showSelectedHeaders",{get:function(){return this._ssHdr},set:function(e){if((e=wijmo_1.asEnum(e,HeadersVisibility))!=this._ssHdr){this._ssHdr=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showMarquee",{get:function(){return this._shMarquee},set:function(e){if(e!=this._shMarquee){this._shMarquee=wijmo_1.asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showPlaceholders",{get:function(){return this._shPlcHld},set:function(e){this._shPlcHld=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showSort",{get:function(){return this._shSort},set:function(e){if(e!=this._shSort){this._shSort=wijmo_1.asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showGroups",{get:function(){return this._shGroups},set:function(e){if(e!=this._shGroups){this._shGroups=wijmo_1.asBoolean(e);this._bindGrid(!1)}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"alternatingRowStep",{get:function(){return this._altStep},set:function(e){if(e!=this._altStep){this._altStep=wijmo_1.asInt(e,!1,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showAlternatingRows",{get:function(){return this._altStep>0},set:function(e){wijmo_1._deprecated("showAlternatingRows","alternatingRowStep");this.alternatingRowStep=e?1:0},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showErrors",{get:function(){return this._shErr},set:function(e){if(e!=this._shErr){this._clearCells();this._shErr=wijmo_1.asBoolean(e)}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"errorTip",{get:function(){return this._errorTip},set:function(e){if(e!=this._errorTip){this._clearCells();this._errorTip=wijmo_1.asType(e,wijmo_1.Tooltip,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"itemValidator",{get:function(){return this._itemValidator},set:function(e){if(e!=this.itemValidator){this._itemValidator=wijmo_1.asFunction(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"validateEdits",{get:function(){return this._valEdt},set:function(e){this._setvalidateEdits(e)},enumerable:!0,configurable:!0});FlexGrid.prototype._setvalidateEdits=function(e){this._valEdt=wijmo_1.asBoolean(e)};Object.defineProperty(FlexGrid.prototype,"groupHeaderFormat",{get:function(){return this._gHdrFmt},set:function(e){if(e!=this._gHdrFmt){this._gHdrFmt=wijmo_1.asString(e);this._bindGrid(!1)}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"allowDragging",{get:function(){return this._alDragging},set:function(e){if((e=wijmo_1.asEnum(e,AllowDragging))!=this._alDragging){this._alDragging=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){this._ariaLabel=e},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"itemsSource",{get:function(){return this._items},set:function(e){var t=this;if(e!=this._items){var i=new wijmo_1.CancelEventArgs;if(this.onItemsSourceChanging(i)){if(this._cv){(o=this._cv).currentChanged.removeHandler(null,this);o.collectionChanged.removeHandler(null,this);o instanceof wijmo_1.CollectionView&&o.sortConverter==this._bndSortConverter&&(o.sortConverter=null);this._cv=null}this._items=e;this._cv=this._getCollectionView(e);this._lastCount=0;if(this._cv){var o;(o=this._cv).currentChanged.addHandler((function(e,i){return t._cvCurrentChanged(e,i)}),this);o.collectionChanged.addHandler((function(e,i){return t._cvCollectionChanged(e,i)}),this);if(o instanceof wijmo_1.CollectionView){e&&(o.trackChanges=Boolean(e.trackChanges));o.sortConverter||(o.sortConverter=this._bndSortConverter)}}this._isISChanging=!0;this._bindGrid(!0);this._isISChanging=!1;this.onItemsSourceChanged(i)}}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"editableCollectionView",{get:function(){return wijmo_1.tryCast(this._cv,"IEditableCollectionView")},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"childItemsPath",{get:function(){return this._childItemsPath},set:function(e){if(e!=this._childItemsPath){wijmo_1.assert(null==e||wijmo_1.isArray(e)||wijmo_1.isString(e),"childItemsPath should be an array or a string.");this._childItemsPath=e;this._bindGrid(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"rowHeaderPath",{get:function(){return this._rowHdrPath?this._rowHdrPath.path:null},set:function(e){if(e!=this.rowHeaderPath){e=wijmo_1.asString(e);this._rowHdrPath=e?new wijmo_1.Binding(e):null;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"cells",{get:function(){return this._gpCells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"columnHeaders",{get:function(){return this._gpCHdr},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"columnFooters",{get:function(){return this._gpCFtr},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"rowHeaders",{get:function(){return this._gpRHdr},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"topLeftCells",{get:function(){return this._gpTL},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"bottomLeftCells",{get:function(){return this._gpBL},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"rows",{get:function(){return this._rows},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"columns",{get:function(){return this._cols},enumerable:!0,configurable:!0});FlexGrid.prototype.getColumn=function(e,t){if(this._hasColumnGroups()&&t){var i=this.getColumnGroups();return null!==i?i.getColumn(e):null}return this.columns.getColumn(e)};Object.defineProperty(FlexGrid.prototype,"frozenRows",{get:function(){return this.rows.frozen-this.rows.frozenDetailChildren},set:function(e){this.rows.frozen=e+this.rows.frozenDetailChildren},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"frozenColumns",{get:function(){return this.columns.frozen},set:function(e){this.columns.frozen=e},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"cloneFrozenCells",{get:function(){return this._fzClone},set:function(e){if(e!=this._fzClone){wijmo_1.setText(this._fCt,null);this._fzClone=wijmo_1.asBoolean(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"sortRowIndex",{get:function(){return this._sortRowIndex},set:function(e){if(e!=this._sortRowIndex){this._sortRowIndex=wijmo_1.asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"editColumnIndex",{get:function(){return this._editColIndex},set:function(e){if(e!=this._editColIndex){this._editColIndex=wijmo_1.asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"scrollPosition",{get:function(){return this._ptScrl.clone()},set:function(e){var t=this._root,i=-e.x;if(this.rightToLeft)switch(FlexGrid._getRtlMode()){case"rev":i=t.scrollWidth-t.clientWidth+e.x;break;case"neg":i=e.x;break;default:i=-e.x}t.scrollLeft=i;t.scrollTop=-e.y;this._updateScrollPosition()&&(this._forceScrollUpdate=!0)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"commitEmptyEdits",{get:function(){return this._commitEmptyEdits},set:function(e){if(e!=this._commitEmptyEdits){this._commitEmptyEdits=wijmo_1.asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"clientSize",{get:function(){return this._szClient},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"controlRect",{get:function(){this._rcBounds||(this._rcBounds=wijmo_1.getElementRect(this._root));return this._rcBounds},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"scrollSize",{get:function(){return new wijmo_1.Size(this._gpCells.width,this._heightBrowser)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"viewRange",{get:function(){return this._gpCells.viewRange},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"cellFactory",{get:function(){return this._cf},set:function(e){if(e!=this._cf){this._clearCells();this._cf=wijmo_1.asType(e,CellFactory,!1)}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._clearCells();this._itemFormatter=wijmo_1.asFunction(e)}},enumerable:!0,configurable:!0});FlexGrid.prototype.canEditCell=function(e,t){return this._edtHdl._allowEdit(e,t)};FlexGrid.prototype.getCellData=function(e,t,i){return this.cells.getCellData(e,t,i)};FlexGrid.prototype.getCellBoundingRect=function(e,t,i){return this.cells.getCellBoundingRect(e,t,i)};FlexGrid.prototype.setCellData=function(e,t,i,o,n){void 0===o&&(o=!0);void 0===n&&(n=!0);return this.cells.setCellData(e,t,i,o,n)};FlexGrid.prototype.hitTest=function(e,t){wijmo_1.isNumber(e)&&wijmo_1.isNumber(t)&&(e=new wijmo_1.Point(e,t));wijmo_1.isBoolean(t)&&t&&(this._rcBounds=null);return new HitTestInfo(this,e)};FlexGrid.prototype.getClipString=function(e,t,i,o){var n;n=this.skipMerged?ClipStringOptions.SkipMerged:null==t||wijmo_1.isBoolean(t)?t?ClipStringOptions.CSV:ClipStringOptions.Default:t;wijmo_1.assert(wijmo_1.isNumber(n),"Unexpected value for ClipStringOptions parameter.");return this._edtHdl.getClipString(e,n,i,o)};FlexGrid.prototype.setClipString=function(e,t){this._edtHdl.setClipString(e,t)};FlexGrid.prototype.focus=function(e){this.isDisabled||this._setFocus(e)};FlexGrid.prototype.dispose=function(){this.finishEditing(!0);this.itemsSource=null;e.prototype.dispose.call(this)};FlexGrid.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.finishEditing();if(t){this._updateColumnTypes();this.scrollPosition=this._ptScrl;this._updateDefaultSizes();clearTimeout(this._toInv);this._toInv=null}this.refreshCells(t);var i=this._e;i&&(this._szCtl=new wijmo_1.Size(i.offsetWidth,i.offsetHeight))};FlexGrid.prototype.refreshCells=function(e,t,i){this.isUpdating||(e?this._updateLayout():this._updateContent(t,i))};FlexGrid.prototype.refreshRange=function(e){for(var t=e.topRow;t<=e.bottomRow;t++)for(var i=e.leftCol;i<=e.rightCol;i++){var o=this.cells.getCellElement(t,i);if(o){var n=o[GridPanel._INDEX_KEY];this.cellFactory.updateCell(this.cells,t,i,o,n.rng)}}};FlexGrid.prototype.autoSizeColumn=function(e,t,i){void 0===t&&(t=!1);void 0===i&&(i=4);this.autoSizeColumns(e,e,t,i)};FlexGrid.prototype.autoSizeColumns=function(e,t,i,o){var n=this;void 0===i&&(i=!1);void 0===o&&(o=4);var l=0,r=i?this.topLeftCells:this.columnHeaders,s=i?this.bottomLeftCells:this.columnFooters,a=i?this.rowHeaders:this.cells,c=this.viewRange;e=null==e?0:wijmo_1.asInt(e);t=null==t?a.columns.length-1:wijmo_1.asInt(t);c.row=Math.max(0,c.row-1e3);c.row2=Math.min(c.row2+1e3,this.rows.length-1);this.finishEditing()&&this.columns.deferUpdate((function(){wijmo_1.setCss(n._eCt,{width:n._gpCells.width});for(var i=wijmo_1.createElement("<div "+FlexGrid._WJS_MEASURE+'="true"/>',a.hostElement,{visibility:"hidden"}),u=n._getCanvasContext(),d=e;d<=t&&d>-1&&d<a.columns.length;d++){var h=a.columns[d];if(h.isVisible){l=0;if(n.autoSizeMode&AutoSizeMode.Headers){for(var _=0;_<r.rows.length;_++)r.rows[_].isVisible&&(l=Math.max(n._getDesiredWidth(r,_,d,i),l));for(_=0;_<s.rows.length;_++)s.rows[_].isVisible&&(l=Math.max(n._getDesiredWidth(s,_,d,i),l))}if(n.autoSizeMode&AutoSizeMode.Cells&&c.row>-1&&c.row2>-1)if(h._getQuickAutoSize()){_=n._getWidestRow(a,c,d,u);l=Math.max(n._getDesiredWidth(a,_,d,i),l)}else for(_=c.row;_<=c.row2&&_<a.rows.length;_++)a.rows[_].isVisible&&(l=Math.max(n._getDesiredWidth(a,_,d,i),l));l>0&&(h.width=l+o+2)}}n.cellFactory.disposeCell(i);wijmo_1.removeChild(i)}))};FlexGrid.prototype.autoSizeRow=function(e,t,i){void 0===t&&(t=!1);void 0===i&&(i=0);this.autoSizeRows(e,e,t,i)};FlexGrid.prototype.autoSizeRows=function(e,t,i,o){var n=this;void 0===i&&(i=!1);void 0===o&&(o=0);var l=0,r=1==i?this.topLeftCells:null==i?this.bottomLeftCells:this.rowHeaders,s=1==i?this.columnHeaders:null==i?this.columnFooters:this.cells;o=wijmo_1.asNumber(o);e=null==e?0:wijmo_1.asInt(e);if((t=null==t?s.rows.length-1:wijmo_1.asInt(t))>=e&&this.finishEditing()){wijmo_1.setCss(this._eCt,{width:this._gpCells.width});var a=wijmo_1.createElement("<div "+FlexGrid._WJS_MEASURE+'="true"/>',s.hostElement,{visibility:"hidden"});this.rows.deferUpdate((function(){for(var i={},c=n._autoSizeMode,u=AutoSizeMode,d=e;d<=t&&d>-1&&d<s.rows.length;d++){if(s.rows[d].isVisible){l=0;c&u.Headers&&(l=n._getDesiredRowHeight(r,d,a,i));c&u.Cells&&(l=Math.max(n._getDesiredRowHeight(s,d,a,i),l));l>0&&(s.rows[d].height=l+o)}}}));this.cellFactory.disposeCell(a);wijmo_1.removeChild(a)}};Object.defineProperty(FlexGrid.prototype,"treeIndent",{get:function(){return this._indent},set:function(e){if(e!=this._indent){this._indent=wijmo_1.asNumber(e,!1,!0);this.columns.onCollectionChanged()}},enumerable:!0,configurable:!0});FlexGrid.prototype.collapseGroupsToLevel=function(e){var t=this;this.finishEditing()&&this.deferUpdate((function(){var i=t.rows;i.deferUpdate((function(){for(var t=0;t<i.length;t++){var o=i[t];o instanceof GroupRow&&(o.isCollapsed=o.level>=e)}}))}))};Object.defineProperty(FlexGrid.prototype,"selectionMode",{get:function(){return this._selHdl.selectionMode},set:function(e){if((e=wijmo_1.asEnum(e,SelectionMode))!=this.selectionMode){this._selHdl.selectionMode=e;this._updateTabIndex()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"selection",{get:function(){return this._selHdl.selection.clone()},set:function(e){this._selHdl.selection=e},enumerable:!0,configurable:!0});FlexGrid.prototype.select=function(e,t){void 0===t&&(t=!0);this.activePanelType=CellType.Cell;return this._selHdl.select(e,t)};FlexGrid.prototype.selectAll=function(){var e=this.rows.length,t=this.columns.length;return!(!e||!t)&&this.select(new CellRange(0,0,e-1,t-1),!1)};FlexGrid.prototype.getSelectedState=function(e,t){return this.cells.getSelectedState(e,t)};Object.defineProperty(FlexGrid.prototype,"selectedRows",{get:function(){var e=this,t=this.selectionMode,i=this.rows.filter((function(e){return e.isSelected}));if(0==i.length&&t!=SelectionMode.None){var o=[];this.selectedRanges.forEach((function(t){for(var i=t.topRow;i<=t.bottomRow&&i>-1&&i<e.rows.length;i++)o.indexOf(i)<0&&o.push(i)}));o.sort();i=o.map((function(t){return e.rows[t]}))}return i},set:function(e){var t=this;wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"This property can be set only in ListBox mode.");e=wijmo_1.asArray(e);this.deferUpdate((function(){for(var i=0,o=!0;i<t.rows.length;i++){var n=t.rows[i],l=e&&e.indexOf(n)>-1;if(l&&o){o=!1;t.select(i,t.selection.col)}n.isSelected=l}}))},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"selectedItems",{get:function(){var e=[];this.selectedRows.forEach((function(t){var i=t?t.dataItem:null;i&&e.indexOf(i)<0&&e.push(i)}));return e},set:function(e){var t=this;wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"This property can be set only in ListBox mode.");e=wijmo_1.asArray(e);this.deferUpdate((function(){for(var i=0,o=!0;i<t.rows.length;i++){var n=t.rows[i],l=e&&e.indexOf(n.dataItem)>-1;if(l&&o){o=!1;t.select(i,t.selection.col)}n.isSelected=l}}))},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"selectedRanges",{get:function(){var e=[this.selection];this._selHdl.extendedSelection.forEach((function(t){e.push(t)}));return e},set:function(e){if((e=wijmo_1.asArray(e))&&e.length>0){this.select(e[0]);if(this.selectionMode==SelectionMode.MultiRange){var t=this._selHdl.extendedSelection;t.deferUpdate((function(){t.clear();for(var i=1;i<e.length;i++)t.push(e[i])}))}}},enumerable:!0,configurable:!0});FlexGrid.prototype.scrollIntoView=function(e,t,i){(null==this._maxOffsetY||this._rows._dirty||this._cols._dirty)&&this._updateLayout();var o=this.scrollPosition,n=this._szClient,l=n.width,r=n.height-this._gpCFtr.rows.getTotalSize(),s=this.cells._getFrozenPos();e=wijmo_1.asInt(e);var a=this._rows[e];if(e>-1&&e<this._rows.length&&e>=this._rows.frozen){var c=this._getCssPage(a.pos);if(c!=this._cssPage){for(var u=this._maxOffsetY,d=Math.round(u*c);d>a.pos;c-=.1)d=Math.round(u*c);this._offsetY=d}var h=a.pos-this._offsetY,_=h+a.renderSize;_>r-o.y&&(o.y=Math.max(-h,r-_));h-s.y<-o.y&&(o.y=-(h-s.y));c!=this._cssPage&&(this._cssPage=this._getCssPage(-o.y))}wijmo_1.isString(t)&&(t=this.columns.indexOf(t));if((t=wijmo_1.asInt(t))>-1&&t<this._cols.length&&t>=this._cols.frozen){var p=this._cols[t],f=p.pos+p.renderSize;f>-o.x+l&&(o.x=Math.max(-p.pos,l-f));p.pos-s.x<-o.x&&(o.x=-(p.pos-s.x))}if(!o.equals(this._ptScrl)){o.x<this._ptScrl.x&&(0!==o.x?o.x-=1:this.rightToLeft&&(o.x+=1));0!==o.y&&o.y<this._ptScrl.y&&(o.y-=1);this.scrollPosition=o;if(i){this._updateScrollPosition();this._forceScrollUpdate=!1;this.refresh()}return!0}if(a&&this.hostElement.clientHeight>document.scrollingElement.clientHeight){var g=document.scrollingElement.scrollTop-s.y,m=g+document.scrollingElement.clientHeight,w=this.hostElement.offsetTop+this.cells.hostElement.offsetTop+a.pos,C=w+a.renderSize;this._stickyHdr&&(w-=this._eCHdr.offsetHeight);var v=void 0;w<g?v=g-(g-w)+s.y:C>m&&(v=g+(C-m)+s.y);void 0!==v&&document.scrollingElement.scrollTo({top:v})}if(this._activeCell&&e>-1&&t>-1){var y=this._root,b=y.scrollWidth==y.clientWidth,R=y.scrollHeight==y.clientHeight;if(b||R){var j=this._activeCell.getBoundingClientRect(),E=innerWidth,x=innerHeight,S=j.right<0||j.left>E,H=j.bottom<0||j.top>x;o.x=pageXOffset+(j.left<0?j.left:j.right>E?j.right-E:0);o.y=pageYOffset+(j.top<0?j.top:j.bottom>x?j.bottom-x:0);S&&b&&H&&R?scrollTo(o.x,o.y):S&&b?scrollTo(o.x,document.documentElement.scrollLeft):H&&R&&scrollTo(document.documentElement.scrollTop,o.y)}}return!1};FlexGrid.prototype.isRangeValid=function(e){return e&&e.isValid&&e.bottomRow<this.rows.length&&e.rightCol<this.columns.length};FlexGrid.prototype.startEditing=function(e,t,i,o,n){void 0===e&&(e=!0);return this._edtHdl.startEditing(e,t,i,o,n)};FlexGrid.prototype.finishEditing=function(e){return this._edtHdl.finishEditing(e)};Object.defineProperty(FlexGrid.prototype,"activeCell",{get:function(){return this._activeCell},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"activeEditor",{get:function(){var e=this._edtHdl;return e?e.activeEditor:null},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"editRange",{get:function(){var e=this._edtHdl.editRange;return e?e.clone():null},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"mergeManager",{get:function(){return this._mrgMgr},set:function(e){if(e!=this._mrgMgr){this._mrgMgr=wijmo_1.asType(e,MergeManager,!0);this.invalidate()}},enumerable:!0,configurable:!0});FlexGrid.prototype.getMergedRange=function(e,t,i,o){void 0===o&&(o=!0);return this._mrgMgr?this._mrgMgr.getMergedRange(e,t,i,o):null};Object.defineProperty(FlexGrid.prototype,"keyActionTab",{get:function(){return this._keyHdl._kaTab},set:function(e){this._keyHdl._kaTab=wijmo_1.asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"keyActionEnter",{get:function(){return this._keyHdl._kaEnter},set:function(e){this._keyHdl._kaEnter=wijmo_1.asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"preserveWhiteSpace",{get:function(){return wijmo_1.hasClass(this.hostElement,FlexGrid._WJS_WSPRE)},set:function(e){wijmo_1.toggleClass(this.hostElement,FlexGrid._WJS_WSPRE,wijmo_1.asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(FlexGrid.prototype,"showDropDown",{get:function(){return this._shDropDown},set:function(e){if(e!=this._shDropDown){this._shDropDown=wijmo_1.asBoolean(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});FlexGrid.prototype.toggleDropDownList=function(){if(!this._tglDropDown){this._tglDropDown=!0;this._edtHdl._toggleListBox(null);this._tglDropDown=!1}return null!=this._edtHdl._lbx};Object.defineProperty(FlexGrid,"defaultTypeWidth",{get:function(){return FlexGrid._defTypeWidth},enumerable:!0,configurable:!0});FlexGrid.prototype.onItemsSourceChanging=function(e){this.itemsSourceChanging.raise(this,e);return!e.cancel};FlexGrid.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)};FlexGrid.prototype.onScrollPositionChanged=function(e){this.scrollPositionChanged.raise(this,e)};FlexGrid.prototype.onSelectionChanging=function(e){this.selectionChanging.raise(this,e);return!e.cancel};FlexGrid.prototype.onSelectionChanged=function(e){this.selectionChanged.raise(this,e)};FlexGrid.prototype.onLoadingRows=function(e){this.loadingRows.raise(this,e);return!e.cancel};FlexGrid.prototype.onLoadedRows=function(e){this.loadedRows.raise(this,e);this._autoRowHeights()};FlexGrid.prototype.onUpdatingLayout=function(e){this.updatingLayout.raise(this,e);return!e.cancel};FlexGrid.prototype.onUpdatedLayout=function(e){this.updatedLayout.raise(this,e)};FlexGrid.prototype.onResizingColumn=function(e){this.resizingColumn.raise(this,e);return!e.cancel};FlexGrid.prototype.onResizedColumn=function(e){this.resizedColumn.raise(this,e);this._autoRowHeights()};FlexGrid.prototype.onAutoSizingColumn=function(e){this.autoSizingColumn.raise(this,e);return!e.cancel};FlexGrid.prototype.onAutoSizedColumn=function(e){this.autoSizedColumn.raise(this,e)};FlexGrid.prototype.onStarSizedColumns=function(e){this.starSizedColumns.raise(this,e);this._autoRowHeights()};FlexGrid.prototype.onDraggingColumn=function(e){this.draggingColumn.raise(this,e);return!e.cancel};FlexGrid.prototype.onDraggingColumnOver=function(e){this.draggingColumnOver.raise(this,e);return!e.cancel};FlexGrid.prototype.onDraggedColumn=function(e){this.draggedColumn.raise(this,e)};FlexGrid.prototype.onPinningColumn=function(e){this.pinningColumn.raise(this,e);return!e.cancel};FlexGrid.prototype.onPinnedColumn=function(e){this.pinnedColumn.raise(this,e)};FlexGrid.prototype.onResizingRow=function(e){this.resizingRow.raise(this,e);return!e.cancel};FlexGrid.prototype.onResizedRow=function(e){this.resizedRow.raise(this,e)};FlexGrid.prototype.onAutoSizingRow=function(e){this.autoSizingRow.raise(this,e);return!e.cancel};FlexGrid.prototype.onAutoSizedRow=function(e){this.autoSizedRow.raise(this,e)};FlexGrid.prototype.onDraggingRow=function(e){this.draggingRow.raise(this,e);return!e.cancel};FlexGrid.prototype.onDraggingRowOver=function(e){this.draggingRowOver.raise(this,e);return!e.cancel};FlexGrid.prototype.onDraggedRow=function(e){this.draggedRow.raise(this,e)};FlexGrid.prototype.onGroupCollapsedChanging=function(e){this.groupCollapsedChanging.raise(this,e);return!e.cancel};FlexGrid.prototype.onGroupCollapsedChanged=function(e){this.groupCollapsedChanged.raise(this,e)};FlexGrid.prototype.onColumnGroupCollapsedChanging=function(e){this.columnGroupCollapsedChanging.raise(this,e);return!e.cancel};FlexGrid.prototype.onColumnGroupCollapsedChanged=function(e){this.columnGroupCollapsedChanged.raise(this,e)};FlexGrid.prototype.onSortingColumn=function(e){this.sortingColumn.raise(this,e);return!e.cancel};FlexGrid.prototype.onSortedColumn=function(e){this.sortedColumn.raise(this,e)};FlexGrid.prototype.onBeginningEdit=function(e){this._addHdl._beginningEdit(this,e);e.cancel||this.beginningEdit.raise(this,e);return!e.cancel};FlexGrid.prototype.onPrepareCellForEdit=function(e){this.prepareCellForEdit.raise(this,e)};FlexGrid.prototype.onCellEditEnding=function(e){this.cellEditEnding.raise(this,e);return!e.cancel&&!e.stayInEditMode};FlexGrid.prototype.onCellEditEnded=function(e){this.cellEditEnded.raise(this,e);this._autoRowHeights()};FlexGrid.prototype.onRowEditStarting=function(e){this._addHdl._rowEditStarting(this,e);e.cancel||this.rowEditStarting.raise(this,e);return!e.cancel};FlexGrid.prototype.onRowEditStarted=function(e){this.rowEditStarted.raise(this,e)};FlexGrid.prototype.onRowEditEnding=function(e){this._addHdl._rowEditEnding(this,e);this.rowEditEnding.raise(this,e)};FlexGrid.prototype.onRowEditEnded=function(e){this.rowEditEnded.raise(this,e);this._addHdl._rowEditEnded(this,e);this._autoRowHeights()};FlexGrid.prototype.onRowAdded=function(e){this.rowAdded.raise(this,e);return!e.cancel};FlexGrid.prototype.onDeletingRow=function(e){this.deletingRow.raise(this,e);return!e.cancel};FlexGrid.prototype.onDeletedRow=function(e){this.deletedRow.raise(this,e)};FlexGrid.prototype.onCopying=function(e){this.copying.raise(this,e);return!e.cancel};FlexGrid.prototype.onCopied=function(e){this.copied.raise(this,e)};FlexGrid.prototype.onPasting=function(e){this.pasting.raise(this,e);return!e.cancel};FlexGrid.prototype.onPasted=function(e){this.pasted.raise(this,e)};FlexGrid.prototype.onPastingCell=function(e){this.pastingCell.raise(this,e);return!e.cancel};FlexGrid.prototype.onPastedCell=function(e){this.pastedCell.raise(this,e)};FlexGrid.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};FlexGrid.prototype.onUpdatingView=function(e){this.updatingView.raise(this,e);return!e.cancel};FlexGrid.prototype.onUpdatedView=function(e){this.updatedView.raise(this,e)};FlexGrid.prototype._createSelHdl=function(){return new _SelectionHandler(this)};FlexGrid.prototype._getTabIndex=function(){return this._orgTabIndex};FlexGrid.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._updateTabIndex()};FlexGrid.prototype._updateTabIndex=function(){var e=this.isDisabled?-1:this._orgTabIndex,t=this._imeHdl;t&&t._updateImeFocus();var i=this._activeCell,o=this._root,n=this._eFocus;if(i){i.tabIndex=e;n.tabIndex=-1;o.tabIndex=-1}else if(this.selectionMode!=SelectionMode.None){n.tabIndex=e;o.tabIndex=-1}else{o.tabIndex=e;n.tabIndex=-1}};FlexGrid.prototype._autoRowHeights=function(){var e=this;if(this._autoHeights){this.rows.length>100&&[this.columnHeaders,this.rowHeaders].forEach((function(e){e._updateContent(!0,!1,e._getOffsetY())}));clearTimeout(this._toAutoHeights);this._toAutoHeights=setTimeout((function(){e._toAutoHeights=null;e.editRange||e._autoSizeRows()}),wijmo_1.Control._REFRESH_INTERVAL)}};FlexGrid.prototype._autoSizeRows=function(){var e=this.autoSizeMode,t=AutoSizeMode;if(e&t.Headers){this._autoSizeMode=t.Both;this.autoSizeRows(0,this.columnHeaders.rows.length-1,!0);this._autoSizeMode=e}e&t.Cells&&this.autoSizeRows()};FlexGrid.prototype._getShowErrors=function(){return this.showErrors&&this._hasValidation};FlexGrid.prototype._getHasValidation=function(){return this._hasValidation};FlexGrid.prototype._getError=function(e,t,i,o){if(wijmo_1.isFunction(this.itemValidator)){if(e==this.cells)return this.itemValidator(t,i,o);if(e==this.rowHeaders){var n=e.rows,l=this.columns,r=n[t].dataItem,s=null,a=[],c=t;if(f=this.getMergedRange(e,t,i,!1)){for(t=c=f.row;t<n.length&&(n[t].dataItem==r||f&&f.rowSpan>1&&f.row2>=t);t++)for(var u=0;u<l.length;u++)if(s=this.itemValidator(t,u,!1)){(m=this.getMergedRange(this.cells,t,u))&&(m.columnSpan>1&&m.col<u||m.rowSpan>1&&m.row<t)||a.push(s)}}else for(u=0;u<this.columns.length;u++){var d=this.itemValidator(t,u,!1);d&&a.push(d)}if(a.length){var h=!!(w=this.errorTip)&&w.isContentHtml;s=a.join(h?"<br/>":"\n")}return s}}var _=this._cv,p=_?_.getError:null;if(wijmo_1.isFunction(p)){n=e.rows,l=this.columns;if((r=n[t].dataItem)&&!(r instanceof wijmo_1.CollectionViewGroup))if(e==this.cells)for(;t<n.length&&n[t].dataItem==r;t++){return p(r,(g=this._getBindingColumn(this.cells,t,l[i])).binding,o)}else if(e==this.rowHeaders){if(!(s=p(r,null,!1))){var f;a=[],c=t;(f=this.getMergedRange(e,t,i,!1))&&(c=f.row);for(t=c;t<n.length&&(n[t].dataItem==r||f&&f.rowSpan>1&&f.row2>=t);t++)for(u=0;u<l.length;u++){var g=this._getBindingColumn(this.cells,t,l[u]);if(s=p(n[t].dataItem,g.binding,!1)){var m;(m=this.getMergedRange(this.cells,t,u))&&(m.columnSpan>1&&m.col<u||m.rowSpan>1&&m.row<t)||a.push(s)}}if(a.length){var w;h=!!(w=this.errorTip)&&w.isContentHtml;s=a.join(h?"<br/>":"\n")}}return s}}return null};FlexGrid.prototype._setAria=function(e,t){wijmo_1.setAttribute(this.cells.hostElement,"aria-"+e,t)};FlexGrid.prototype._setFocus=function(e){if(this.hostElement){var t=wijmo_1.getActiveElement(),i=this.activeEditor,o=this._activeCell,n=this._eFocus,l=this._root,r=this._getTabIndex(),s=this.containsFocus();if(!e&&s&&this.selectionMode!=SelectionMode.None){if(this.rows.length>0&&this.selection.row>=0&&this.selection.col>=0){var a=this._getBindingColumn(this.cells,this.selection.row,this.columns[this.selection.col]),c=a&&a._edt;!o||wijmo_1.contains(o,t)||this.imeEnabled||c||this._correctFocusOfActiveCell(o)}}else if(e||!s){if(i){if(!wijmo_1.contains(i,t)){i.focus();n.tabIndex=-1;l.tabIndex=-1}}else if(o)wijmo_1.contains(o,t)||this._correctFocusOfActiveCell(o);else if(!wijmo_1.contains(n,t)&&t!=l)if(this.selectionMode!=SelectionMode.None){n.tabIndex=r;this._setFocusNoScroll(n)}else{l.tabIndex=r;this._setFocusNoScroll(l)}if(!this.containsFocus())if(this.selectionMode!=SelectionMode.None){n.tabIndex=r;this._setFocusNoScroll(n)}else{l.tabIndex=r;this._setFocusNoScroll(l)}}}};FlexGrid.prototype._correctFocusOfActiveCell=function(e){var t=this._getTabIndex();if(wijmo_1.getActiveElement()!=this._root){wijmo_1.isIE()&&wijmo_1.hasClass(e,"wj-group")&&(e=e.querySelector("."+CellFactory._WJC_COLLAPSE)||e);e.tabIndex=t;this._setFocusNoScroll(e)}else e.tabIndex=t;this._eFocus.tabIndex=-1};FlexGrid.prototype._setFocusNoScroll=function(e){if(wijmo_1.getActiveElement()!=e){if(wijmo_1.supportsFocusOptions())e.focus({preventScroll:!0});else{var t=this.scrollPosition,i=e.style,o=i.position;i.position="fixed";e.focus();i.position=o;this.scrollPosition=t}this._fixScroll()}};FlexGrid.prototype._clearAnchorCell=function(){this._anchorCell=null};FlexGrid.prototype._setAnchorCell=function(e,t){var i=this.getMergedRange(this.cells,e,t);this._anchorCell=i?new wijmo_1.Point(i.col,i.row):new wijmo_1.Point(t,e)};FlexGrid.prototype._getAnchorCell=function(){return this._anchorCell};FlexGrid.prototype._updateDefaultSizes=function(){var e=this._getDefaultRowHeight();this._rows._setDefaultSize(e);this._cols._setDefaultSize(4*e);this._hdrRows._setDefaultSize(e);this._hdrCols._setDefaultSize(Math.round(1.25*e));this._ftrRows._setDefaultSize(e);return e};FlexGrid.prototype._getDefaultRowHeight=function(){var e=this.hostElement,t=this._eFocus,i=null;if(!t.offsetHeight){i=wijmo_1.createElement('<div><div class="wj-cell">0</div></div>',document.body);e&&i.setAttribute("class",e.getAttribute("class"));t=i.children[0]}var o=t.offsetHeight;(isNaN(o)||o<=6)&&(o=28);wijmo_1.removeChild(i);return o};FlexGrid.prototype._getCollectionView=function(e){return wijmo_1.asCollectionView(e)};FlexGrid.prototype._getCanvasContext=function(){var e=document.createElement("canvas").getContext("2d"),t=getComputedStyle(this.hostElement);e.font=t.fontSize+" "+t.fontFamily.split(",")[0];return e};FlexGrid.prototype._getWidestRow=function(e,t,i,o){for(var n=0,l=0,r=1===this._getRowsPerItem()&&e.columns[i].dataType==wijmo_1.DataType.Boolean,s=t.row;s<=t.row2;s++)if(e.rows[s].isVisible){var a=e.getCellData(s,i,!0),c=o.measureText(a).width,u=this.getMergedRange(e,s,i,!1);u&&u.columnSpan>1&&(c/=u.columnSpan);if(c>l){l=c;n=s}if(r)break;s+=u?u.rowSpan-1:0}return n};FlexGrid.prototype._getDesiredWidth=function(e,t,i,o){var n=this.getMergedRange(e,t,i,!1),l=o.style;this.cellFactory.updateCell(e,t,i,o,n);l.width=l.top=l.left="";return o.offsetWidth/(n&&n.columnSpan>1?n.columnSpan:1)};FlexGrid.prototype._getDesiredHeight=function(e,t,i,o){var n=o.style,l=this.getMergedRange(e,t,i,!1),r=l?l.rowSpan:1;this.cellFactory.updateCell(e,t,i,o,l);o.innerHTML.trim()||(o.innerHTML=" ");n.height=n.top=n.left="";return o.offsetHeight/r};FlexGrid.prototype._getDesiredRowHeight=function(e,t,i,o){for(var n=0,l=(e.rows[t],this._getQuickAutoSize()),r=0;r<e.columns.length;r++){if(e.columns[r].isVisible){var s=this.getMergedRange(e,t,r,!1),a=void 0;if(l){var c={ct:e.cellType,col:r,spr:s&&s.rowSpan>1?s.rowSpan:1,spc:s&&s.columnSpan>1?s.columnSpan:1,data:e.getCellData(t,r,!0)||"1"},u=JSON.stringify(c);if(null==(a=o[u])){a=this._getDesiredHeight(e,t,r,i);o[u]=a}}else a=this._getDesiredHeight(e,t,r,i);n=Math.max(a,n);r+=s?s.columnSpan-1:0}}return n};FlexGrid.prototype._getSortRowIndex=function(){return null!=this._sortRowIndex?this._sortRowIndex:this.columnHeaders.rows.length-1};FlexGrid.prototype._getDeleteColumnIndex=function(){return 0};FlexGrid.prototype._getEditColumnIndex=function(){return null!=this._editColIndex?this._editColIndex:this.rowHeaders.columns.length-1};FlexGrid.prototype._sortConverter=function(e,t,i,o){var n,l=this;if(o){this._mappedColumns=null;this._cv&&this._cv.sortDescriptions.forEach((function(e){if((n=l.getColumn(e.property))&&n.dataMap){l._mappedColumns||(l._mappedColumns={});l._mappedColumns[n.binding]=n.dataMap}}));if(this._mouseHdl._htDown&&this._mouseHdl._htDown.col>-1){n=this.columns[this._mouseHdl._htDown.col];this._mappedColumns&&n.dataMap&&(this._mappedColumns[n.binding]=n.dataMap)}}if(this._mappedColumns){var r=this._mappedColumns[e.property];r&&r.sortByDisplayValues&&(i=r.getDisplayValue(i))}return i};FlexGrid.prototype._bindGrid=function(e){var t=this;this.finishEditing();this.deferUpdate((function(){t.autoGenerateColumns&&0==t._lastCount&&wijmo_1.hasItems(t._cv)&&(e=!0);var i;t.preserveSelectedState&&(i=t._getMap())&&t.rows.forEach((function(e){e.isSelected&&e.dataItem&&i.set(e.dataItem,!0)}));var o,n=t._getMap();n&&t.rows.forEach((function(e){e.isReadOnly&&e.dataItem&&n.set(e.dataItem,!0)}));if(t.preserveOutlineState&&t.rows.maxGroupLevel>-1&&(o=t._getMap()))for(var l=0;l<t.rows.length;l++){var r=t.rows[l];if(r instanceof GroupRow&&r.isCollapsed&&r.dataItem){var s=r.dataItem;s instanceof wijmo_1.CollectionViewGroup&&(s=s._path);o.set(s,!0)}}e&&t.columns.deferUpdate((function(){t._bindColumns()}));var a=new wijmo_1.CancelEventArgs;if(t.onLoadingRows(a)){t.rows.deferUpdate((function(){t._bindRows()}));t.onLoadedRows(a)}t._selHdl.extendedSelection.clear();var c=0;i&&i.size&&t.rows.forEach((function(e){var t=e.dataItem;if(t&&i.has(t)){e.isSelected=!0;c++}}));n&&n.size&&t.rows.forEach((function(e){var t=e.dataItem;t&&n.has(t)&&(e.isReadOnly=!0)}));if(0==c&&t.selectionMode==SelectionMode.ListBox){var u=t.selection;for(l=u.topRow;l<=u.bottomRow&&l>-1&&l<t.rows.length;l++)t.rows[l]._setFlag(RowColFlags.Selected,!0,!0)}o&&o.size&&t.rows.deferUpdate((function(){t.rows.forEach((function(e){if(e instanceof GroupRow){var t=e.dataItem;t instanceof wijmo_1.CollectionViewGroup&&(t=t._path);o.has(t)&&(e.isCollapsed=!0)}}))}));if(!t._lastCount){var d=t._cv;d&&d.items&&(t._lastCount=d.items.length)}}));if(this._cv){var i=e&&!this._toInv;this._syncSelection(i)}else{var o=this.selection,n=new CellRange(-1,o.col,-1,o.col2);this._selHdl._adjustSelection(n,this.selectionMode)}};FlexGrid.prototype._getMap=function(){return window.Map?new Map:null};FlexGrid.prototype._cvCollectionChanged=function(e,t){if(this.autoGenerateColumns&&0==this.columns.length)this._bindGrid(!0);else{var i=wijmo_1.NotifyCollectionChangedAction;if(this.childItemsPath&&t.action!=i.Change)this._bindGrid(!1);else{switch(t.action){case i.Change:this.invalidate();return;case i.Add:if(t.index==this._cv.items.length-1){var o=this.rows.length;this.rows[o-1]instanceof _NewRowTemplate&&o--;this.rows.insert(o,new Row(t.item));return}wijmo_1.assert(!1,"added item should be the last one.");break;case i.Remove:var n=this._findRow(t.item);if(n>-1){this.rows.removeAt(n);this._syncSelection(!1);return}wijmo_1.assert(!1,"removed item not found on grid.")}this._bindGrid(!1)}}};FlexGrid.prototype._cvCurrentChanged=function(e,t){this._syncSelection(!1)};FlexGrid.prototype._syncSelection=function(e){if(this._cv&&this.selectionMode!=SelectionMode.None){var t=this._selHdl,i=t.selection,o=i.row>-1&&i.row<this.rows.length?this.rows[i.row]:null,n=o?o.dataItem:null,l=this._cv;if(l instanceof wijmo_1.CollectionView&&l.isUpdating)return;if(this.newRowAtTop&&o instanceof _NewRowTemplate)return;n instanceof wijmo_1.CollectionViewGroup&&(n=null);var r=this._isISChanging;if(e||n!=l.currentItem||i.row>=this.rows.length||i.row2>=this.rows.length||r&&i.row!==i.row2){var s=this.editableCollectionView;if(!this.childItemsPath||!s||!s.currentAddItem){var a=this._getRowIndex(l.currentPosition);if(a!=i.row||!this.childItemsPath){var c=r?i.col:i.col2;i=new CellRange(a,i.col,a,c);t._adjustSelection(i,this.selectionMode);this.selectionMode&&!this._updating&&this.scrollIntoView(i.row,-1)}}}}};FlexGrid.prototype._getRowIndex=function(e){if(this._cv){var t=this.rows;if(e>-1){for(var i=this._cv.items[e];e<t.length;e++)if(t[e].dataItem===i)return e;return-1}if(1==t.length&&t[0]instanceof _NewRowTemplate)return 0;var o=this.selection.row,n=o>-1?t[o]:null;return n&&(n instanceof GroupRow||null==n.dataItem)?o:-1}return this.selection.row};FlexGrid.prototype._getCvIndex=function(e){return e>-1&&e<this.rows.length?this.rows[e].dataIndex:-1};FlexGrid.prototype._findRow=function(e){for(var t=0;t<this.rows.length;t++)if(this.rows[t].dataItem==e)return t;return-1};FlexGrid.prototype._preWidth=function(){var e=this._root,t=this._hdrVis&HeadersVisibility.Row?this._hdrCols.getTotalSize():0;return e.clientWidth-t};FlexGrid.prototype._updateLayout=function(){var e=this,t=new wijmo_1.CancelEventArgs;if(this.onUpdatingLayout(t)){var i=this._hdrVis&HeadersVisibility.Row?this._hdrCols.getTotalSize():0,o=this._hdrVis&HeadersVisibility.Column?this._hdrRows.getTotalSize():0,n=this._ftrRows.getTotalSize(),l=this._rows.getTotalSize()+n;l<1&&(l=1);this._heightReal=l;this._heightBrowser=Math.min(l,FlexGrid._getMaxSupportedCssHeight());this._maxOffsetY=Math.max(0,l-this._heightBrowser);var r=getComputedStyle(this._eFocus);this._cellPadVert=parseInt(r.paddingTop)+parseInt(r.paddingBottom);this._cellPadHorz=parseInt(r.paddingLeft)+parseInt(r.paddingRight);this._cellPadLeft=parseInt(this.rightToLeft?r.paddingRight:r.paddingLeft);var s=this._heightBrowser+o-n,a=this._gpCells.width,c=this._heightBrowser;!a&&this.rows.length&&(a=.1);!c&&this.columns.length&&(c=.1);if(this.rightToLeft){wijmo_1.setCss(this._eTL,{right:0,top:0,width:i,height:o});wijmo_1.setCss(this._eCHdr,{right:i,top:0,height:o});wijmo_1.setCss(this._eRHdr,{right:0,top:o,width:i});wijmo_1.setCss(this._eCt,{right:i,top:o,width:a,height:c});wijmo_1.setCss(this._fCt,{right:i,top:o});wijmo_1.setCss(this._eBL,{right:0,top:s,width:i,height:n});wijmo_1.setCss(this._eCFtr,{right:i,top:s,height:n})}else{wijmo_1.setCss(this._eTL,{left:0,top:0,width:i,height:o});wijmo_1.setCss(this._eCHdr,{left:i,top:0,height:o});wijmo_1.setCss(this._eRHdr,{left:0,top:o,width:i});wijmo_1.setCss(this._eCt,{left:i,top:o,width:a,height:c});wijmo_1.setCss(this._fCt,{left:i,top:o});wijmo_1.setCss(this._eBL,{left:0,top:s,width:i,height:n});wijmo_1.setCss(this._eCFtr,{left:i,top:s,height:n})}this._stickyHdr&&this._updateStickyHeaders();var u=this.rows.frozen||this.columns.frozen;wijmo_1.setCss([this._eTL,this._eBL,this._eCFtr,this._eRHdr],{zIndex:u?"4":"3"});wijmo_1.setCss(this._eCHdr,{zIndex:u?"5":"3"});wijmo_1.setCss(this._eMarquee,{zIndex:u?"3":"1"});this._eCHdr.closest(".wj-cell")&&wijmo_1.setCss(this._eCHdr,{zIndex:u?"4":"2"});wijmo_1.isIE()&&(this._fCt.style.zIndex=u?"3":"");var d=this._root,h=d.offsetWidth-d.clientWidth,_=d.offsetHeight-d.clientHeight;wijmo_1.setCss(this._eSz,{width:i+h+this._gpCells.width,height:o+_+this._heightBrowser});var p=null;if(this.columns._updateStarSizes(d.clientWidth-i)){p=d.clientWidth;wijmo_1.setCss(this._eCt,{width:this._gpCells.width});this.onStarSizedColumns()}this._szClient=new wijmo_1.Size(d.clientWidth-i,d.clientHeight-o);this._szClientSB=new wijmo_1.Size(d.offsetWidth-i,d.offsetHeight-o);this._rcBounds=null;this._updateScrollHandler();this._updateContent(!1);h=d.offsetWidth-d.clientWidth;_=d.offsetHeight-d.clientHeight;wijmo_1.setCss(this._eSz,{width:i+h+this._gpCells.width,height:o+_+this._heightBrowser});this._szClient=new wijmo_1.Size(d.clientWidth-i,d.clientHeight-o);if(p&&p!=d.clientWidth&&this.columns._updateStarSizes(d.clientWidth-i)){wijmo_1.setCss(this._eCt,{width:this._gpCells.width});this._updateContent(!1)}wijmo_1.setCss([this._eCHdr,this._eCFtr,this._fCt],{width:this._szClient.width});wijmo_1.setCss([this._eRHdr,this._fCt],{height:this._szClient.height});if(n){s=Math.min(s,this._szClient.height+o-n);wijmo_1.setCss([this._eBL,this._eCFtr],{top:s})}window.addEventListener("load",(function(){wijmo_1.setCss(e._root,{"overflow-y":e._root.scrollHeight===e._root.parentElement.clientHeight?"hidden":"auto","overflow-x":e._root.scrollWidth===e._root.parentElement.clientWidth?"hidden":"auto"})}));this.onUpdatedLayout(t)}};FlexGrid.prototype._updateStickyHeaders=function(){var e=!1,t=0;if(this._stickyHdr){for(var i=0,o=null,n=this.hostElement;n;n=n.parentElement)if("inline"!=getComputedStyle(n).display){var l=n.getBoundingClientRect();null==o&&(o=l.top);i=Math.max(i,l.top)}t=-(o=Math.max(0,i-o-1));e=o>0;this._rcBounds=null}this._eTL.style.top=this._eCHdr.style.top=e?-t+"px":"";wijmo_1.toggleClass(this._eTL,FlexGrid._WJS_STICKY,e);wijmo_1.toggleClass(this._eCHdr,FlexGrid._WJS_STICKY,e)};FlexGrid.prototype._updateScrollHandler=function(){this._clipToScreen=this._getClipToScreen();var e=this._stickyHdr||this._clipToScreen;if(e!=this._scrollHandlerAttached){this._scrollHandlerAttached=e;e?this.addEventListener(window,"scroll",this._scroll.bind(this),!0):this.removeEventListener(window,"scroll")}};FlexGrid.prototype._getClipToScreen=function(){if(this.rows.length<=FlexGrid._MIN_VIRT_ROWS)return!1;if(this._root.scrollHeight>this._root.clientHeight)return!1;for(var e=this.hostElement;e&&e!=document.documentElement;e=e.parentElement){if("auto"==getComputedStyle(e).overflow)return!1}return!0};FlexGrid.prototype._scroll=function(e){var t=this;if(wijmo_1.contains(e.target,this.hostElement)){if(this._clipToScreen){this._afClip&&cancelAnimationFrame(this._afClip);this._afClip=requestAnimationFrame((function(){t._afClip=null;t.finishEditing();t._updateContent(!0)}))}if(this._stickyHdr){this._afSticky&&cancelAnimationFrame(this._afSticky);this._afSticky=requestAnimationFrame((function(){t._afSticky=null;var e=new wijmo_1.CancelEventArgs;if(t.onUpdatingLayout(e)){t._updateStickyHeaders();t.onUpdatedLayout(e)}}))}}};FlexGrid.prototype._getCssPage=function(e){if(this._heightReal>this._heightBrowser){var t=this._szClient.height-this._gpCFtr.rows.getTotalSize();if(this._heightBrowser>t)return wijmo_1.clamp(Math.round(e/(this._heightBrowser-t)*10)/10,0,1)}return 0};FlexGrid.prototype._updateScrollPosition=function(){var e=this._root,t=e.scrollTop,i=e.scrollLeft;this.rightToLeft&&"rev"==FlexGrid._getRtlMode()&&(i=e.scrollWidth-e.clientWidth-i);var o=new wijmo_1.Point(-Math.abs(i),-t);if(!this._ptScrl.equals(o)){this._ptScrl=o;this._updateMarquee();this.onScrollPositionChanged();return!0}return!1};FlexGrid.prototype._updateContent=function(e,t){var i=this,o=this._root,n=this.hostElement,l=this.cells.hostElement,r=this._activeCell,s=wijmo_1.getActiveElement(),a=wijmo_1.contains(n,s),c=wijmo_1.closest(s,".wj-flexgrid")==n?s:null,u=new wijmo_1.CancelEventArgs;if(this.onUpdatingView(u)){if([HeadersFocusability.All,HeadersFocusability.Column].includes(this.headersFocusability)){wijmo_1.setAttribute(this.hostElement,"role",this.rows.maxGroupLevel<0?"grid":"treegrid");wijmo_1.setAttribute(this.hostElement,"aria-label",this.ariaLabel)}else{wijmo_1.setAttribute(l,"role",this.rows.maxGroupLevel<0?"grid":"treegrid");wijmo_1.setAttribute(l,"aria-label",this.ariaLabel)}this._hasValidation=wijmo_1.isFunction(this._itemValidator)||this._cv&&wijmo_1.isFunction(this._cv.getError);var d=!t&&this._errorTip&&this._errorTip._tips.length,h=this._getCssPage(-this._ptScrl.y);if(h!=this._cssPage){this._cssPage=h;this._offsetY=Math.round(this._maxOffsetY*h)}this._updateScrollPosition();this._updateMarquee();var _=this._gpCells._updateContent(e,t,this._offsetY),p=this._hdrVis;if(p&HeadersVisibility.Column&&(!t||this._ssHdr&p)){this._gpCHdr._updateContent(e,t,0);this.rightToLeft||(this._eCHdr.scrollLeft=0)}if(p&HeadersVisibility.Row&&(!t||this._ssHdr&p)){this._gpRHdr._updateContent(e,t,this._offsetY);this._eRHdr.scrollTop=0}p&&!t&&this._gpTL._updateContent(e,t,0);if(this._gpCFtr.rows.length){this._gpBL._updateContent(e,t,0);this._gpCFtr._updateContent(e,t,0)}if(d&&this._errorTip&&this._errorTip._tips.length){clearTimeout(this._toErrorTips);this._toErrorTips=setTimeout((function(){var e=i._errorTip;if(e){e.hide();for(var t=e._tips,o=0;o<t.length;o++){var n=t[o].element;if(!n.offsetHeight||!wijmo_1.hasClass(n,"wj-state-invalid")){e.setTooltip(n,null);o--}}}}),250)}if(this._useFrozenDiv()){this._updateFrozenCells(t);_&&wijmo_1.hasClass(_,"wj-frozen")&&(_=null)}this._fCt.style.display=this._fCt.childElementCount?"":"none";this._activeCell=_;if(c)if(c!=o&&c!=this._eFocus&&wijmo_1.contains(n,c)&&!wijmo_1.contains(l,c)){wijmo_1.getActiveElement()!==c&&c.focus();if(wijmo_1.isIE()&&c instanceof HTMLInputElement&&!c.type.match(/checkbox|radio|range/i)){var f=c.selectionStart,g=c.selectionEnd;c.setSelectionRange(f,g)}}else{var m=_!==r;this._setFocus(m)}!c&&_&&(_.tabIndex=this.isDisabled?-1:this._orgTabIndex);r&&r!=_&&(r.tabIndex=-1);if(this.selectionMode!=SelectionMode.None)this._eFocus.tabIndex=null!=_||this.isDisabled?-1:this._orgTabIndex;else{this._eFocus.tabIndex=-1;this._root.tabIndex=null!=_||this.isDisabled?-1:this._orgTabIndex}a&&this.focus();this._fixScroll();this._rcBounds=null;this._updateMarquee();this.onUpdatedView(u)}};FlexGrid.prototype._fixScroll=function(){var e=this._root;if(!this._updating){var t=this.hostElement,i=e?e.parentElement:null,o=this.rightToLeft;if(t){t.scrollTop&&(t.scrollTop=0);t.scrollLeft&&!o&&(t.scrollLeft=0)}if(i){i.scrollTop&&(i.scrollTop=0);i.scrollLeft&&!o&&(i.scrollLeft=0)}}var n=_getSafariVer();if(e&&n&&14==n.major&&n.minor>=1){e.style.transform="";e.style.transform="translateZ(0)"}};FlexGrid.prototype._clearCells=function(){for(var e in this)if("_"==e[0]){var t=this[e];t instanceof GridPanel&&t._clearCells()}this.invalidate()};FlexGrid.prototype._useFrozenDiv=function(){return wijmo_1.isBoolean(this._fzClone)?this._fzClone:wijmo_1.isIE()||wijmo_1.isFirefox()||wijmo_1.isSafari()||wijmo_1.isMobile()};FlexGrid.prototype._updateFrozenCells=function(e){var t=this._fCt;if(this.rows.frozen||this.columns.frozen){var i=this._eCt.querySelectorAll(".wj-frozen");if(e&&t.children.length==i.length){for(var o=0;o<i.length;o++)t.children[o].className=i[o].className;return}wijmo_1.setText(t,null);if(!this.activeEditor){var n=this._errorTip,l=navigator.userAgent.indexOf("MSIE")>=0;for(o=0;o<i.length;o++){var r=i[o];if(wijmo_1.closest(r,".wj-flexgrid")==this.hostElement){var s=r[GridPanel._INDEX_KEY],a=r.firstElementChild,c=null;if(s&&a){var u=s.panel,d=this._getBindingColumn(u,s.row,u.columns[s.col]);c=wijmo_1.isFunction(d.cellTemplate)?a.onclick:null}if(l){var h="input[type=checkbox]",_=r.querySelector(h);r=r.cloneNode(!0);if(_){r.querySelector(h).checked=_.checked}}else r=r.cloneNode(!0);a=r.firstElementChild;c&&a&&(a.onclick=c);r[GridPanel._INDEX_KEY]=s;if(n){var p=n.getTooltip(i[o]);p&&n.setTooltip(r,p)}t.appendChild(r)}}}}else wijmo_1.setText(t,null)};FlexGrid.prototype._updateMarquee=function(){var e=this._eMarquee,t=this._getMarqueeRect();if(t&&t.width&&t.height){var i=this.cells.hostElement,o=e.firstChild,n=e.offsetWidth-o.offsetWidth,l=e.offsetHeight-o.offsetHeight;wijmo_1.setCss(e,{width:t.width+n,height:t.height+l,top:t.top+i.offsetTop-l/2,left:t.left+i.offsetLeft-n/2,display:""})}else e.style.display="none"};FlexGrid.prototype._hideMarquee=function(){var e=this._eMarquee;wijmo_1.setCss(e,{display:"none"})};FlexGrid.prototype._getMarqueeRect=function(){if(!this._shMarquee||!this.selectionMode)return null;var e=this._selHdl.selection;if(!this.isRangeValid(e))return null;e=(e=(e=this.cells._getAdjustedSelection(e)).combine(this.getMergedRange(this.cells,e.topRow,e.leftCol,!1))).combine(this.getMergedRange(this.cells,e.bottomRow,e.rightCol,!1));var t=this.cells.getCellBoundingRect(e.topRow,e.leftCol,!0),i=this.cells.getCellBoundingRect(e.bottomRow,e.rightCol,!0);if(this.rows.frozen){var o=Math.min(this.rows.length,this.rows.frozen),n=this.cells.getCellBoundingRect(o-1,0,!0);e.topRow>=o&&t.top<n.bottom&&(t.top=n.bottom);e.bottomRow>=o&&i.bottom<n.bottom&&(i.height=n.bottom-i.top)}if(this.columns.frozen){var l=Math.min(this.columns.length,this.columns.frozen);n=this.cells.getCellBoundingRect(0,l-1,!0);if(this.rightToLeft){e.leftCol>=l&&t.right>n.left&&(t.left=n.left-t.width);e.rightCol>=l&&i.left>n.left&&(i.left=n.left)}else{e.leftCol>=l&&t.left<n.right&&(t.left=n.right);e.rightCol>=l&&i.right<n.right&&(i.width=n.right-i.left)}}return this.rightToLeft?new wijmo_1.Rect(i.left,t.top,t.right-i.left,i.bottom-t.top):new wijmo_1.Rect(t.left,t.top,i.right-t.left,i.bottom-t.top)};FlexGrid.prototype._bindColumns=function(){for(var e=this.columns,t=0;t<e.length;t++){if(e[t]._getFlag(RowColFlags.AutoGenerated)){e.removeAt(t);t--}}var i=this._cv,o=i?i.items:null;o&&o.length&&this.autoGenerateColumns&&this._getColumnTypes(o).forEach((function(t){var i=new Column(t);i._setFlag(RowColFlags.AutoGenerated,!0);i.name=i.binding;i.header=wijmo_1.toHeaderCase(i.binding);var o=FlexGrid._defTypeWidth[i.dataType];if(null!=o){if(wijmo_1.isString(o)){var n=Math.round(parseFloat(o));o=o.indexOf("*")>-1?n*e.defaultSize:n}wijmo_1.isNumber(o)&&o>0&&(i.width=o)}e.push(i)}));this._updateColumnTypes()};FlexGrid.prototype._getColumnTypes=function(e){return wijmo_1.getTypes(e)};FlexGrid.prototype._updateColumnTypes=function(){var e=this._cv;if(wijmo_1.hasItems(e)){var t=e.items[0];this.columns.forEach((function(e){null==e.dataType&&e._binding&&(e.dataType=wijmo_1.getType(e._binding.getValue(t)))}))}};FlexGrid.prototype._getMapEditor=function(e,t){return t.editor?null!=t.editor.isDroppedDown?t.dataMapEditor:null:!e.dataMap||e instanceof GroupRow?t.dataMap?t.dataMapEditor:null:e.dataMapEditor};FlexGrid.prototype._getBindingColumn=function(e,t,i){return i};FlexGrid.prototype._getBindingColumns=function(){return this.columns};FlexGrid.prototype._getRowsPerItem=function(){return 1};FlexGrid.prototype._isTransposed=function(){return!1};FlexGrid.prototype._getRowHeaderPath=function(){return this._rowHdrPath};FlexGrid.prototype._bindRows=function(){this.rows.clear();var e=this._cv;if(e&&e.items){var t=e.items,i=e.groups;if(this.childItemsPath)for(var o=0;o<t.length;o++)this._addNode(t,o,0);else if(null!=i&&i.length>0&&this.showGroups)for(o=0;o<i.length;o++)this._addGroup(i[o]);else for(o=0;o<t.length;o++)this._addBoundRow(t,o)}};FlexGrid.prototype._addBoundRow=function(e,t){var i=new Row(e[t]),o=this.rows;i._list=o;o[o.length++]=i};FlexGrid.prototype._addGroupRow=function(e){this.rows.push(new GroupRow(e))};FlexGrid.prototype._addNode=function(e,t,i){var o=e[t],n=this.childItemsPath,l=o[wijmo_1.isArray(n)?n[i]:n],r=new GroupRow(o);r.level=i;this.rows.push(r);if(wijmo_1.isArray(l))for(var s=0;s<l.length;s++)this._addNode(l,s,i+1)};FlexGrid.prototype._addGroup=function(e){this._addGroupRow(e);if(e.isBottomLevel)for(var t=e.items,i=0;i<t.length;i++)this._addBoundRow(t,i);else for(i=0;i<e.groups.length;i++)this._addGroup(e.groups[i])};FlexGrid._getSerializableProperties=function(e){var t=[];for(e=e.prototype;e!=Object.prototype;e=Object.getPrototypeOf(e))for(var i=Object.getOwnPropertyNames(e),o=0;o<i.length;o++){var n=i[o],l=Object.getOwnPropertyDescriptor(e,n);l&&l.set&&l.get&&"_"!=n[0]&&!n.match(/^(disabled|required|showDropDown)$/)&&t.push(n)}return t};FlexGrid.prototype._hasColumnGroups=function(){return this._grpHdl.hasColumnGroups()};FlexGrid.prototype._getColumnGroup=function(e,t){return this._grpHdl.getColumnGroup(e,t)};FlexGrid.prototype._canMoveColumnGroup=function(e,t,i,o){return this._grpHdl.canMoveColumnGroup(e,t,i,o)};FlexGrid.prototype._moveColumnGroup=function(e,t,i,o,n){return this._grpHdl.moveColumnGroup(e,t,i,o,n)};FlexGrid.prototype._copy=function(e,t){var i=this;if("columns"==e){var o=wijmo_1.asArray(t);if(o.some((function(e){return null!=e.columns})))this.columnGroups=o;else{this.columns.clear();o.forEach((function(e){var t=new Column(e);i.columns.push(t)}))}return!0}return!1};FlexGrid.prototype._isInputElement=function(e){return e instanceof HTMLElement&&!wijmo_1.hasClass(e,"wj-btn-glyph")&&("true"==e.contentEditable||null!=e.tagName.match(/^(INPUT|TEXTAREA|BUTTON|A|SELECT|OPTION)$/i))};FlexGrid.prototype._isNativeCheckbox=function(e){return e instanceof HTMLInputElement&&"checkbox"==e.type&&!e.disabled&&!e.readOnly&&wijmo_1.hasClass(e,CellFactory._WJC_CHECKBOX)&&wijmo_1.closest(e,".wj-flexgrid")==this.hostElement};FlexGrid.prototype._wantsInput=function(e){return this._isInputElement(e)&&!this.activeEditor&&!this._isNativeCheckbox(e)&&!wijmo_1.hasClass(e,"wj-grid-ime")&&wijmo_1.contains(document.body,e)};FlexGrid._getMaxSupportedCssHeight=function(){if(!FlexGrid._maxCssHeight){var e=265e5;wijmo_1.isIE()?e=15e5:wijmo_1.isFirefox()&&(e=175e5);FlexGrid._maxCssHeight=e}return FlexGrid._maxCssHeight};FlexGrid._getRtlMode=function(){if(!FlexGrid._rtlMode){var e=wijmo_1.createElement('<div dir="rtl"><div></div></div>');wijmo_1.setCss(e,{visibility:"hidden",width:100,height:100,overflow:"auto"});wijmo_1.setCss(e.firstChild,{width:2e3,height:2e3});document.body.appendChild(e);var t=e.scrollLeft;e.scrollLeft=-1e3;var i=e.scrollLeft;wijmo_1.removeChild(e);FlexGrid._rtlMode=i<0?"neg":t>0?"rev":"std"}return FlexGrid._rtlMode};FlexGrid.prototype.getEmptyRequiredCell=function(e){return this._getEmptyRequiredCell(e)};FlexGrid.prototype._getEmptyRequiredCell=function(e){if(e>=0)for(var t=0;t<this.columns.length;t++){var i=this.getCellData(e,t,!1);if(this.columns[t].getIsRequired(this.rows[e])&&(""===i||null==i)){if(!this.columns[t].isReadOnly)return t;console.warn("Incorrect data. Column "+t+" is at the same time required, empty and read-only")}}return null};FlexGrid.prototype.adjustFrozenRowColSize=function(e,t,i){var o=t===FrozenRowCol.Column,n=o?this.columns:this.rows,l=o?this.columns.frozen:this.rows.frozen,r=o?this._szClient.width:this._szClient.height;if(!(e<0||e>=n.length||e>=l)){for(var s=0,a=0;a<l;a++)a!==e&&(s+=n[a].size||n[a].renderSize);var c=r-s-5,u=(n[e].size||n[e].renderSize)+i;u>c&&(u=c);n[e].size=u}};FlexGrid._WJS_STICKY="wj-state-sticky";FlexGrid._WJS_MEASURE="wj-state-measuring";FlexGrid._WJS_UPDATING="wj-state-updating";FlexGrid._WJS_WSPRE="wj-whitespace-pre";FlexGrid._MIN_VIRT_ROWS=200;FlexGrid._defTypeWidth=((_a={})[wijmo_1.DataType.Number]="0.714285714*",_a);FlexGrid.controlTemplate='<div> <div wj-part="ch"><div wj-part="chcells" class="wj-colheaders"></div></div><div wj-part="root"><div wj-part="cells" class="wj-cells"></div><div wj-part="marquee" class="wj-marquee"><div></div></div></div><div wj-part="fcells" aria-hidden="true" class="wj-cells wj-frozen-clone"></div><div wj-part="rh"><div wj-part="rhcells" class="wj-rowheaders"></div></div><div wj-part="cf"><div wj-part="cfcells" class="wj-colfooters"></div></div><div wj-part="bl"><div wj-part="blcells" class="wj-bottomleft"></div></div><div wj-part="tl"><div wj-part="tlcells" class="wj-topleft"></div></div><div wj-part="focus" class="wj-cell">0</div><div wj-part="sz"></div></div>';return FlexGrid}(wijmo_1.Control);exports.FlexGrid=FlexGrid;var _ImeHandler=function(){function _ImeHandler(e){var t=this;this._updateImeFocusAsyncBnd=this._updateImeFocusAsync.bind(this);this._cmpstartBnd=this._compositionstart.bind(this);this._keypressBnd=this._keypress.bind(this);this._g=e;var i=wijmo_1.createElement('<textarea class="wj-grid-editor wj-form-control wj-grid-ime" aria-hidden="true"/>');wijmo_1.setCss(i,_ImeHandler._cssHidden);wijmo_1.disableAutoComplete(i);i.tabIndex=-1;this._tbx=i;this._maskProvider=new wijmo_1._MaskProvider(i);e._root.appendChild(i);this._updateImeFocus();var o=e.hostElement,n=e.addEventListener.bind(e),l=this._updateImeFocusAsyncBnd;n(o,"blur",l,!0);n(o,"focus",l,!0);n(i,"compositionstart",this._cmpstartBnd);wijmo_1.isiOS()&&n(o,"keypress",this._keypressBnd);e.selectionChanged.addHandler(l,this);e.cellEditEnded.addHandler(this._cellEditEnded,this);e.cellEditEnding.addHandler(this._cellEditEnding,this);n(o,"mousedown",(function(t){wijmo_1.closest(wijmo_1.getActiveElement(),".wj-flexgrid")==e.hostElement&&e.hitTest(t).panel==e.cells&&wijmo_1.hasClass(e.hitTest(t).target,"wj-cell")&&(e.isReadOnly||t.preventDefault())}));e.gotFocus.addHandler((function(){return t._updateImeFocus()}))}_ImeHandler.prototype.dispose=function(){var e=this._g,t=e.hostElement,i=this._tbx,o=e.removeEventListener.bind(e),n=this._updateImeFocusAsyncBnd;o(t,"blur",n);o(t,"focus",n);o(t,"keypress",this._keypressBnd);o(i,"compositionstart",this._cmpstartBnd);e.selectionChanged.removeHandler(n);e.cellEditEnded.removeHandler(this._cellEditEnded);e.cellEditEnding.removeHandler(this._cellEditEnding);wijmo_1.removeChild(i)};_ImeHandler.prototype._compositionstart=function(e){var t=this,i=this._g;if(!i.activeEditor){var o=i._selHdl.selection;if(i.startEditing(!1,o.row,o.col,!1,e)){if(i.activeEditor&&"checkbox"!=i.activeEditor.type){o=i.editRange;var n=i._getBindingColumn(i.cells,o.row,i.columns[o.col]),l=n&&n._edt,r=i.activeEditor,s=this._tbx,a=i.cells.hostElement,c=i.columns[o.col].pos+a.offsetLeft,u=i.rows[o.row].pos+a.offsetTop,d=i.getCellBoundingRect(o.row,o.col),h=i.cells.getCellElement(o.row,o.col);d.width=h.offsetWidth;d.height=h.offsetHeight;o.row<i.rows.frozen&&(u+=i._root.scrollTop);o.col<i.columns.frozen&&(c+=i._root.scrollLeft);var _=h.querySelector(".wj-btn.wj-right");_&&(d.width-=_.offsetWidth);"minLength,maxLength,pattern".split(",").forEach((function(e){wijmo_1.setAttribute(s,e,r.getAttribute(e))}));var p=r instanceof HTMLTextAreaElement;wijmo_1.setAttribute(s,"wrap",p?"soft":"off");var f=getComputedStyle(h),g=f.paddingTop;if(o.rowSpan>1&&!p){var m=parseFloat(f.lineHeight);isNaN(m)&&(m=1.2*parseFloat(f.fontSize));g=Math.max(0,(d.height-m)/2)+"px"}var w={position:"absolute",left:c,top:u,width:d.width-1,height:d.height-1,paddingTop:g,paddingLeft:f.paddingLeft,paddingRight:f.paddingRight,textAlign:f.textAlign,zIndex:h.style.zIndex};if(i.rightToLeft){w.right=parseInt(h.style.right)+parseInt(i.cells.hostElement.style.right);w.left=""}wijmo_1.setCss(s,w);if(l){var C=l._tbx.getBoundingClientRect(),v=s.getBoundingClientRect(),y=window.getComputedStyle(s),b=parseFloat(y.left),R=parseFloat(y.right),j=parseFloat(y.top);i.rightToLeft?wijmo_1.setCss(s,{right:R+v.right-C.right+"px",top:j+C.top-v.top+"px",width:C.width+"px",height:C.height+"px"}):wijmo_1.setCss(s,{left:b+C.left-v.left+"px",top:j+C.top-v.top+"px",width:C.width+"px",height:C.height+"px"})}i._edtHdl._edt=s;s.select();var E=r.value;if(wijmo_1.isSafari()){" "!=s.value&&" "!=s.value||(s.value=E);wijmo_1.setSelectionRange(s,s.value.length)}else setTimeout((function(){" "!=s.value&&" "!=s.value||(s.value=E);wijmo_1.setSelectionRange(s,s.value.length)}),20);wijmo_1.Control.sharedState.InvalidScroll=wijmo_1.isEdge();s.placeholder=r.placeholder;r.placeholder="";r.value=""}}else{this._tbx.blur();setTimeout((function(){t._tbx.focus();i._setFocusNoScroll(i.hostElement)}),20)}}};_ImeHandler.prototype._cellEditEnding=function(){var e=this._maskProvider;e&&e.mask&&e._valueChanged()};_ImeHandler.prototype._cellEditEnded=function(){var e=this._tbx,t=this._g;if(this._enableIme()){var i=wijmo_1.getActiveElement();i.blur();if(t._isScrollingByWheel)setTimeout((function(){i.focus();t._setFocusNoScroll(t.hostElement);e.value="";i.focus()}),20);else{i.focus();t._setFocusNoScroll(t.hostElement);i.focus()}}e.value="";wijmo_1.setCss(e,_ImeHandler._cssHidden);this._updateImeFocus()};_ImeHandler.prototype._keypress=function(e){if(!e.defaultPrevented&&e.target==this._tbx&&!(e.ctrlKey||e.altKey||e.metaKey||27==e.keyCode||this._g.activeEditor)){this._tbx.value="";this._compositionstart(e);e.stopPropagation()}};_ImeHandler.prototype._updateImeFocus=function(){var e=this._g,t=this._tbx,i=wijmo_1.getActiveElement(),o=e._getTabIndex();if(e.activeEditor||wijmo_1.closest(i,".wj-flexgrid")!=e.hostElement)(e.isDisabled||o<0)&&t.tabIndex>=0&&(t.tabIndex=-1);else if(this._enableIme()&&!e._wantsInput(i)){if(i!=t){e.activeCell&&(e.activeCell.tabIndex=-1);t.tabIndex=o;t.disabled=!1;t.value="";if(!e.isTouching)if(window&&window.top!=window.self){wijmo_1.setSelectionRange(t,0,0,!1);e._setFocusNoScroll(t)}else{wijmo_1.setSelectionRange(t,0);t.focus()}}var n=e._selHdl.selection,l=n.isValid?e._getBindingColumn(e.cells,n.row,e.columns[n.col]):null;this._maskProvider.mask=l?l.mask:null}else{t.tabIndex=-1;t.disabled=!0;t.value="";if(i==t){t.blur();var r=e.activeCell;if(r){r.tabIndex=o;r.focus()}else e.focus()}}};_ImeHandler.prototype._updateImeFocusAsync=function(){var e=this;this._toFocus&&clearTimeout(this._toFocus);this._toFocus=setTimeout((function(){e._toFocus=null;e._updateImeFocus()}),100)};_ImeHandler.prototype._resetTabIndex=function(){this._tbx.tabIndex=-1};_ImeHandler.prototype._enableIme=function(){var e=this._g,t=e._selHdl.selection;if(!e.canEditCell(t.row,t.col))return!1;var i=t.isValid?e._getBindingColumn(e.cells,t.row,e.columns[t.col]):null;return!(!i||i.dataType==wijmo_1.DataType.Boolean)&&(!i||!i.dataMap||i.dataMapEditor!=DataMapEditor.RadioButtons)};_ImeHandler._cssHidden={position:"fixed",width:"1px",left:-32e3,top:-32e3,overflow:"hidden"};return _ImeHandler}();exports._ImeHandler=_ImeHandler;var _AddNewHandler=function(){function _AddNewHandler(e){this._nrt=new _NewRowTemplate;this._top=!1;this._keydownBnd=this._keydown.bind(this);this._committing=!1;this._pasting=!1;this._g=e;this._attach()}Object.defineProperty(_AddNewHandler.prototype,"newRowAtTop",{get:function(){return this._top},set:function(e){if(e!=this.newRowAtTop){this._top=wijmo_1.asBoolean(e);this.updateNewRowTemplate();var t=this._g;if(this._top&&t.selectionMode==SelectionMode.ListBox){t.rows.forEach((function(e,t){e._setFlag(RowColFlags.Selected,0==t,!0)}));t.select(0,t.selection.col)}}},enumerable:!0,configurable:!0});_AddNewHandler.prototype.updateNewRowTemplate=function(){var e=this._g,t=e.editableCollectionView,i=e.rows,o=this._nrt,n=t&&t.canAddNew&&e.allowAddNew&&!e.isReadOnly,l=i.indexOf(o),r=this._top?0:i.length-1,s=!1;if(!n&&l>-1){var a=e.selection;a.row==l&&e.select(a.row-1,a.col);i.removeAt(l)}else if(n){if(l<0)s=!0;else if(l!=r){i.removeAt(l);s=!0}s&&(this._top?i.insert(0,o):i.push(o));if(o){o._ubv=null;o._setFlag(RowColFlags.ParentCollapsed,!1);this._top&&e.selectionMode==SelectionMode.ListBox||o._setFlag(RowColFlags.Selected,!1)}}};_AddNewHandler.prototype._attach=function(){var e=this._g;if(e){e.pasting.addHandler(this._pastingData,this);e.pasted.addHandler(this._pastedData,this);e.loadedRows.addHandler(this.updateNewRowTemplate,this);e.hostElement.addEventListener("keydown",this._keydownBnd,!0)}};_AddNewHandler.prototype._detach=function(){var e=this._g;if(e){e.pasting.removeHandler(this._pastingData,this);e.pasted.removeHandler(this._pastedData,this);e.loadedRows.removeHandler(this.updateNewRowTemplate);e.hostElement.removeEventListener("keydown",this._keydownBnd,!0)}};_AddNewHandler.prototype._keydown=function(e){if(!e.defaultPrevented&&e.keyCode==wijmo_1.Key.Escape&&null==this._g.activeEditor&&this._top&&this._nrt.dataItem){this._nrt.dataItem=null;this._g.invalidate()}};_AddNewHandler.prototype._beginningEdit=function(e,t){if(!t.cancel){var i=e.rows[t.row];i instanceof _NewRowTemplate&&this._handleEditStarting(e,t,i)}};_AddNewHandler.prototype._pastingData=function(e,t){t.cancel||(this._pasting=!0)};_AddNewHandler.prototype._pastedData=function(e,t){this._pasting=!1};_AddNewHandler.prototype._rowEditStarting=function(e,t){if(this._pasting){var i=e.rows[t.row];i instanceof _NewRowTemplate&&this._handleEditStarting(e,t,i)}};_AddNewHandler.prototype._rowEditEnding=function(e,t){var i=e.editableCollectionView,o=this._nrt.dataItem;if(i&&this._top&&o&&!t.cancel){var n=i.currentAddItem;if(!(n&&n==o)){n=i.addNew();for(var l in o)n[l]=o[l]}}};_AddNewHandler.prototype._rowEditEnded=function(e,t){var i=this,o=e.editableCollectionView;if(o&&!this._committing)if(this._top){if(t.cancel)return;var n=this._nrt.dataItem;if(n){this._committing=!0;this._nrt.dataItem=null;var l=this._g.rows,r=o.items.indexOf(n)+1;r<l.length&&t._rng.setRange(r,-1);e.onRowAdded(t)?o.commitNew():o.cancelNew();this._committing=!1}var s=e.rows[t.row];setTimeout((function(){s instanceof _NewRowTemplate&&e.select(0,e.columns.firstVisibleIndex);i.updateNewRowTemplate()}),20)}else o.isAddingNew&&o.commitNew()};_AddNewHandler.prototype._handleEditStarting=function(e,t,i){var o=e.editableCollectionView;if(o&&o.canAddNew)if(this._top)if(null==this._nrt.dataItem){var n=null,l=o.sourceCollection,r=o.newItemCreator;n=wijmo_1.isFunction(r)?r():l&&l.length?new l[0].constructor:{};this._nrt.dataItem=n}else o.currentAddItem&&(e.onRowAdded(t)||o.cancelNew());else{n=o.currentAddItem&&o.currentAddItem==i.dataItem?o.currentAddItem:o.addNew();o.moveCurrentTo(n);var s=this._nrt.isSelected;this.updateNewRowTemplate();s&&t.row>-1&&(e.rows[t.row].isSelected=!0);e.isUpdating||e.refresh(!0);e.onRowAdded(t)||o.cancelNew()}};return _AddNewHandler}();exports._AddNewHandler=_AddNewHandler;var AllowMerging,_NewRowTemplate=function(e){__extends(_NewRowTemplate,e);function _NewRowTemplate(){return null!==e&&e.apply(this,arguments)||this}return _NewRowTemplate}(Row);exports._NewRowTemplate=_NewRowTemplate;!function(e){e[e.None=0]="None";e[e.Cells=1]="Cells";e[e.ColumnHeaders=2]="ColumnHeaders";e[e.RowHeaders=4]="RowHeaders";e[e.AllHeaders=6]="AllHeaders";e[e.All=7]="All"}(AllowMerging=exports.AllowMerging||(exports.AllowMerging={}));var MergeManager=function(){function MergeManager(e){null!=e&&console.error('** WARNING: the "grid" parameter has been deprecated. Please remove it.')}MergeManager.prototype.getMergedRange=function(e,t,i,o){void 0===o&&(o=!0);var n=e.grid,l=e.cellType,r=e.columns,s=e.rows,a=s[t],c=r[i];if(a instanceof _NewRowTemplate)return null;if(!(a instanceof Row&&c instanceof Column))return null;if(e==n.columnHeaders){var u=n._getColumnGroup(t,i);if(u){var d=u._rng,h=e.columns;if(h.isFrozen(d.col)!=h.isFrozen(d.col2)){d=d.clone();h.isFrozen(i)?d.col2=h.frozen-1:d.col=h.frozen}return d}}if(n.showGroups&&!n.childItemsPath&&a instanceof GroupRow&&a.dataItem instanceof wijmo_1.CollectionViewGroup&&l==CellType.Cell){d=new CellRange(t,i);if(c.aggregate==wijmo_1.Aggregate.None){for(;d.col>0&&r[d.col-1].aggregate==wijmo_1.Aggregate.None&&d.col!=r.frozen;)d.col--;for(;d.col2<r.length-1&&r[d.col2+1].aggregate==wijmo_1.Aggregate.None&&d.col2+1!=r.frozen;)d.col2++}for(;d.col<i&&!r[d.col].visible;)d.col++;return d.isSingleCell?null:d}var _=!1,p=AllowMerging,f=CellType;switch(n.allowMerging){case p.None:_=!0;break;case p.Cells:_=l!=f.Cell;break;case p.ColumnHeaders:_=l!=f.ColumnHeader&&l!=f.TopLeft;break;case p.RowHeaders:_=l!=f.RowHeader&&l!=f.TopLeft;break;case p.AllHeaders:_=l==f.Cell}if(_)return null;if(l==f.Cell){var g=n.editableCollectionView,m=g?g.currentAddItem:null;if(m&&a.dataItem==m)return null}if(r[i].allowMerging){d=new CellRange(t,i);var w=e._vrb,C=0,v=s.length-1;if(t>=s.frozen){if(o&&(l==CellType.Cell||l==CellType.RowHeader)&&n._vtRows<s.length&&w){C=w.topRow;v=w.bottomRow}}else s.length>s.frozen&&(v=s.frozen-1);for(var y=t-1;y>=C&&this._mergeCell(e,y,i,t,i);y--)d.row=y;for(var b=t+1;b<=v&&this._mergeCell(e,t,i,b,i);b++)d.row2=b;for(;d.row<t&&!s[d.row].visible;)d.row++;if(!d.isSingleCell)return d}if(s[t].allowMerging){d=new CellRange(t,i),w=e._vrb;var R=0,j=r.length-1;if(i>=r.frozen){if(o&&(l==CellType.Cell||l==CellType.ColumnHeader)&&n._vtCols<r.length&&w){R=w.leftCol;j=w.rightCol}}else j=r.frozen-1;for(var E=i-1;E>=R&&this._mergeCell(e,t,E,t,i);E--)d.col=E;for(var x=i+1;x<=j&&this._mergeCell(e,t,i,t,x);x++)d.col2=x;for(;d.col<i&&!r[d.col].visible;)d.col++;if(!d.isSingleCell)return d}return null};MergeManager.prototype._mergeCell=function(e,t,i,o,n){var l=e.rows[t],r=e.rows[o];if(!l||!r)return!1;if(l instanceof GroupRow||l instanceof _NewRowTemplate||r instanceof GroupRow||r instanceof _NewRowTemplate)return!1;var s=e.grid.editableCollectionView,a=s?s.currentAddItem:null;if(a&&(l.dataItem==a||r.dataItem==a))return!1;if(t!=o&&e.rows.isFrozen(t)!=e.rows.isFrozen(o))return!1;if(i!=n&&e.columns.isFrozen(i)!=e.columns.isFrozen(n))return!1;if(t!=o){if(i>0&&(l.allowMerging&&this._mergeCell(e,t,i-1,t,i)||r.allowMerging&&this._mergeCell(e,o,i-1,o,i)))return!1;if(n<e.columns.length-1&&(l.allowMerging&&this._mergeCell(e,t,n,t,n+1)||r.allowMerging&&this._mergeCell(e,o,n,o,n+1)))return!1}return e.getCellData(t,i,!0)==e.getCellData(o,n,!0)};return MergeManager}();exports.MergeManager=MergeManager;var HitTestInfo=function(){function HitTestInfo(e,t){this._row=-1;this._col=-1;this._edge=0;this._clickChildGrid=!1;var i;if(t instanceof Element){if(wijmo_1.closest(t,".wj-flexgrid")!=e.hostElement)return;e=t;this._target=t}if(!(e instanceof Element)||e instanceof FlexGrid){if(e instanceof FlexGrid){this._target=e.hostElement;i=this._g=e}else{if(!(e instanceof GridPanel))throw"First parameter should be a FlexGrid or GridPanel.";this._target=e.hostElement;this._p=e;i=this._g=this._p.grid}if(t instanceof MouseEvent){this._target=t.target;var o=wijmo_1.closest(this._target,".wj-flexgrid");"mousedown"==t.type&&null!=o&&e instanceof FlexGrid&&o!=e.hostElement&&(this._clickChildGrid=!0);"mousedown"==t.type&&(i._rcBounds=null)}t=wijmo_1.mouseToPage(t);this._pt=t.clone();var n=i.controlRect,l=i._szClient,r=i.topLeftCells,s=i._eTL,a=i.headersVisibility,c=HeadersVisibility,u=a&c.Row?r.columns.getTotalSize():0,d=a&c.Column?r.rows.getTotalSize():0,h=a&c.Column?d+s.offsetTop:0,_=i._eBL,p=_.offsetHeight,f=getComputedStyle(i.hostElement),g=f&&f.borderLeftWidth?parseFloat(f.borderLeftWidth):0,m=f&&f.borderTopWidth?parseFloat(f.borderTopWidth):0;t.x-=n.left-g;t.y-=n.top-m;i.rightToLeft&&(t.x=n.width-t.x);this._p||t.x>=0&&t.y>=s.offsetTop&&l&&t.x<=l.width+u&&t.y<=l.height+d&&(t.y<h?this._p=t.x<u?i.topLeftCells:i.columnHeaders:t.y<_.offsetTop?this._p=t.x<u?i.rowHeaders:i.cells:this._p=t.x<u?i.bottomLeftCells:i.columnFooters);if(null!=this._p){var w=this._p.rows,C=this._p.columns,v=this._p.cellType,y=CellType,b=this._p._getFrozenPos(),R=v==y.TopLeft||v==y.ColumnHeader?d:v==y.BottomLeft||v==y.ColumnFooter?p:w.getTotalSize(),j=v==y.TopLeft||v==y.BottomLeft||v==y.RowHeader?u:C.getTotalSize();if(v==y.RowHeader||v==y.Cell){t.y-=d;if(t.y>b.y||b.y<=0){t.y-=i._ptScrl.y;t.y+=this._p._getOffsetY()}}else v!=y.BottomLeft&&v!=y.ColumnFooter||(t.y-=_.offsetTop);if(v==y.ColumnHeader||v==y.Cell||v==y.ColumnFooter){t.x-=u;(t.x>b.x||b.x<=0)&&(t.x-=i._ptScrl.x)}v!=y.ColumnHeader&&v!=y.TopLeft||(t.y-=h-d);this._edge=0;var E=HitTestInfo._SZEDGE[this._g.isTouching?1:0];if(this._g.isTouching){E=HitTestInfo._SZEDGE[1];t.x-=E/2}this._row=t.y>R?-1:w.getItemAt(t.y);this._col=t.x>j?-1:C.getItemAt(t.x);if(this._row<0||this._col<0){this._p=null;return}if(this._col>-1){var x=C[this._col];t.x-x.pos<=E&&(this._edge|=1);var S=x.pos+x.renderSize-t.x;if(S<=E){this._edge|=4;S<=E/2&&(this._edge|=16)}}if(this._row>-1){var H=w[this._row];t.y-H.pos<=E&&(this._edge|=2);var M=H.pos+H.renderSize-t.y;if(M<=E){this._edge|=8;M<=E/2&&(this._edge|=32)}}}}else{var F=wijmo_1.closest(e,".wj-cell"),G=F?F[GridPanel._INDEX_KEY]:null;if(G){this._target=e;this._row=G.row;this._col=G.col;this._rng=G.rng;this._p=G.panel;this._g=G.panel.grid}}}Object.defineProperty(HitTestInfo.prototype,"point",{get:function(){return this._pt},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"cellType",{get:function(){return this._p?this._p.cellType:CellType.None},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"panel",{get:function(){return this._p},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"grid",{get:function(){return this._p?this._p.grid:null},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"row",{get:function(){return this._row},enumerable:!0,configurable:!0});HitTestInfo.prototype.getRow=function(){return this._p&&this._row>-1?this._p.rows[this._row]:null};Object.defineProperty(HitTestInfo.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});HitTestInfo.prototype.getColumn=function(e){var t=this._p,i=t&&this._col>-1?t.columns[this._col]:null;if(i&&e){var o=t.grid;i=t.cellType===CellType.ColumnHeader&&o._hasColumnGroups()?o._getColumnGroup(this._row,this._col):o._getBindingColumn(t,this._row,i)}return i};Object.defineProperty(HitTestInfo.prototype,"range",{get:function(){this._rng||(this._rng=new CellRange(this._row,this._col));return this._rng},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"edgeLeft",{get:function(){return 0!=(1&this._edge)},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"edgeTop",{get:function(){return 0!=(2&this._edge)},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"edgeRight",{get:function(){return 0!=(4&this._edge)},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"edgeFarRight",{get:function(){return 0!=(16&this._edge)},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"edgeBottom",{get:function(){return 0!=(8&this._edge)},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"edgeFarBottom",{get:function(){return 0!=(32&this._edge)},enumerable:!0,configurable:!0});Object.defineProperty(HitTestInfo.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});HitTestInfo._SZEDGE=[6,30];return HitTestInfo}();exports.HitTestInfo=HitTestInfo;function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;var _MASK_PROVIDER="$WJ-MSKP",CellFactory=function(){function CellFactory(){}CellFactory.prototype.updateCell=function(e,t,i,o,n,l){var r=e.grid,s=r.rightToLeft,a=e.rows,c=e.columns,u=a[t],d=c[i],h=t,_=i,p=u instanceof GroupRow?u:null,f=u instanceof _NewRowTemplate?u:null,g=d.renderWidth,m=u.renderHeight,w=e.cellType,C="wj-cell",v="",y={display:""},b=CellType;0!=l&&o.firstElementChild&&(1==o.childNodes.length&&"checkbox"==o.firstElementChild.type||(o.textContent=""));if(n&&!n.isSingleCell){t=n.row;i=n.col;h=n.row2;_=n.col2;u=a[t];d=c[i];p=u instanceof GroupRow?u:null;m=(I=n.getRenderSize(e)).height;g=I.width}var R,j,E,x,S,H,M=r._getBindingColumn(e,t,d),F=M?M.dataType:u?u.dataType:void 0;E=w==b.RowHeader||w==b.Cell&&(!p||r.childItemsPath);H=M&&M.isContentHtml||u&&u.isContentHtml;R=M.dataMap||u.dataMap,j=w==b.Cell?r._getMapEditor(u,M):null;x=E&&j==DataMapEditor.RadioButtons;S=F==wijmo_1.DataType.Boolean&&!R;var G=d.pos,T=u.pos,P=r._ptScrl;if(r._useFrozenDiv()&&w==b.Cell&&!r.editRange)i<c.frozen&&h>=a.frozen?T+=P.y:t<a.frozen&&_>=c.frozen&&(G+=P.x);else{var I=r._szClient;if(h<a.frozen){T=Math.min(T,I.height);m=Math.min(m,Math.max(0,I.height-T));T-=P.y}if(_<c.frozen){var A=0!=I.width?I.width:r._preWidth();G=Math.min(G,A);g=Math.min(g,Math.max(0,A-G));G-=P.x}}s?y.right=G+"px":y.left=G+"px";h>=a.frozen&&(T-=e._getOffsetY());y.top=T+"px";y.width=g+"px";y.height=m+"px";y.zIndex=0;i<c.frozen&&(y.zIndex+=1);t<a.frozen&&(y.zIndex+=2);var z=!1,D=r.alternatingRowStep;if(D&&(!n||n.row==n.row2)){z=u.visibleIndex%(D+1)==0;1==D&&(z=!z)}if(w==b.Cell){p&&(C+=" wj-group");z&&(C+=" wj-alt");(t<a.frozen||i<c.frozen)&&(C+=" wj-frozen");f&&(C+=" wj-new");u&&u.cssClass&&(C+=" "+u.cssClass);M&&M.cssClass&&(C+=" "+M.cssClass)}else{C+=" wj-header";z&&(C+=" wj-header-alt");u&&u.cssClass&&w==b.ColumnHeader&&(C+=" "+u.cssClass);M&&M.cssClass&&w==b.RowHeader&&(C+=" "+M.cssClass);var L=!1;w!=b.ColumnHeader&&w!=b.TopLeft||r.allowResizing&AllowResizing.Columns&&(L=null!=r._mouseHdl._getResizeCol(e,_));L||w!=b.RowHeader||r.allowResizing&AllowResizing.Rows&&(L=null!=r._mouseHdl._getResizeRow(e,h));L&&(C+=" wj-big-header")}u&&u.cssClassAll&&(C+=" "+u.cssClassAll);M&&M.cssClassAll&&(C+=" "+M.cssClassAll);var O=SelectedState,N=e.getSelectedState(t,i,n);N!=O.None&&w==b.Cell&&!S&&r.editRange&&r.editRange.contains(t,i)&&(N=O.None);switch(N){case O.Active:C+=" wj-state-active";break;case O.Cursor:C+=" wj-state-selected wj-state-active";break;case O.Selected:C+=" wj-state-multi-selected"}if(h<=a._lastFrozen){C+=" wj-frozen-row";h===a._lastFrozen&&(C+=" wj-last-frozen-row")}_==c._lastFrozen&&(C+=" wj-frozen-col");(M&&M.wordWrap||u&&u.wordWrap)&&(C+=" wj-wrap");(M&&M.multiLine||u&&u.multiLine)&&(C+=" wj-multiline");var k=M?M.getAlignment(u):void 0;k&&(v=" wj-align-"+k);var B=w,V=r._isTransposed(),K=(B==b.ColumnHeader&&!V||B==b.RowHeader&&V)&&r._hasColumnGroups()?r._getColumnGroup(t,i):null;K&&K.align&&(v=" wj-align-"+K.align);y.paddingLeft=y.paddingRight=y.paddingTop=y.paddingBottom="";if(w==b.Cell&&r.rows.maxGroupLevel>-1&&i==c.firstVisibleIndex&&r.treeIndent){var W=p?Math.max(0,p.level):a.maxGroupLevel+1,q=Math.min(r.treeIndent*W+r._cellPadLeft,g-r._cellPadHorz)+"px";s?y.paddingRight=q:y.paddingLeft=q}g<=r._cellPadHorz&&null==o.getAttribute(FlexGrid._WJS_MEASURE)&&(y.paddingLeft=y.paddingRight=0);var U=w==b.Cell&&i==c.firstVisibleIndex&&p&&p.hasChildren&&!_isEditingCell(r,t,i);U&&(v="");if(0!=l&&M){var J=e.getCellData(t,i,!1),Y=e.getCellData(t,i,!0);if(U){var X=_getTreeBtn(p,o);Y=p.getGroupHeader()||wijmo_1.escapeHtml(Y);o.innerHTML=X.outerHTML+" "+Y}else if(w!=b.ColumnHeader||h!=r._getSortRowIndex()&&M==d)if(w==b.RowHeader&&!Y&&function(){var e=!1;if(i==r._getEditColumnIndex()){var t=r.editableCollectionView,n=t?t.currentEditItem:null;Y=o.innerHTML=n&&u.dataItem==n?_getGlyph("pencil"):u instanceof _NewRowTemplate?_getGlyph("asterisk"):"";e=!0}var l=M._tpl;if(l){_renderTemplate(l,o,J,Y,u,M);e=!0}return e}());else if(w!=b.Cell||F!=wijmo_1.DataType.Boolean||R||p&&!wijmo_1.isBoolean(J))if(w==b.Cell&&!x&&_isEditingCell(r,t,i)){var Z=M.inputType||u.inputType;Z||(Z=F!=wijmo_1.DataType.Number||R?"text":"tel");if(!R&&!M.mask&&!u.mask){var $=e.getCellData(t,i,!1);wijmo_1.isNumber($)&&(Y=_getEditString($,M.format||u.format))}o.innerHTML=(M.multiLine||u.multiLine)&&"checkbox"!=Z?'<textarea wrap="soft"></textarea>':'<input type="'+Z+'"/>';var Q=o.children[0];wijmo_1.addClass(Q,"wj-grid-editor wj-form-control");wijmo_1.disableAutoComplete(Q);H&&R&&!R.isEditable&&(Y=wijmo_1.toPlainText(Y));Q.value=Y;Q.tabIndex=-1;Q.required=M.getIsRequired(u);wijmo_1.setAttribute(Q,"aria-required",Q.required);var ee=M.maxLength||u.maxLength;ee&&(Q.maxLength=ee);Q.style.textAlign=M.getAlignment(u);var te=M.mask||u.mask;te&&(Q[_MASK_PROVIDER]=new wijmo_1._MaskProvider(Q,te));r.showPlaceholders&&(Q.placeholder=M.header);(wijmo_1.isSafari()||wijmo_1.Control.sharedState.InvalidScroll)&&r._edtHdl&&r._edtHdl._edt&&(Q.value=r._edtHdl._edt.value);r._edtHdl._edt=Q}else{if(x){var ie=[],oe=e.getCellData(t,i,!1);R.getDisplayValues(u.dataItem).forEach((function(e){var t=R.getKeyValue(e)==oe?" checked":"",i=r.isReadOnly||u.isReadOnly||d.isReadOnly?" disabled":"",o=wijmo_1.escapeHtml(e);ie.push('<label><input type="radio" tabindex="-1"'+t+i+' value="'+o+'"><span>'+o+"</span></label>")}));o.innerHTML=ie.join(" ");C+=" "+CellFactory._WJC_RADIOMAP}var ne=E?M._tpl:null;ne?_renderTemplate(ne,o,J,Y,u,M):x||(w==b.Cell&&H?o.innerHTML=Y:o.textContent=Y||"");if(K&&K.collapseTo){var le=K._rng;if(le&&(w==b.ColumnHeader&&le.columnSpan>1||w==b.RowHeader&&le.rowSpan>1)){var re=K.isCollapsed;o.innerHTML='<div role="button" class="'+CellFactory._WJC_COLLAPSE+'">'+_getGlyph(re?"plus":"minus")+"</div> "+o.innerHTML;re&&wijmo_1.addClass(o,"wj-state-collapsed")}}}else{var se=o.firstChild;if(!r._isNativeCheckbox(se)){o.innerHTML='<label><input type="checkbox" class="'+CellFactory._WJC_CHECKBOX+'" tabindex="-1"/><span></span></label>';se=o.querySelector("input")}wijmo_1.setChecked(se,J);se.disabled=!r.canEditCell(t,i);se.disabled&&(se.style.cursor="default");r.editRange&&r.editRange.contains(t,i)&&(r._edtHdl._edt=se)}else{o.innerHTML=wijmo_1.escapeHtml(Y);var ae=M.currentSort;if(ae&&r.showSort){C+=" wj-sort-"+("+"==ae?"asc":"desc");o.innerHTML+=" "+_getSortGlyph(M)}r.allowPinning&&wijmo_1.contains(r.hostElement,o)&&_addPinButton(o,i<r.columns.frozen)}if(j==DataMapEditor.DropDownList&&r.showDropDown&&r.canEditCell(t,i)&&softInput()){var ce=_getDropDownBtn();o.insertBefore(ce,o.firstChild);_isEditingCell(r,t,i)&&(C+=" wj-hasdropdown")}}if(w==b.RowHeader||w==b.ColumnHeader){var ue=w==b.RowHeader?!p&&!f&&u.allowDragging&&0!=(r.allowDragging&AllowDragging.Rows):(K||d).allowDragging&&0!=(r.allowDragging&AllowDragging.Columns);wijmo_1.setAttribute(o,"draggable",ue?"true":null)}if([b.ColumnHeader,b.RowHeader].includes(w)&&[HeadersFocusability.All,HeadersFocusability.Column].includes(r.headersFocusability)){exports.colHdrAriaAttributes(o,d,e,r,b.RowHeader===w);wijmo_1.setAttribute(e.hostElement.parentElement,"aria-hidden",!1)}C+=v;o.className!=C&&(o.className=C);var de=o.style;for(var he in y)de[he]!==y[he]&&(de[he]=y[he]);if(r._edtHdl._edt&&r._edtHdl._edt.parentElement==o){var _e=r._root,pe=_e.getBoundingClientRect(),fe=o.getBoundingClientRect(),ge=pe.top+_e.clientHeight-fe.top,me=pe.left+_e.clientWidth-fe.left;fe.height>ge&&(o.style.height=ge+"px");fe.width>me&&(o.style.width=me+"px")}if((w==b.Cell||w==b.RowHeader)&&r._getShowErrors()){var we=r._getError(e,t,i,!1);r._edtHdl._setCellError(o,we)}r.itemFormatter&&r.itemFormatter(e,t,i,o);if(r.formatItem.hasHandlers){var Ce=CellFactory._fmtItemArgs;if(Ce){Ce._p=e;Ce._rng.setRange(t,i,h,_);Ce._cell=o}else Ce=CellFactory._fmtItemArgs=new FormatItemEventArgs(e,new CellRange(t,i,h,_),o);Ce._updateContent=!1!==l;r.onFormatItem(Ce)}};CellFactory.prototype.disposeCell=function(e){};CellFactory.prototype.getEditorValue=function(e){var t=e._edtHdl._edt;if(t instanceof HTMLInputElement)switch(t.type){case"checkbox":return t.checked;case"radio":return t.value}if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){var i=t[_MASK_PROVIDER],o=i?i._applyMask():t.value,n=t.maxLength;if(wijmo_1.isNumber(n)&&n>-1&&o.length>n){var l=wijmo_1.culture.Globalize.numberFormat["%"]||"%",r=o.length&&o[o.length-1]==l;o=o.substr(0,n);r&&o.indexOf(l)<0&&(o+=l)}return o}return null};CellFactory._WJC_RADIOMAP="wj-radio-map";CellFactory._WJC_CHECKBOX="wj-cell-check";CellFactory._WJC_COLLAPSE="wj-elem-collapse";CellFactory._WJC_DROPDOWN="wj-elem-dropdown";CellFactory._WJC_PIN="wj-elem-pin";CellFactory._tplDdBtn=_getButton(CellFactory._WJC_DROPDOWN,"down");CellFactory._tplCtx={row:null,col:null,value:null,text:null,item:null};return CellFactory}();exports.CellFactory=CellFactory;function _renderTemplate(e,t,i,o,n,l){var r=CellFactory._tplCtx;r.value=i;r.text=o;r.item=n.dataItem;r.row=n;r.col=l;var s=wijmo_1.isString(e)?wijmo_1.evalTemplate(e,r):e(r,t);null!=s&&(t.innerHTML=s)}function _getEditString(e,t){t=t||"n";var i=wijmo_1.Globalize._parseNumericFormat(t);switch(i.spec){case"d":case"x":break;case"e":t=t.replace(/[0-9]/g,"");break;default:t="p"==i.spec?"P15":"r";i.scale&&(t+=Array(i.scale/3+1).join(","))}return wijmo_1.Globalize.formatNumber(e,t,!0)}function _isEditingCell(e,t,i){return e.editRange&&e.editRange.contains(t,i)}function _getDropDownBtn(){var e=CellFactory._ddBtn;if(!e){e=CellFactory._ddBtn=wijmo_1.createElement(CellFactory._tplDdBtn);wijmo_1.setAriaLabel(e,wijmo_1.culture.FlexGrid.ariaLabels.toggleDropDown);wijmo_1.setAttribute(e,"aria-expanded",!1)}return e.cloneNode(!0)}function _addPinButton(e,t){var i=_getButton(CellFactory._WJC_PIN,"pin"),o=wijmo_1.createElement(i);wijmo_1.toggleClass(o,"wj-state-pinned",t);wijmo_1.setAttribute(o,"aria-pressed",t);e.insertBefore(o,e.firstChild)}function _getSortGlyph(e){var t=_getGlyph("+"==e.currentSort?"up":"down"),i=e.grid.collectionView;if(i&&i.sortDescriptions.length>1){var o=e.currentSortIndex;o>-1&&(t+='<span class="wj-sort-index">'+(o+1)+"</span>")}return t}function _getTreeBtn(e,t){var i=CellFactory._WJC_COLLAPSE,o=(e.isCollapsed?"":"down-")+(e.grid.rightToLeft?"left":"right"),n=wijmo_1.createElement('<button class="wj-btn wj-btn-glyph '+i+'" type="button" tabindex="-1">'+_getGlyph(o)+"</button>");wijmo_1.setAriaLabel(n,wijmo_1.culture.FlexGrid.ariaLabels.toggleGroup);wijmo_1.setAttribute(n,"aria-expanded",!e.isCollapsed);wijmo_1.setAttribute(t,"aria-expanded",!e.isCollapsed);return n}function _getGlyph(e){return'<span class="wj-glyph-'+e+'"></span>'}function _getButton(e,t){return'<button class="wj-btn wj-btn-glyph wj-right {cls}" type="button" tabindex="-1">{glyph}</button>'.replace("{cls}",e).replace("{glyph}",_getGlyph(t))}var _LB_PAGE_SIZE=4,_EditHandler=function(){function _EditHandler(e){var t=this;this._rng=null;this._edt=null;this._edItem=null;this._edtCanceled=!1;this._list=null;this._mapSearch=null;this._fullEdit=!1;this._evtInput=null;this._evtChange=null;this._cstEdtValue=null;this._validating=!1;this._composing=!1;this._g=e;this._evtInput=document.createEvent("HTMLEvents");this._evtInput.initEvent("input",!0,!1);this._evtChange=document.createEvent("HTMLEvents");this._evtChange.initEvent("change",!0,!1);e.selectionChanging.addHandler((function(e,i){return t._selectionChanging(i)}));e.lostFocus.addHandler((function(){var e=wijmo_1.getActiveElement();e&&"fixed"==getComputedStyle(e).position?t.finishEditing():t._commitRowEdits()}));var i=e.hostElement;e.addEventListener(i,"mousedown",(function(i){if(!i.defaultPrevented&&0==i.button&&!e._mouseHdl._szRowCol){var o=e.hitTest(i);o.cellType!=CellType.Cell&&o.cellType!=CellType.None&&(t.finishEditing()||t.finishEditing(!0))}}),!0);e.addEventListener(i,"compositionend",(function(){t._composing=!1;t._keypress.bind(t)}));e.addEventListener(i,"compositionstart",(function(i){var o=t._getCustomEditor(e),n=null!=i?wijmo_1.closest(i.target,".wj-flexgrid"):null,l=wijmo_1.Control.getControl(n),r=l&&l._edtHdl?null!=l._edtHdl.activeEditor:null!=t.activeEditor;if(!o||r||e.imeEnabled)t._composing=!0;else{var s=window.getSelection(),a=s.rangeCount>0?s.getRangeAt(0):null,c=document.activeElement;if(null!=c){c.blur();window.getSelection().removeAllRanges();setTimeout((function(){null!=a&&window.getSelection().addRange(a);c.focus()}),20)}}}))}_EditHandler.prototype.startEditing=function(e,t,i,o,n){void 0===e&&(e=!0);var l=this._g,r=l._selHdl.selection;t=wijmo_1.asNumber(t,!0,!0);i=wijmo_1.isString(i)?l.columns.indexOf(i):wijmo_1.asNumber(i,!0,!0);null==t&&(t=r.row);null==i&&(i=r.col);null==o&&(o=!0);if(!this._allowEdit(t,i))return!1;var s=l.getMergedRange(l.cells,t,i,!1);s||(s=new CellRange(t,i));var a=l.rows[t].dataItem;l.scrollIntoView(s.row,s.col,!0);if(!l.select(s,!0))return!1;if(!l.rows[t]||a!=l.rows[t].dataItem)return!1;if(this.activeEditor){if(s.equals(this._rng))return!0;if(!this.finishEditing())return!1}var c=new CellRangeEventArgs(l.cells,s,n);if(!l.onBeginningEdit(c))return!1;var u=l.editableCollectionView,d=!1;if(u){(d=(a=l.rows[t].dataItem)!=u.currentEditItem)&&l.onRowEditStarting(c);u.editItem(a);if(d){l.onRowEditStarted(c);this._edItem=a}}var h=l.rows[t],_=l._getBindingColumn(l.cells,t,l.columns[i]),p=_.dataMap||h.dataMap,f=DataMapEditor.RadioButtons,g=h.dataMap&&h.dataMapEditor==f||_.dataMap&&_.dataMapEditor==f;this._fullEdit=wijmo_1.asBoolean(e);this._rng=s;this._list=null;if(p&&!g&&!_.editor){var m=p.getDisplayValues(a);(_.isContentHtml||h.isContentHtml)&&(m=m.map((function(e){return wijmo_1.toPlainText(e)})));this._list=m;this._mapSearch=p.search}if(g){var w=l._activeCell||l.hostElement.querySelector(".wj-cell.wj-state-active");if(w){var C=n?n.target:null;C instanceof HTMLSpanElement&&(C=wijmo_1.closest(C,"label"));C instanceof HTMLLabelElement&&(C=C.querySelector("input"));if(C instanceof HTMLInputElement)this._edt=C;else{var v=w.querySelectorAll("input[checked]");v.length>0?this._edt=v[0]:this._edt=w.querySelector("input")}this._updateRowHeaderCell(t)}}else s.isSingleCell?this._updateEditorCell(t,i,d):l.refresh(!1);var y=this._edt;if(y){if("checkbox"==y.type||"radio"==y.type)this._fullEdit=!1;else if(o){var b=0,R=y.value.length,j=!1,E=wijmo_1.culture.Globalize.numberFormat["%"]||"%",x=l.getCellData(t,i,!1);wijmo_1.isNumber(x)?j=y.value.indexOf(E)>-1:null==x&&(j=/^p/i.test(_.format))&&y.value.indexOf(E)<0&&(y.value+=E);if(j){var S=y.value;b=0;R=S.length;for(;R>0&&(S[R-1]==E||" "==S[R-1]);)R--;for(;b<R&&S[b]==E;)b++}n&&"keydown"==n.type&&n.keyCode==wijmo_1.Key.Space&&(b=R);this._setSelectionRange(y,b,R,!0,wijmo_1.isEdge());wijmo_1.isIE()&&"right"==y.style.textAlign&&(y.style.paddingRight="1px")}l.onPrepareCellForEdit(c)}o&&!l.containsFocus()&&l.focus();return null!=y&&!y.disabled&&!y.readOnly};_EditHandler.prototype.finishEditing=function(e){var t=this._edt;if(!t){this._removeListBox();return!0}var i=this._g,o=this._rng,n=new CellEditEndingEventArgs(i.cells,o),l=i.containsFocus();if(!e){var r=i.hostElement.querySelector(".wj-control.wj-state-focused");if(r){var s=wijmo_1.Control.getControl(r);s&&(s.containsFocus()||s._focus)&&s.onLostFocus(n)}}n.cancel=e;if(!e&&i.validateEdits){if(w=this._getValidationError()){n.cancel=!0;var a=i.cells.getCellElement(o.row,o.col);if(a){this._setCellError(a,w);n.stayInEditMode=!0}}}this._cstEdtValue=null;n.data=i.cells.getCellData(o.topRow,o.leftCol,!1);if(!i.onCellEditEnding(n)&&n.stayInEditMode){l?setTimeout((function(){t.select()})):t.select();this._fullEdit=!0;return!1}if(!n.cancel){var c=null,u=!1;if(null!=this._lbx_SelectedValue){c=this._lbx_SelectedValue;u=!0}else{var d=this._cstEdtValue;c=d&&!wijmo_1.isUndefined(d.value)?d.value:this._lbx_SelectedValue?this._lbx_SelectedValue:i.cellFactory.getEditorValue(i);u=null!=this._lbx_SelectedValue}for(var h=o.topRow;h<=o.bottomRow&&h<i.rows.length;h++)for(var _=o.leftCol;_<=o.rightCol&&_<i.columns.length;_++){var p=i._getBindingColumn(i.cells,h,i.columns[_]),f=i.rows[h],g=p&&p.dataMap||f&&f.dataMap,m=!g||g.serializeKeys;if(u||!g||!this.isEqualValue(g.getDisplayValue(n.data),c)){if(!i.cells.setCellData(h,_,c,m,!1,u)&&i.validateEdits){var w;if(w=this._getValidationError(!0)){n.cancel=!0;var C=i.cells.getCellElement(o.row,o.col);if(C){this._setCellError(C,w);n.stayInEditMode=!0}return!1}}}}t.value==this._edtValue&&t.dispatchEvent(this._evtChange)}this._edt=null;this._rng=null;this._list=null;this._edtValue=null;this._edtCanceled=n.cancel;this._removeListBox();this._lbx_SelectedValue=null;var v=wijmo_1.closest(t,".wj-cell");if(wijmo_1.contains(v,wijmo_1.getActiveElement())){i._setFocusNoScroll(v);i._isScrollingByWheel=!1}!n.cancel&&n.refresh&&i._refreshOnEdit?i.refresh(!1):this._updateEditorCell(o.row,o.col,!1);l&&i.focus();i.onCellEditEnded(n);return!0};_EditHandler.prototype._setSelectionRange=function(e,t,i,o,n){void 0===o&&(o=!0);void 0===n&&(n=!1);if(!n)return wijmo_1.setSelectionRange(e,t,i,o);if(wijmo_1.contains(document.body,e)&&!e.disabled&&e.offsetHeight){try{e.setSelectionRange(t,i,"backward")}catch(e){}if(o)try{this._g._setFocusNoScroll(e);return!0}catch(e){}}return!1};_EditHandler.prototype._setCustomEditorValue=function(e){this._cstEdtValue={value:e}};_EditHandler.prototype._getCustomEditor=function(e){var t=null,i=e.selection;if(null!=i){var o=e._getBindingColumn(e.cells,i.row,e.columns[i.col]);t=o&&o._edt}return t};_EditHandler.prototype._setCellError=function(e,t){var i=this._g;""==t&&(t=null);wijmo_1.toggleClass(e,"wj-state-invalid",null!=t);var o=i.errorTip,n=i.activeEditor;if(o){o.setTooltip(e,t);n&&wijmo_1.contains(e,n)&&wijmo_1.setAttribute(n,"title","")}else wijmo_1.setAttribute(e,"title",t);n&&e==i.activeCell&&!wijmo_1.contains(e,n)&&o&&o.setTooltip(n,t)};Object.defineProperty(_EditHandler.prototype,"activeEditor",{get:function(){return this._edt},enumerable:!0,configurable:!0});Object.defineProperty(_EditHandler.prototype,"editRange",{get:function(){return this._rng},enumerable:!0,configurable:!0});_EditHandler.prototype.getClipString=function(e,t,i,o){var n,l=this,r=this._g,s=r.selectionMode,a=[],c=0!=(t&ClipStringOptions.CSV),u=c?"\r\n":"\n",d=c?",":"\t",h=0!=(t&ClipStringOptions.InvisibleRows),_=SelectionMode,p=null!=e;if(!e&&s!=_.ListBox)for(var f=r.rows,g=0;g<f.length;g++)if(f[g].isSelected){s=_.ListBox;break}if(!e){r._selHdl._expandSelection();e=r.selection;switch(s){case _.Row:case _.RowRange:case _.ListBox:e.col=0;e.col2=r.columns.length-1;break;case _.MultiRange:var m=r.selectedRanges;if(m.length>1){var w=this._sameCols(m),C=this._sameRows(m);if(w||C){(m=m.slice()).sort((function(e,t){var i=e.topRow-t.topRow;return i||e.leftCol-t.leftCol}));for(var v=0;v<m.length;v++)for(var y=m[v],b=v+1;b<m.length;b++)if(y.contains(m[b])){m.splice(b,1);b--}if(w){var R=[];m.forEach((function(e){R.push(l.getClipString(e,t,i,o));i=!1}));return R.join(u)}if(C){var j;m.forEach((function(e){var n=l.getClipString(e,t,i,o).split(u);if(null==j){j=n;o=!1}else n.forEach((function(e,t){j[t]+=d+e}))}));return j.join(u)}}}}}var E=e.col>-1&&e.col2>-1;i&&E&&(n=r.columnHeaders).rows.forEach((function(i,r){if(h||i.isVisible){var s=l._getRowClipString(n,r,e,t,o);a.push(s)}}));if(e.row>-1&&e.row2>-1){n=r.cells;if(s!=_.ListBox||p){wijmo_1.assert(e.bottomRow<n.rows.length,"Row index must be less than the number of rows.");for(v=e.topRow;v<=e.bottomRow;v++)if(h||n.rows[v].isVisible){var x=this._getRowClipString(n,v,e,t,o);a.push(x)}}else n.rows.forEach((function(i,r){if(i.isSelected&&(h||i.isVisible)){var s=l._getRowClipString(n,r,e,t,o);a.push(s)}}))}return a.join(u)};_EditHandler.prototype._getRowClipString=function(e,t,i,o,n){var l=[],r=e.rows[t],s=ClipStringOptions,a=0!=(o&s.CSV),c=0!=(o&s.InvisibleColumns),u=0==(o&s.Unformatted),d=0!=(o&s.SkipMerged);if(r.isVisible){if(n)for(var h=e.cellType==CellType.ColumnHeader?e.grid.topLeftCells:e.grid.rowHeaders,_=0;_<h.columns.length;_++)if(c||h.columns[_].isVisible){var p=h.getCellData(t,_,!0);d&&this._skipMergedCell(e,null,t,_)&&(p="");l.push(this._getCellClipString(p,o))}if(i.col>-1&&i.col2>-1){wijmo_1.assert(i.rightCol<e.columns.length,"Column index must be less than the number of columns.");for(_=i.leftCol;_<=i.rightCol;_++)if(c||e.columns[_].isVisible){!(p=e.getCellData(t,_,u))&&r instanceof GroupRow&&_==e.columns.firstVisibleIndex&&(p=wijmo_1.toPlainText(r.getGroupHeader()));d&&this._skipMergedCell(e,null,t,_)&&(p="");l.push(this._getCellClipString(p,o))}}}return l.join(a?",":"\t")};_EditHandler.prototype._skipMergedCell=function(e,t,i,o){var n=e.grid.getMergedRange(e,i,o,!1);if(n){if(t){n.row=Math.max(t.topRow,n.row);n.col=Math.max(t.leftCol,n.col)}if(n.row!=i||n.col!=o)return!0}return!1};_EditHandler.prototype._getCellClipString=function(e,t){wijmo_1.isString(e)||(e=wijmo_1.isDate(e)?e.toJSON():null!=e?e.toString():"");e=e.replace(/\t/g," ");var i=0!=(t&ClipStringOptions.QuoteAll);(i=i||/\n|^"|"$/.test(e))||0==(t&ClipStringOptions.CSV)||(i=e.indexOf(",")>-1);i&&(e='"'+(e=e.replace(/"/g,'""'))+'"');return e};_EditHandler.prototype._sameRows=function(e){for(var t=e[0],i=1;i<e.length;i++)if(e[i].topRow!=t.topRow||e[i].bottomRow!=t.bottomRow)return!1;return!0};_EditHandler.prototype._sameCols=function(e){for(var t=e[0],i=1;i<e.length;i++)if(e[i].leftCol!=t.leftCol||e[i].rightCol!=t.rightCol)return!1;return!0};_EditHandler.prototype.setClipString=function(e,t){var i=this,o=this._g,n=o.editableCollectionView,l=null==t,r=SelectionMode;if(l){o._selHdl._expandSelection();t=o.selection;switch(o.selectionMode){case r.Row:case r.RowRange:case r.ListBox:t.col=0;t.col2=o.columns.length-1;break;case r.MultiRange:var s=o.selectedRanges;if(s.length>1){n&&n.beginUpdate();s.forEach((function(t){o.setClipString(e,t)}));n&&n.endUpdate();o.selectedRanges=s;return}}}t=wijmo_1.asType(t,CellRange);var a=this._parseClipString(wijmo_1.asString(e));!l&&a.length>t.rowSpan&&(a=a.slice(0,t.rowSpan));this._expandClipRows(a,t);var c=0;if(a.length)for(var u=t.leftCol,d=o.columns.length,h=0;h<a[0].length;h++)for(var _=u+h+c;_<d&&!o.columns[_].visible;){c++;_++}var p=l?new CellRange(t.topRow,t.leftCol,Math.min(t.topRow+a.length-1,o.rows.length-1),Math.min(t.leftCol+a[0].length-1+c,o.columns.length-1)):t,f=new CellRangeEventArgs(o.cells,p,e);if(!o.onPasting(f))return!1;p=new CellRange(t.topRow,t.leftCol);var g=new CellRangeEventArgs(o.cells,new CellRange(t.topRow,-1)),m=!1,w=0,C=t.topRow,v=o.rows,y=o.columns,b=o._getRowsPerItem(),R=a.length>b,j=this._deferPaste(t,a.length);wijmo_1.assert(b>=1,"Invalid RPI value = "+b);o.deferUpdate((function(){var e=-1;if(n&&j){e=n.currentPosition;n.beginUpdate()}for(var l=0;l<a.length&&C<v.length;l++,C++){var r=v[C];if(r.isVisible){if(!R||!r.isReadOnly){var s=r.dataItem,c=n?n.currentEditItem:null;if(c&&s!=c){o.onRowEditEnding(g);o.onRowEditEnded(g)}if(r instanceof _NewRowTemplate&&n){if(j){r.dataItem=n.addNew();g._rng.setRange(o.newRowAtTop?0:C,-1);if(!o.onRowEditStarting(g)){C--;n.cancelNew();continue}o.onRowEditStarted(g)}else if(1==b||(C+1)%b==1){g._rng.setRange(o.newRowAtTop?C%b:C,-1);if(!o.onRowEditStarting(g)){C--;continue}o.onRowEditStarted(g)}}else if(s!=c){g._rng.setRange(C,-1);o.onRowEditStarting(g);o.onRowEditStarted(g)}for(var u=a[l],d=t.leftCol,h=0;h<u.length&&d<y.length;h++,d++){var _=y[d];if(_.isVisible){if(!R||!_.isReadOnly){var f=o.getMergedRange(o.cells,C,d,!1);if(!(f&&(f.leftCol!=d||f.topRow!=C))&&i._allowEdit(C,d)){var E=u[h],x=E.length;x>1&&'"'==E[0]&&'"'==E[x-1]&&E.indexOf("\n")>-1&&(E=E.substr(1,x-2));var S=_.maxLength||r.maxLength;S&&(E=E.substr(0,S));var H=new CellRangeEventArgs(o.cells,new CellRange(C+w,d),E);if(o.onPastingCell(H)){if(n){n.editItem(s);i._edItem=n.currentEditItem}var M=o.getCellData(C,d,!1),F=H.data,G=softInput();if(G){var T=o._getBindingColumn(o.cells,C,o.columns[d]),P=T.editor,I=null,A=null;if(P instanceof G.InputNumber){I=P.clamp.bind(P);A=wijmo_1.DataType.Number}else if(P instanceof G.InputDate||P instanceof G.InputTime){I=P._clamp.bind(P);A=wijmo_1.DataType.Date}if(I){F=wijmo_1.changeType(F,A,T.format,M);wijmo_1.getType(F)==A&&(F=I(F))}}if(o.setCellData(C,d,F)){H.data=M;o.onPastedCell(H);m=!0}}p.row2=Math.max(p.row2,C+w);p.col2=Math.max(p.col2,d)}}}else h--}if(i._edItem&&n instanceof wijmo_1.CollectionView){var z=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,i._edItem,C);n.onCollectionChanged(z,n._edtClone)}if(r instanceof _NewRowTemplate&&n)if(j){r.dataItem=null;if(m){g._rng.setRange(o.newRowAtTop?0:C,-1);o.onRowEditEnding(g);o.onRowEditEnded(g);C--;w++;n.commitNew()}else n.cancelNew()}else if(R&&b>1&&(C+1)%b==0&&m){g._rng.setRange(o.newRowAtTop?C%b:C,-1);o.onRowEditEnding(g);o.onRowEditEnded(g);C-=b;w++}}}else l--}if(n)if(j){if(n.currentEditItem){n.commitEdit();o.onRowEditEnding(g);o.onRowEditEnded(g)}n.moveCurrentToPosition(e);n.endUpdate(!0)}else{var D=n.currentAddItem;!D&&0==t.row&&o.newRowAtTop&&v[0]instanceof _NewRowTemplate&&(D=v[0].dataItem);if(D){n.editItem(D);i._edItem=D}}p.rowSpan>1&&0==p.topRow&&v[0]instanceof _NewRowTemplate&&(p.row=p.row2=0);o.select(p)}));o.onPasted(f);if(m&&wijmo_1.closest(o.hostElement,"form")){var E=document.createEvent("HTMLEvents"),x=wijmo_1.createElement("<input>",o.hostElement);E.initEvent("change",!0,!1);x.dispatchEvent(E);wijmo_1.removeChild(x)}};_EditHandler.prototype._deferPaste=function(e,t){var i=this._g.rows,o=i.length;if(t>1){if(o>1&&i[0].dataItem!=i[1].dataItem)return!0;if(1==o&&i[0]instanceof _NewRowTemplate)return!0}return!1};_EditHandler.prototype._parseClipString=function(e){var t=[],i=(e=(e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")).replace(/\n$/,"")).length,isTabOrNewLineChar=function(e){return"\n"===e||"\t"===e},o=0,n=0;for(o=0;o<i;o++){var l=!1,r=!1,s=!1;if('"'===e[o]){for(var a=!1,c=!1,u=o+1;u<i;u++){var d=e[u];if('"'===d){var h=u+1;if(h<i){isTabOrNewLineChar(e[h])&&(c=!0)}else c=!0}else!a&&isTabOrNewLineChar(d)&&(a=!0);if(c)break}c&&a&&(l=!0)}for(n=o;n<i&&!s;n++){var _=e[n];if('"'===_)l&&(r=!r);else if(isTabOrNewLineChar(_)&&!r){this._parseClipCell(t,e,o,n,"\n"==_);o=n;n==i-1&&(o=n+1);s=!0}}if(n==i){this._parseClipCell(t,e,o,n,!1);break}}0==t.length&&t.push([""]);return t};_EditHandler.prototype._parseClipCell=function(e,t,i,o,n){e.length||e.push([]);var l=t.substr(i,o-i),r=l.length;if(r>2&&'"'==l[0]&&'"'==l[r-1]){var s=l.substr(1,r-2),unquotedStringHasChar=function(e){return s.indexOf(e)>-1};(unquotedStringHasChar('""')||unquotedStringHasChar("\t")||unquotedStringHasChar("\n"))&&(l=s.replace(/""/g,'"'))}else"\t"==l&&(l="");e[e.length-1].push(l);n&&e.push([])};_EditHandler.prototype._expandClipRows=function(e,t){for(var i=e.length,o=0,n=0;n<i;n++)o=Math.max(o,e[n].length);for(var l=this._g,r=0,s=0,a=t.topRow;a<=t.bottomRow;a++)l.rows[a].isVisible&&r++;for(var c=t.leftCol;c<=t.rightCol;c++)l.columns[c].isVisible&&s++;if(r>1||s>1){1==r&&(r=i);1==s&&(s=o);if(s%o==0&&r%i==0){for(c=o;c<s;c++)for(a=0;a<i;a++)e[a].push(e[a%i][c%o]);for(a=i;a<r;a++)e.push(e[a%i])}}};_EditHandler.prototype._updateEditorCell=function(e,t,i){var o=this._g,n=o.cells.getCellElement(e,t),l=o._useFrozenDiv()&&(e<o.rows.frozen||t<o.columns.frozen);if(!n||l||o._hasPendingUpdates())o.refresh(!1);else if(o.onUpdatingView(new wijmo_1.CancelEventArgs)){this._updateCell(n);(i||o._getHasValidation())&&this._updateRowHeaderCell(e);o.onUpdatedView()}};_EditHandler.prototype._updateRowHeaderCell=function(e){var t=this._g;if(t.headersVisibility&HeadersVisibility.Row){var i=t.rowHeaders,o=t._getEditColumnIndex(),n=i.getCellElement(e,o);n&&this._updateCell(n)}};_EditHandler.prototype._updateCell=function(e){var t=new HitTestInfo(e,null),i=FlexGrid._WJS_UPDATING;if(t.panel){wijmo_1.addClass(e,i);t.grid.cellFactory.updateCell(t.panel,t.row,t.col,e,t.range);wijmo_1.removeClass(e,i)}};_EditHandler.prototype._getValidationError=function(e){var t=this,i=this._g,o="";if(i&&this._rng&&!this._validating){var n=this._rng.row,l=this._rng.col,r=i.activeEditor,s=i.cellFactory.getEditorValue(i),a=i.getCellData(n,l,!1);e&&(o=i._getError(i.cells,n,l,!0));if(!o&&i._getHasValidation()){r&&(o=r.validationMessage);if(!o){var c=i.columns[l],u=i.rows[n];!i._getBindingColumn(i.cells,n,c).getIsRequired(u)||null!=s&&""!==s||(o=this._getRequiredMsg())}if(!o&&i.setCellData(n,l,s,!0,!1)){o=i._getError(i.cells,n,l,!1);i.setCellData(n,l,a,!1,!1)}}if(!o){var d=wijmo_1.Control.getControl(wijmo_1.closest(r,".wj-control"));if(d&&d!=i&&d.invalidInput.hasHandlers){var invInputHandler=function(e,r){if(r.cancel){o=i._getError(i.cells,n,l,!0)||t._getBadInputMsg();r.cancel=!1}};this._validating=!0;var h=r.value;d.invalidInput.addHandler(invInputHandler);if(d._containsFocus()){var _=wijmo_1.closest(d.hostElement,".wj-cell");_&&_.focus()}d.onLostFocus();d.invalidInput.removeHandler(invInputHandler);r.value=h;o&&r.select();this._validating=!1}}}return o};_EditHandler.prototype._getRequiredMsg=function(){if(!_EditHandler._msgRequired){var e=document.createElement("input");e.required=!0;_EditHandler._msgRequired=e.validationMessage}return _EditHandler._msgRequired};_EditHandler.prototype._getBadInputMsg=function(){if(!_EditHandler._msgBadInput){var e=document.createElement("input");e.pattern="x";e.value="a";_EditHandler._msgBadInput=e.validationMessage||"Bad Input"}return _EditHandler._msgBadInput};_EditHandler.prototype._allowEdit=function(e,t){var i=this._g;if(i.isReadOnly||i.selectionMode==SelectionMode.None)return!1;if(i.collectionView&&!i.editableCollectionView)return!1;if(null!=e){if(e<0||e>=i.rows.length)return!1;var o=i.rows[e];if(!o||o.isReadOnly||!o.isVisible)return!1}if(null!=t){if(t<0||t>=i.columns.length)return!1;var n=i._getBindingColumn(i.cells,e,i.columns[t]);if(!n||n.isReadOnly||!n.isVisible)return!1}return!0};_EditHandler.prototype._commitRowEdits=function(){var e=this._g;if(this.finishEditing()&&this._edItem){var t=e.editableCollectionView;if(t&&(t.currentEditItem||t.currentAddItem)){var i=new CellRangeEventArgs(e.cells,e.selection);e.onRowEditEnding(i);t.commitEdit();e.onRowEditEnded(i)}this._edItem=null}};_EditHandler.prototype._keydown=function(e){var t=this._edt;switch(e.keyCode){case wijmo_1.Key.F2:this._fullEdit=!this._fullEdit;e.preventDefault();return!0;case wijmo_1.Key.F4:this._toggleListBox(e);e.preventDefault();return!0;case wijmo_1.Key.Space:if(t&&"checkbox"==t.type&&!t.disabled&&!t.readOnly){wijmo_1.setChecked(t,t.indeterminate||!t.checked);this.finishEditing();e.preventDefault()}return!0;case wijmo_1.Key.Enter:e.preventDefault();if(t&&e.altKey){var i=e.target;if(i instanceof HTMLTextAreaElement&&"soft"==i.wrap){if(this._composing){i.blur();i.focus()}i.style.setProperty("ime-mode","auto","important");var o=i.value,n=i.selectionStart,l=i.selectionEnd;i.value=o.substr(0,n)+"\n"+o.substr(l);wijmo_1.setSelectionRange(i,n+1);i.blur();i.focus();i.style.imeMode=""}return!0}if(t&&this._lbx){var r=this._g,s=r._selHdl.selection,a=r.rows[s.row],c=r._getBindingColumn(r.cells,s.row,r.columns[s.col]);this._lbx_SelectedValue=this._findKeyValue(a.dataMap||c.dataMap,c.isContentHtml||a.isContentHtml);this._toggleListBox(e);this.finishEditing();return!0}return!this.finishEditing();case wijmo_1.Key.Tab:e.preventDefault();return!this.finishEditing();case wijmo_1.Key.Escape:e.preventDefault();this.finishEditing(!0);return!0;case wijmo_1.Key.Up:case wijmo_1.Key.Down:case wijmo_1.Key.Left:case wijmo_1.Key.Right:case wijmo_1.Key.PageUp:case wijmo_1.Key.PageDown:case wijmo_1.Key.Home:case wijmo_1.Key.End:if(this._lbx)return this._keydownListBox(e);if(e.altKey)switch(e.keyCode){case wijmo_1.Key.Up:case wijmo_1.Key.Down:this._toggleListBox(e);e.preventDefault();return!0}if(this._fullEdit)switch(e.keyCode){case wijmo_1.Key.PageUp:case wijmo_1.Key.PageDown:e.preventDefault()}else if(this.finishEditing())return!1}return!0};_EditHandler.prototype._keydownListBox=function(e){var t=!0;if(this._lbx)switch(e.keyCode){case wijmo_1.Key.Up:e.altKey?this._toggleListBox(e):this._lbx.selectedIndex>0&&this._lbx.selectedIndex--;break;case wijmo_1.Key.Down:e.altKey?this._toggleListBox(e):this._lbx.selectedIndex++;break;case wijmo_1.Key.Home:case wijmo_1.Key.PageUp:this._lbx.selectedIndex=0;break;case wijmo_1.Key.End:case wijmo_1.Key.PageDown:this._lbx.selectedIndex=this._lbx.collectionView.items.length-1;break;default:t=!1}if(t){e.preventDefault();return!0}return!1};_EditHandler.prototype._keypress=function(e){if("AltLeft"!=e.code&&"AltRight"!=e.code){var t=this._edt,i=e.charCode||32,o=this._list;if(wijmo_1.isEdge()){var n=t;n&&(1==n.value.length||0==n.selectionStart&&n.selectionEnd==n.value.length)&&(wijmo_1.Control.sharedState.InvalidScroll=!0)}if(t&&"checkbox"!=t.type&&wijmo_1.getActiveElement()==t&&o&&o.length>0&&i>=32){var l=t.selectionStart,r=t.value.substr(0,l);if(e.target==t&&e.charCode){r+=String.fromCharCode(e.charCode);l++}var s=this._mapSearch,a=-1;if(s)for(var c=0;c<o.length;c++){var u=o[c];if(s(null==u?u:u.toString(),r)){a=c;break}}else(a=this._findString(o,r,!0))<0&&!this._g.caseSensitiveSearch&&(a=this._findString(o,r,!1));if(a>-1){var d=this._lbx;d&&(d.selectedIndex=a);t.value=o[a];wijmo_1.setSelectionRange(t,l,t.value.length);t.dispatchEvent(this._evtInput);e.preventDefault&&e.preventDefault()}else this._lbx&&(this._lbx_SelectedValue=null)}}else e.preventDefault()};_EditHandler.prototype._findString=function(e,t,i){i||(t=t.toLowerCase());for(var o=0;o<e.length;o++){var n=e[o];if(null!=n){n=n.toString();i||(n=n.toLowerCase());if(0==n.indexOf(t))return o}}return-1};_EditHandler.prototype._toggleListBox=function(e,t){var i=this._g,o=i._selHdl.selection,n=i.isTouching;t||(t=o);if(this._lbx){this._removeListBox();if(o.intersects(t)){i.activeEditor?i.activeEditor.focus():i.containsFocus()||i.focus();return!0}}if(!t.isValid)return!1;var l=i.rows[t.row],r=i._getBindingColumn(i.cells,t.row,i.columns[t.col]),s=l.dataMap||r.dataMap,a=i._getMapEditor(l,r);if(!s||a!=DataMapEditor.DropDownList||!softInput())return!1;if(null!=r.editor)return!1;if(!t.intersects(i.editRange)&&!this.startEditing(!0,t.row,t.col,!n,e))return!1;var c=this._lbx=this._createListBox();requestAnimationFrame((function(){return c.showSelection()}));n&&c.focus();return!0};_EditHandler.prototype._createListBox=function(){var e=this,t=this._g,i=t.activeEditor,o=this._rng,n=t.rows[o.row],l=t._getBindingColumn(t.cells,o.row,t.columns[o.col]),r=l.isContentHtml||n.isContentHtml,s=l.dataMap||n.dataMap,a=l.dropDownCssClass||n.dropDownCssClass,c=document.createElement("div");this._removeListBox();wijmo_1.addClass(c,"wj-dropdown-panel wj-grid-listbox");wijmo_1.addClass(c,a);var u=i?i.value:t.getCellData(o.row,o.col,!0),d=new mInput.ListBox(c,{maxHeight:n.renderHeight*_LB_PAGE_SIZE,isContentHtml:r,itemsSource:s.getDisplayValues(n.dataItem)});if(s._displayPath==s._keyPath)d.selectedValue=u;else{var h=t.getCellData(o.row,o.col,!1),_=-1,p=this._findDuplicateValues(s,u,r),f=s._cv.items.findIndex((function(t){return e.isEqualValue(t[s._keyPath],h,r)}));if(f>-1){var g=s._cv.items[f][s._displayPath];if(this.isEqualValue(u,g,r))if(1==p.length)_=f>d.itemsSource.length||!this.isEqualValue(d.itemsSource[f],u,r)?d.itemsSource.findIndex((function(t){return e.isEqualValue(g,t,r)})):f;else for(var m=-1,w=0;w<d.itemsSource.length;w++)if(this.isEqualValue(d.itemsSource[w],g,r)){m++;if(this.isEqualValue(p[m],h,r)){_=w;break}}}_<0&&(_=d.itemsSource.findIndex((function(t){return e.isEqualValue(u,t,r)})));_>=0?d.selectedIndex=_:d.selectedValue=null}d.addEventListener(c,"keydown",(function(i){switch(i.keyCode){case wijmo_1.Key.Enter:case wijmo_1.Key.Escape:e._removeListBox();t.focus()}}));d.addEventListener(c,"click",(function(){e._lbx&&(e._lbx_SelectedValue=e._findKeyValue(s,r));e._removeListBox();t.focus();e.finishEditing()}));d.gotFocus.addHandler((function(){d.containsFocus()&&i&&!wijmo_1.isEdge()&&i.focus()}));d.selectedIndexChanged.addHandler((function(){var i=t.activeEditor;if(i){i.value=e._list[d.selectedIndex];i.dispatchEvent(e._evtInput);wijmo_1.setSelectionRange(i,0,i.value.length)}}));var C=t.cells.getCellElement(o.row,o.col);if(C){wijmo_1.showPopup(c,C,!1,!1,!1);var v=C.querySelector("."+CellFactory._WJC_DROPDOWN);wijmo_1.setAttribute(v,"aria-expanded",!0)}else{wijmo_1.showPopup(c,t.getCellBoundingRect(o.row,o.col));c[wijmo_1.Control._OWNR_KEY]=t.hostElement}return d};_EditHandler.prototype._findKeyValue=function(e,t){void 0===t&&(t=!1);var i=this._lbx.selectedValue,o=this._findDuplicateValues(e,i,t),n=e.getKeyValue(i);if(this._lbx.selectedIndex>0&&o.length>1){for(var l=-1,r=0;r<=this._lbx.selectedIndex;r++)this.isEqualValue(this._lbx.itemsSource[r],i,t)&&l++;l>=0&&(n=o[l])}return n};_EditHandler.prototype._findDuplicateValues=function(e,t,i){void 0===i&&(i=!1);for(var o=[],n=e.getKeyValues(),l=0;l<n.length;l++)this.isEqualValue(e.getDisplayValue(n[l]),t,i)&&o.push(n[l]);return o};_EditHandler.prototype._removeListBox=function(){var e=this._lbx;if(e){this._lbx=null;wijmo_1.hidePopup(e.hostElement,(function(){e.dispose()}))}};_EditHandler.prototype.isEqualValue=function(e,t,i){void 0===i&&(i=!1);if(e instanceof Date&&t instanceof Date)return e.getTime()==t.getTime();null!=e&&null!=e||(e="");null!=t&&null!=t||(t="");Number.isNaN(e)&&(e="NaN");Number.isNaN(t)&&(t="NaN");if(i){wijmo_1.isString(e)&&e.indexOf("<")>-1&&(e=wijmo_1.toPlainText(e));wijmo_1.isString(t)&&t.indexOf("<")>-1&&(t=wijmo_1.toPlainText(t))}return e.toString()==t.toString()};_EditHandler.prototype._selectionChanging=function(e){var t=this;if(this.finishEditing()){var i=this._g._selHdl.selection.row;if(i!=e.row){var o=this._g.rows.length;if((i>-1&&i<o?this._g.rows[i].dataItem:null)!=(e.row>-1&&e.row<o?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){var n=!this._g.rows[i]||this._g.rows[i]&&Object.getPrototypeOf(this._g.rows[i])!==Row.prototype?null:this._g.getEmptyRequiredCell(i);null!==n&&setTimeout((function(){t._g.select(new CellRange(i,n));t.startEditing(!0,i,n,!0,e)}))}}}}else e.cancel=!0};_EditHandler._msgRequired="";_EditHandler._msgBadInput="";return _EditHandler}();exports._EditHandler=_EditHandler;var KeyAction,_CustomEditor=function(){function _CustomEditor(e,t){this._col=wijmo_1.asType(e,Column);this._ctl=t;this._tbx=t.hostElement.querySelector("input");wijmo_1.assert(this._col instanceof Column,"Invalid Column");wijmo_1.assert(this._ctl instanceof wijmo_1.Control,"Invalid edit control");wijmo_1.assert(this._tbx instanceof HTMLInputElement,"Input element not found in editor");var i=this._ctl;this._prop=wijmo_1.isUndefined(i.value)?wijmo_1.isUndefined(i.checkedItems)?wijmo_1.isUndefined(i.text)?null:"text":"checkedItems":"value";wijmo_1.assert(null!=this._prop,"value, text properties not found in editor");var o=softInput();if(o){this._isDropDown=i instanceof o.DropDown;this._isComboBox=i instanceof o.ComboBox;this._isAutoComplete=i instanceof o.AutoComplete;this._isInputDateTime=i instanceof o.InputDateTime;this._isInputNumber=i instanceof o.InputNumber;this._isInputMask=i instanceof o.InputMask}this._updateFocusBnd=this._updateFocus.bind(this);this._keydownBnd=this._keydown.bind(this);this._cmpstartBnd=this._cmpstart.bind(this);this._mousedownBnd=this._mousedown.bind(this);this._connect();this._col.gridChanged.addHandler(this._connect,this);this._hideEditor();this._updateFocus()}Object.defineProperty(_CustomEditor.prototype,"grid",{get:function(){return this._g},enumerable:!0,configurable:!0});Object.defineProperty(_CustomEditor.prototype,"column",{get:function(){return this._col},enumerable:!0,configurable:!0});Object.defineProperty(_CustomEditor.prototype,"control",{get:function(){return this._ctl},enumerable:!0,configurable:!0});_CustomEditor.prototype.dispose=function(){this._disconnect();this._isDropDown&&(this._isDropDown=!1);this._g=this._col=this._ctl=this._tbx=null};_CustomEditor.prototype._connect=function(){var e=this._col?this._col.grid:null;if(e!=this._g){this._disconnect();if(e){var t=e.hostElement,i=e.addEventListener.bind(e),o=this._updateFocusBnd;this._g=e;this._hideEditor();this._updateFocus();i(t,"keydown",this._keydownBnd,!0);i(t,"mousedown",this._mousedownBnd,!0);i(t,"mouseup",o,!0);i(t,"blur",o,!0);i(t,"focus",o);i(this._tbx,"compositionstart",this._cmpstartBnd);e.gotFocus.addHandler(o,this);e.selectionChanged.addHandler(o,this);e.prepareCellForEdit.addHandler(this._prepareCellForEdit,this);e.cellEditEnding.addHandler(this._cellEditEnding,this);e.cellEditEnded.addHandler(this._cellEditEnded,this)}}};_CustomEditor.prototype._disconnect=function(){var e=this._g;if(e){var t=e.hostElement,i=e.removeEventListener.bind(e),o=this._updateFocusBnd;i(t,"keydown",this._keydownBnd);i(t,"mousedown",this._mousedownBnd);i(t,"mouseup",o);i(t,"blur",o);i(t,"focus",o);i(this._tbx,"compositionstart",this._cmpstartBnd);e.gotFocus.removeHandler(o,this);e.selectionChanged.removeHandler(o,this);e.prepareCellForEdit.removeHandler(this._prepareCellForEdit,this);e.cellEditEnding.removeHandler(this._cellEditEnding,this);e.cellEditEnded.removeHandler(this._cellEditEnded,this);this._g=null}};_CustomEditor.prototype._prepareCellForEdit=function(e,t){if(!t.cancel&&t.getColumn(!0)==this._col){var i=this.grid,o=this._ctl,n=this._tbx,l=this._prop,r=t.range,s=t.data,a=s&&void 0!==s.type?s.type:"",c=i.getCellData(r.row,r.col,"text"==l||this._isInputMask),u=!1;if(this._isComboBox){""!=c&&(o._emptyValueAction=!1);this._isInputDateTime&&o._setDropdown(o._ddDate)}this._isInputMask&&(o._fullEdit=!0);if("checkedItems"==l){if(o.showFilterInput){o.showFilterInput=!1;o.showFilterInput=!0}if(null==c||0==c.length){o[l]=[];o.selectedIndex=0}}if(null!=c||!o.isRequired){if("checkedItems"==l){var d=[];if(o.selectedValuePath)for(var _loop_1=function(e){var t=o.collectionView.items.findIndex((function(t){return null!=c[e][o.selectedValuePath]&&t[o.selectedValuePath]===c[e][o.selectedValuePath]}));if(t>=0){o._lbx.toggleItemChecked(t);d.push(o.collectionView.items[t])}},h=0;h<c.length;h++)_loop_1(h);else wijmo_1.isArray(c)?d=c:c.length>0&&(d=c.split(","));o[l]=d}else o[l]=c;if(this._isAutoComplete){clearTimeout(o._toSearch);if((p=o.collectionView)&&(p.filter||o._rxHighlight)){o._rxHighlight=null;p.filter=null}if(c){var _=o._findNext(c,1,-1);o.selectedIndex!=_&&(o.selectedIndex=_)}}}switch(a){case"keydown":case"mousedown":if(wijmo_1.isUndefined(s.keyCode)||s.keyCode==wijmo_1.Key.F4||s.altKey){u=this._isDropDown;if(this._isAutoComplete&&(null==c||wijmo_1.isString(c))){var p;if(p=o.collectionView){if(p.filter||o._rxHighlight){o._rxHighlight=null;p.filter=null}_=c?o._findNext(c,1,-1):-1;o.selectedIndex!=_&&(o.selectedIndex=_)}}}}i.showPlaceholders&&!o.placeholder&&(n.placeholder=this._col.header);this._showEditor();i._edtHdl._fullEdit=!0;if(0==a.indexOf("key")&&32==s.keyCode){wijmo_1.setSelectionRange(n,n.value.length);s.preventDefault()}if(wijmo_1.isIE()&&!i.imeEnabled)if("keypress"==a&&s.key){setTimeout((function(){n.value=s.key;wijmo_1.setSelectionRange(n,1);var e=document.createEvent("HTMLEvents");e.initEvent("input",!0,!1);n.dispatchEvent(e)}));s.preventDefault()}else if("compositionstart"==a){var f=n.value.length;wijmo_1.setSelectionRange(n,f)}this._isDropDown&&(o.isDroppedDown=u)}};_CustomEditor.prototype._cellEditEnding=function(e,t){if(!t.cancel&&t.getColumn(!0)==this._col){var i=this.grid,o=this._ctl,n=this._prop;if(this._isAutoComplete){var l=o.selectedIndex;if(wijmo_1.isNumber(l)&&l<0){var r=o.collectionView;r&&1==r.items.length?o.selectedIndex=0:this._col.isRequired&&(t.cancel=!0)}}if(!t.cancel&&n){var s=!1;if(this._isInputMask){var a=o;if(null!=a){i._edtHdl._setCustomEditorValue(a._msk._applyMask());s=!0}}s||i._edtHdl._setCustomEditorValue(o[n])}}};_CustomEditor.prototype._cellEditEnded=function(e,t){this._hideEditor();this._updateFocus()};_CustomEditor.prototype._cmpstart=function(e){var t=this;this.grid.imeEnabled&&(wijmo_1.isIE()?setTimeout((function(){t._activateEditor(e)})):this._activateEditor(e))};_CustomEditor.prototype._keydown=function(e){if(!e.defaultPrevented&&this._checkColumn(e.target))if(this.grid.activeEditor){if(e.keyCode==wijmo_1.Key.Enter&&this._isDropDown){var t=this._ctl;if(t.isDroppedDown){t.isDroppedDown=!1;e.preventDefault();e.stopImmediatePropagation()}}}else if(this._isDropDown){var i=e.keyCode;switch(i){case wijmo_1.Key.F4:case wijmo_1.Key.Up:case wijmo_1.Key.Down:if(i==wijmo_1.Key.F4||e.altKey){this._activateEditor(e);e.preventDefault()}}}};_CustomEditor.prototype._checkColumn=function(e){var t=this._g;if(wijmo_1.contains(e,this._tbx)||null!=e&&this._imeEditor()===e){var i=t._selHdl.selection;return t._getBindingColumn(t.cells,i.row,t.columns[i.col])==this._col}return!1};_CustomEditor.prototype._mousedown=function(e){if(!e.defaultPrevented&&0==e.button&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._isDropDown&&wijmo_1.closestClass(e.target,CellFactory._WJC_DROPDOWN)){var t=this.grid,i=t.hitTest(e);if(!i._clickChildGrid&&i.getColumn(!0)==this._col){t.select(i.range);t.refresh();this._activateEditor(e);e.preventDefault()}}};_CustomEditor.prototype._activateEditor=function(e){var t=this.grid;if(!t.activeEditor){var i=t._selHdl.selection;if(i.isValid)return t.startEditing(!0,i.row,i.col,!0,e)}return!1};_CustomEditor.prototype._showEditor=function(){var e=this.grid,t=e.activeEditor,i=wijmo_1.closest(t,".wj-cell");if(i){var o=this._tbx,n=this._ctl.hostElement;wijmo_1.setCss(n,_CustomEditor._cssVisible);wijmo_1.toggleClass(o,"wj-grid-ime",!1);i.innerHTML="";i.appendChild(n);e._edtHdl._edt=o;if(this._imeEditor())this._initImeEditInput();else{o.select();o.focus();t.value=""}}};_CustomEditor.prototype._hideEditor=function(){var e=this.grid,t=this._ctl.hostElement,i=this._tbx;this._isDropDown&&(this._ctl.isDroppedDown=!1);i.setCustomValidity("");var o=i.value;i.value=o+" ";i.value=o;wijmo_1.setCss(t,_CustomEditor._cssHidden);wijmo_1.toggleClass(i,"wj-grid-ime",!0);e&&t.parentElement!=e._root&&e._root.appendChild(t)};_CustomEditor.prototype._resetTabIndex=function(){this._tbx.tabIndex=-1};_CustomEditor.prototype._updateFocus=function(){var e=this.grid;if(e&&!e.activeEditor){var t=e.hostElement,i=".wj-flexgrid",o=this._tbx,n=wijmo_1.getActiveElement(),l=e._getTabIndex();if(wijmo_1.closest(n,i)==t)if(wijmo_1.closest(o,i)!=t)this._hideEditor();else if(e.imeEnabled)o.tabIndex>-1&&(o.tabIndex=-1);else{var r=e._selHdl.selection,s=e._getBindingColumn(e.cells,r.row,e.columns[r.col]);if(s&&s==this._col&&e.canEditCell(r.row,r.col)){if(n!==o){e.activeCell&&(e.activeCell.tabIndex=-1);o.tabIndex=l;if(!e.isTouching){o.select();o.focus()}}}else if(o.tabIndex>-1){o.tabIndex=-1;n==o&&e.focus(!0)}}}};_CustomEditor.prototype._initImeEditInput=function(){var e=this,t=this._imeEditor();if(t){var i=this._tbx,o=i&&i.style.color,n=this._ctl,compEndEh_1=function(){t.removeEventListener("compositionend",compEndEh_1);wijmo_1.setCss(t,_ImeHandler._cssHidden);if(i){i.style.color=o;var gotF=function(){n.gotFocus.removeHandler(gotF);e._g._edtHdl._edt=i;var o=t.value;if(o){i.value=o;e._isInputMask?setTimeout((function(){_CustomEditor._setSelectionRange(i,o.length,o.length)}),0):_CustomEditor._setSelectionRange(i,o.length,o.length);var l=document.createEvent("HTMLEvents");l.initEvent("input",!0,!1);i.dispatchEvent(l)}};n.gotFocus.addHandler(gotF);i.focus()}};t.addEventListener("compositionend",compEndEh_1);i&&(i.style.color="transparent")}};_CustomEditor._setSelectionRange=function(e,t,i){void 0===i&&(i=t);if(wijmo_1.contains(document.body,e)&&!e.disabled&&"none"!=e.style.display)try{e.setSelectionRange(wijmo_1.asNumber(t),wijmo_1.asNumber(i),wijmo_1.isIE()?null:"backward");e.focus()}catch(e){}};_CustomEditor.prototype._imeEditor=function(){var e=this.grid;if(e&&e.imeEnabled){var t=wijmo_1.getActiveElement();if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&wijmo_1.hasClass(t,"wj-grid-ime"))return t}return null};_CustomEditor._cssHidden={position:"fixed",left:-32e3,top:-32e3,width:"1px",height:"1px",overflow:"hidden",border:"none"};_CustomEditor._cssVisible={position:"absolute",left:0,top:0,width:"100%",height:"100%"};return _CustomEditor}();exports._CustomEditor=_CustomEditor;!function(e){e[e.None=0]="None";e[e.MoveDown=1]="MoveDown";e[e.MoveAcross=2]="MoveAcross";e[e.Cycle=3]="Cycle";e[e.CycleOut=4]="CycleOut";e[e.CycleEditable=5]="CycleEditable"}(KeyAction=exports.KeyAction||(exports.KeyAction={}));var _KeyboardHandler=function(){function _KeyboardHandler(e){this._kaTab=KeyAction.None;this._kaEnter=KeyAction.MoveDown;this._g=e;var t=e.hostElement;e.addEventListener(t,"keypress",this._keypress.bind(this));e.addEventListener(t,"keydown",this._keydown.bind(this))}_KeyboardHandler.prototype._keydown=function(e){var t=this._g,i=t._edtHdl,o=t.selection,n=e.ctrlKey||e.metaKey,l=e.shiftKey,r=e.altKey,s=e.target,a=e.char||e.key,c=!0;if(!n&&!r&&a&&1==a.length&&wijmo_1.closest(s,".wj-cell")&&s.firstElementChild&&(" "!=a||!l)){var u=s.querySelectorAll("."+CellFactory._WJC_RADIOMAP+" label input");if(u&&u.length){for(var d=-1,h=0;h<u.length;h++)if(u[h].checked){d=h;break}a=a.toLowerCase();for(h=0;h<u.length;h++){var _=u[(d+h+1)%u.length];if(" "==a||_.value.toLowerCase()[0]==a){_.click();break}}e.preventDefault();return}}if(!t._wantsInput(s)){var p=wijmo_1.tryCast(t.rows[o.row],GroupRow),f=t.editableCollectionView,g=t._getKeyCode(e),m=SelMove,w=SelectionMode,C=e.defaultPrevented&&!(s instanceof HTMLInputElement);if((t.isRangeValid(o)&&!C||n&&65==g)&&(!t.activeEditor||!i._keydown(e)||t._isNativeCheckbox(t.activeEditor))){if(t.autoClipboard){if(n&&(67==g||45==g)){var v=new CellRangeEventArgs(t.cells,o);if(t.onCopying(v)){var y=HeadersVisibility,b=0!=(t.copyHeaders&y.Column),R=0!=(t.copyHeaders&y.Row),j=t.getClipString(null,!1,b,R)+"\r\n";t._eFocus.focus();wijmo_1.Clipboard.copy(j);t.onCopied(v)}e.stopPropagation();return}if(n&&86==g||l&&45==g){t.isReadOnly||wijmo_1.Clipboard.paste((function(e){t.setClipString(e)}));e.stopPropagation();return}}(l||n)&&"Space"==e.code&&(g=wijmo_1.Key.Space);var E=e.target,x=E.closest(".wj-cell"),S=E&&x&&x["wj-cell-index"]&&x["wj-cell-index"].panel,H=[HeadersFocusability.Column,HeadersFocusability.All].includes(t.headersFocusability),M=[HeadersFocusability.Row,HeadersFocusability.All].includes(t.headersFocusability);switch(g){case wijmo_1.Key.Space:if(x&&S&&[CellType.RowHeader,CellType.TopLeft,CellType.ColumnHeader].includes(S._ct)&&M){var F=t.activePanelType;t.activePanelType=F;var G=x.querySelector(".wj-cell-check"),T=G&&!G.checked;setTimeout((function(){t.activePanelType=F;x.classList.add("wj-focus-header-cell");t._hideMarquee();x.focus();T&&t._activeCell&&t._activeCell.classList.add("wj-state-multi-selected")}),200);t._activeCell=null}else if(l&&o.isValid)switch(t.selectionMode){case w.CellRange:case w.MultiRange:case w.Row:case w.RowRange:case w.ListBox:t.select(new CellRange(o.row,0,o.row,t.columns.length-1),!1)}else if(n&&o.isValid)switch(t.selectionMode){case w.CellRange:case w.MultiRange:t.select(new CellRange(0,o.col,t.rows.length-1,o.col),!1)}else{(c=this._startEditing(!0,e))&&setTimeout((function(){var e=t.activeEditor;if(e)if(e.disabled||e.readOnly&&!wijmo_1.closest(e,".wj-control"))t.finishEditing();else if("checkbox"==e.type){wijmo_1.setChecked(e,e.indeterminate||!e.checked);t.finishEditing()}}));c=!0}break;case 65:if(n)switch(t.selectionMode){case w.None:case w.Cell:break;default:t.selectAll()}else c=!1;break;case wijmo_1.Key.Left:if(x&&S&&S._ct===CellType.ColumnHeader&&H){e.preventDefault();t._selHdl.moveSelection(SelMove.None,SelMove.Prev,!1)}else if(n||r)c=!1;else if(o.isValid&&0==o.leftCol&&p&&!p.isCollapsed&&p.hasChildren)p.isCollapsed=!0;else if(M&&p&&!p.isCollapsed&&p.hasChildren)p.isCollapsed=!0;else{if(t.selectionMode==w.None)return;this._moveSel(m.None,n?m.Home:m.Prev,l)}break;case wijmo_1.Key.Right:if(x&&S&&S._ct===CellType.ColumnHeader&&H){e.preventDefault();t._selHdl.moveSelection(SelMove.None,SelMove.Next,!1)}else if(n||e.altKey)c=!1;else if(o.isValid&&0==o.leftCol&&p&&p.isCollapsed)p.isCollapsed=!1;else if(M&&p&&p.isCollapsed&&(!S||S&&S._ct===CellType.Cell))p.isCollapsed=!1;else{if(t.selectionMode==w.None)return;this._moveSel(m.None,n?m.End:m.Next,l)}break;case wijmo_1.Key.Up:if(n)c=!1;else if(e.altKey&&i._toggleListBox(e))c=!0;else{if(t.selectionMode==w.None)return;this._moveSel(m.Prev,m.None,l)}break;case wijmo_1.Key.Down:if(n)c=!1;else if(e.altKey&&i._toggleListBox(e))c=!0;else{if(t.selectionMode==w.None)return;this._moveSel(m.Next,m.None,l)}break;case wijmo_1.Key.PageUp:this._moveSel(e.altKey?m.Home:m.PrevPage,m.None,l);if(t.rows.frozen&&t.selection.row<t.rows.frozen){var P=t.scrollPosition;P.y&&(t.scrollPosition=new wijmo_1.Point(P.x,0))}break;case wijmo_1.Key.PageDown:this._moveSel(e.altKey?m.End:m.NextPage,m.None,l);break;case wijmo_1.Key.Home:this._moveSel(n?m.Home:m.None,m.Home,l);break;case wijmo_1.Key.End:this._moveSel(n?m.End:m.None,m.End,l);break;case wijmo_1.Key.Tab:if(!(c=this._performKeyAction(t.keyActionTab,l))&&!t.activeCell){t.focus(!0);if(t.imeEnabled){var I=t._imeHdl;I&&I._resetTabIndex()}else{(A=this._getCustomEditor(t,o.row,o.col))&&A._resetTabIndex()}}break;case wijmo_1.Key.Enter:if(x&&S&&S._ct===CellType.ColumnHeader&&H){e.preventDefault();x.click();setTimeout((function(){t.activePanelType=CellType.ColumnHeader;x.classList.add("wj-focus-header-cell");t._hideMarquee();x.focus()}),30)}else if(x&&S&&S._ct===CellType.RowHeader&&M){e.preventDefault();t._selHdl.moveSelection(SelMove.Next,SelMove.None,!1)}else{var A;t.rows[o.row]instanceof _NewRowTemplate||(c=this._performKeyAction(t.keyActionEnter,l));(A=this._getCustomEditor(t,o.row,o.col))||t.focus(!0);!l&&f&&null!=f.currentEditItem&&i._commitRowEdits()}break;case wijmo_1.Key.Escape:c=!1;if(f&&(f.currentAddItem||f.currentEditItem)){var z=new CellRangeEventArgs(t.cells,t.selection);z.cancel=!0;t.onRowEditEnding(z);f.currentAddItem&&f.cancelNew();f.currentEditItem&&f.cancelEdit();t.onRowEditEnded(z);c=!0}t._mouseHdl.resetMouseState();break;case wijmo_1.Key.Delete:case wijmo_1.Key.Back:c=this._deleteSel(e);break;case wijmo_1.Key.F2:c=this._startEditing(!0,e);break;case wijmo_1.Key.F4:c=i._toggleListBox(e);break;default:c=!1}if(c){t.containsFocus()||t.focus();e.preventDefault();e.stopPropagation()}}}};_KeyboardHandler.prototype._performKeyAction=function(e,t){var i=KeyAction,o=SelMove;switch(e){case i.MoveDown:this._moveSel(t?o.Prev:o.Next,o.None,!1);return!0;case i.MoveAcross:this._moveSel(o.None,t?o.Prev:o.Next,!1);return!0;case i.Cycle:this._moveSel(o.None,t?o.PrevCell:o.NextCell,!1);return!0;case i.CycleEditable:this._moveSel(o.None,t?o.PrevEditableCell:o.NextEditableCell,!1);return!0;case i.CycleOut:var n=this._g.selection;this._moveSel(o.None,t?o.PrevCell:o.NextCell,!1);return!n.equals(this._g.selection)}return!1};_KeyboardHandler.prototype._keypress=function(e){var t=this,i=this._g;if(!i._wantsInput(e.target)&&!e.defaultPrevented){var o=i._edtHdl;if(i.activeEditor)o._keypress(e);else if(e.charCode>wijmo_1.Key.Space&&"AltLeft"!=e.code&&"AltRight"!=e.code)if(this._startEditing(!1,e)&&i.activeEditor){var n=wijmo_1.getActiveElement();if(n instanceof HTMLInputElement&&"checkbox"!=n.type||n instanceof HTMLTextAreaElement){var l=i._selHdl.selection,r=i.getCellData(l.row,l.col,!0),s=i.getCellData(l.row,l.col,!1),a=wijmo_1.culture.Globalize.numberFormat["%"]||"%",c=String.fromCharCode(e.charCode),u=wijmo_1.isNumber(s)&&r.indexOf(a)>-1||""==r&&n.value==a,d=!0,initEditor_1=function(){n.value=u?c+a:c;wijmo_1.setSelectionRange(n,1);n.dispatchEvent(o._evtInput);o._keypress(e);o._edtValue=n.value!=r?n.value:null};if(i.imeEnabled){var h=this._getCustomEditor(i,l.row,l.col),_=h&&h.control;if(_&&!_._focus){var gotF_1=function(){_.gotFocus.removeHandler(gotF_1);d=!1;initEditor_1()};_.gotFocus.addHandler(gotF_1)}}d&&initEditor_1();e.preventDefault()}}else if(i.autoSearch){var p=!1;l=i._selHdl.selection;if(e.charCode>32||32==e.charCode&&this._search){e.preventDefault();this._search+=String.fromCharCode(e.charCode);this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout((function(){t._toSearch=null;t._search=""}),wijmo_1.Control._SEARCH_DELAY);var f=this._findNext(l.row,l.col);if(f<0&&this._search.length>1){this._search=this._search[this._search.length-1];f=this._findNext(l.row,l.col)}if(f>-1){p=!0;i.select(f,l.col)}}p||(this._search="")}}};_KeyboardHandler.prototype._getCustomEditor=function(e,t,i){var o=e._getBindingColumn(e.cells,t,e.columns[i]);return o&&o._edt};_KeyboardHandler.prototype._findNext=function(e,t){var i=this._g,o=i.rows.length;(e<0||1==this._search.length)&&e++;var n=this._search,l=i.caseSensitiveSearch;l||(n=n.toLowerCase());for(var r=i.columns[t].isContentHtml,s=0;s<o;s++){var a=(e+s)%o,c=i.getCellData(a,t,!0).trim();r&&(c=wijmo_1.toPlainText(c));l||(c=c.toLowerCase());if(0==c.indexOf(n))return a}return-1};_KeyboardHandler.prototype._moveSel=function(e,t,i){var o=this._g,n=o.selectionMode,l=o._selHdl;if(n!=SelectionMode.None){n==SelectionMode.MultiRange&&l.extendedSelection.clear();l.moveSelection(e,t,i)}};_KeyboardHandler.prototype._deleteSel=function(e){var t=this,i=this._g,o=i.rows,n=i.editableCollectionView,l=i.selection,r=[],s=new CellRange,a=new CellEditEndingEventArgs(i.cells,s,e),c=SelectionMode;if(!i._edtHdl._allowEdit())return!1;if(i.allowDelete&&(null==n||n.canRemove&&!n.isAddingNew&&!n.isEditingItem)){if(0==(r=o.filter((function(e){return e.isSelected}))).length)switch(i.selectionMode){case c.CellRange:case c.MultiRange:var u=i._getDeleteColumnIndex();i.selectedRanges.forEach((function(e){if(e.leftCol==u&&e.rightCol==i.columns.length-1)for(var t=e.topRow;t>-1&&t<=e.bottomRow;t++){var n=o[t];r.indexOf(n)<0&&r.push(n)}}));break;case c.Row:l.topRow>-1&&r.push(o[l.topRow]);break;case c.RowRange:for(var d=l.topRow;d>-1&&d<=l.bottomRow;d++)r.push(o[d])}r=r.reduce((function(e,t){e.find((function(e){return e.dataItem===t.dataItem}))||e.push(t);return e}),[])}if(r.length>0){var h=0;i.deferUpdate((function(){n&&n.beginUpdate();for(var e=r.length-1;e>=0;e--){var t=r[e];if(!(t instanceof _NewRowTemplate)){s.setRange(t.index,-1);i.onDeletingRow(a);if(!a.cancel){n&&t.dataItem?n.remove(t.dataItem):i.rows.removeAt(t.index);h++;i.onDeletedRow(a)}}}n&&n.endUpdate(!1)}));if(h>0){var _=l.topRow;_=Math.min(_,i.rows.length-1);for(;_>0&&i.rows[_]instanceof _NewRowTemplate;)_--;l.row=l.row2=_;i.select(l,!1);i.childItemsPath&&n&&n.refresh()}return!0}if(0==r.length){i.deferUpdate((function(){var s=i.scrollPosition,a=-1;r=o.filter((function(e){return e.isSelected}));var u=i.selectedRanges.length>1||r.length>1||l.isValid&&o[l.row].dataItem!=o[l.row2].dataItem;n&&n.beginUpdate();if(r.length){var d=new CellRange(0,0,0,i.columns.length-1);r.forEach((function(i){d.row=d.row2=i.index;t._deleteRange(e,d);a=d.bottomRow}))}else{t._deleteRange(e,l);a=l.bottomRow;i.selectionMode==c.MultiRange&&i._selHdl.extendedSelection.forEach((function(i){t._deleteRange(e,i);a=i.bottomRow}))}i.select(l,!1);i.scrollPosition=s;if(n){if(u&&n.currentEditItem){n.commitEdit();var h=new CellRangeEventArgs(i.cells,new CellRange(a,-1));i.onRowEditEnding(h);i.onRowEditEnded(h)}n.endUpdate(!1)}}));return!0}return!1};_KeyboardHandler.prototype._deleteRange=function(e,t){for(var i=this._g,o=i.editableCollectionView,n=new CellRange,l=new CellEditEndingEventArgs(i.cells,n,e),r=new CellRangeEventArgs(i.cells,new CellRange(t.topRow,-1)),s=t.topRow;s<=t.bottomRow;s++){var a=i.rows[s];if(!a.isReadOnly)for(var c=t.leftCol;c<=t.rightCol;c++){var u=i._getBindingColumn(i.cells,s,i.columns[c]);if(!u.getIsRequired(a)&&!u.isReadOnly){var d=i.getCellData(s,c,!1);if(i.getCellData(s,c,!0)){n.setRange(s,c);l.cancel=!1;if(i.onBeginningEdit(l)){var h=a.dataItem,_=o?o.currentEditItem:null;if(_&&h!=_&&c===t.rightCol){i.onRowEditEnding(r);i.onRowEditEnded(r)}if(h!=_&&c===t.leftCol){r._rng.setRange(s,-1);i.onRowEditStarting(r);i.onRowEditStarted(r)}if(o){o.editItem(h);i._edtHdl._edItem=h}i.setCellData(s,c,"",!0,!1);l.previousData=d;i.onCellEditEnding(l);i.onCellEditEnded(l)}}}}}};_KeyboardHandler.prototype._startEditing=function(e,t,i,o){return this._g._edtHdl.startEditing(e,i,o,!0,t)};return _KeyboardHandler}();exports._KeyboardHandler=_KeyboardHandler;var AllowResizing,AutoSizeMode,AllowDragging,_AR_ALLCELLS=4,_WJC_DRAGSRC="wj-state-dragsrc",_WJC_FLEXGRID="wj-flexgrid";!function(e){e[e.None=0]="None";e[e.Columns=1]="Columns";e[e.Rows=2]="Rows";e[e.Both=3]="Both";e[e.ColumnsAllCells=e.Columns|_AR_ALLCELLS]="ColumnsAllCells";e[e.RowsAllCells=e.Rows|_AR_ALLCELLS]="RowsAllCells";e[e.BothAllCells=e.Both|_AR_ALLCELLS]="BothAllCells"}(AllowResizing=exports.AllowResizing||(exports.AllowResizing={}));!function(e){e[e.None=0]="None";e[e.Headers=1]="Headers";e[e.Cells=2]="Cells";e[e.Both=3]="Both"}(AutoSizeMode=exports.AutoSizeMode||(exports.AutoSizeMode={}));!function(e){e[e.None=0]="None";e[e.Columns=1]="Columns";e[e.Rows=2]="Rows";e[e.Both=3]="Both"}(AllowDragging=exports.AllowDragging||(exports.AllowDragging={}));var _MouseHandler=function(){function _MouseHandler(e){var t=this,i=e.hostElement,o=e.addEventListener.bind(e),n=e.removeEventListener.bind(e);this._g=e;this._dvMarker=wijmo_1.createElement('<div class="wj-marker"> </div>');o(i,"mousedown",(function(i){e._rcBounds=null;if(!i.defaultPrevented&&0==i.button){var l=i.target;if(!e.containsFocus()){var r=l instanceof HTMLElement&&l.tabIndex>-1?l:e._eFocus;e._setFocusNoScroll(r)}setTimeout((function(){i.defaultPrevented||e.focus()}));var s=wijmo_1.closestClass(l,_WJC_FLEXGRID);if(s&&s!=e.hostElement||!e.activeEditor&&e._isInputElement(l)&&!t._hasRadioMap(i)&&!e._isNativeCheckbox(l)){var a=e.hitTest(i),c=CellType;switch(a.cellType){case c.Cell:e.select(a.range,!1);l instanceof HTMLElement&&"root"!=l.getAttribute("wj-part")&&l.focus();break;case c.ColumnHeader:case c.ColumnFooter:e.scrollIntoView(-1,a.col);break;case c.RowHeader:e.scrollIntoView(a.row,-1)}wijmo_1.isIE()&&a.cellType!=c.Cell&&e._isInputElement(l)&&l.focus();return}if(e._isNativeCheckbox(l)&&wijmo_1.hasClass(l,"wj-column-selector")&&e.hitTest(i).cellType==CellType.RowHeader)return;var u=document;n(u,"mousemove");n(u,"mouseup");o(u,"mousemove",mouseMove);o(u,"mouseup",mouseUp);t._isDown=!0;t._mousedown(i)}}));var mouseMove=function(e){t._mousemove(e)},mouseUp=function(e){t._isDown=!1;n(document,"mousemove");n(document,"mouseup");t._mouseup(e)};o(i,"mouseenter",(function(t){e._rcBounds=null}));o(i,"mousemove",this._hover.bind(this));o(i,"dblclick",this._dblclick.bind(this));o(i,"click",this._click.bind(this));o(i,"selectstart",(function(t){e._isInputElement(t.target)||t.preventDefault()}));wijmo_1.isSafari()&&o(i,"mousewheel",(function(t){t.defaultPrevented||!t.wheelDeltaY||t.ctrlKey||t.metaKey||(e._isScrollingByWheel=!0)}));o(i,"wheel",(function(t){if(!t.defaultPrevented&&t.deltaY&&!t.ctrlKey&&!t.metaKey){var i=e._root,o=t.deltaY;if((t.shiftKey?i.scrollWidth>i.clientWidth:i.scrollHeight>i.clientHeight)&&wijmo_1.closestClass(t.target,_WJC_FLEXGRID)==e.hostElement){switch(t.deltaMode){case 1:o=e.rows.defaultSize*(o<0?-1:1);break;case 2:o=(t.shiftKey?i.clientWidth:i.clientHeight)*(o<0?-1:1);break;case 0:default:wijmo_1.isSafari()&&(o=wijmo_1.clamp(o,-150,150))}e._isScrollingByWheel=!0;wijmo_1.isEdge()&&(wijmo_1.Control.sharedState.InvalidScroll=!1);e.finishEditing(!1)&&(t.shiftKey?i.scrollLeft+=o:i.scrollTop+=o);t.preventDefault();t.stopImmediatePropagation()}}}));o(i,"dragstart",this._dragstart.bind(this));o(i,"dragover",this._dragover.bind(this));o(i,"dragleave",this._dragleave.bind(this));o(i,"drop",this._drop.bind(this));o(i,"dragend",this._dragend.bind(this))}_MouseHandler.prototype.resetMouseState=function(){var e=this._g,t=e.hostElement;if(this._updating){this._updating=!1;e.endUpdate()}this._dragSrc&&wijmo_1.removeClass(this._dragSrc,_WJC_DRAGSRC);this._showDragMarker(null);t&&(t.style.cursor="");wijmo_1.isSafari()&&this._szRowCol&&e.invalidate();e.removeEventListener(document,"mousemove");e.removeEventListener(document,"mouseup");this._eMouse=null;this._isDown=null;this._htDown=null;this._lbSelState=null;this._lbSelStateRows={};this._lbSel=null;this._szRowCol=null;this._szArgs=null;e._rcBounds=null;this._anchorCol=-1};_MouseHandler.prototype._mousedown=function(e){var t=this._g,i=e.target,o=t.hitTest(e),n=o.cellType,l=CellType,r=e.ctrlKey||e.metaKey;this._selDown=t.selection;this._ignoreClick=!1;if(null==o.panel&&null==t.cells||o.panel&&t.cells&&o.panel._uid==t.cells._uid){if(wijmo_1.closestClass(i,CellFactory._WJC_DROPDOWN)){var s=t.hitTest(i);t._edtHdl._toggleListBox(e,s.range);e.preventDefault();this._ignoreClick=!0;return}var a=t.editRange;if(a&&a.contains(o.range)){wijmo_1.Control.sharedState.InvalidScroll=wijmo_1.isEdge();return}}var c=wijmo_1.getActiveElement();if(i!=c||!t._isInputElement(i))if(n!=l.None){this._htDown=o;this._eMouse=e;this._anchorCol=o.col;if(null==this._szRowCol){var u=t.allowResizing,d=AllowResizing;if((n==l.RowHeader||n==l.TopLeft)&&o.edgeBottom&&u&d.Rows&&this._getResizeRowHt(o))this._ignoreClick=!0;else if((n==l.ColumnHeader||n==l.TopLeft)&&o.edgeRight&&u&d.Columns&&this._getResizeColHt(o))this._ignoreClick=!0;else{var h=t.allowDragging,_=AllowDragging;switch(n){case l.Cell:case l.RowHeader:if(r&&t.selectionMode==SelectionMode.ListBox){this._lbSelState=t.rows[o.row].isSelected;wijmo_1.closest(i,".wj-elem-collapse")&&(this._lbSelState=!1)}this._mouseSelect(e,e.shiftKey);if(n==l.RowHeader&&!(h&_.Rows)){e.preventDefault();t.focus()}break;case l.ColumnHeader:t.allowSorting||h&_.Columns||wijmo_1.closest(i,"button")||this._mouseSelect(e,e.shiftKey)}}}else{var p=t._eFocus;if(c!=p){p.tabIndex=0;p.focus()}this._ignoreClick=!0;this._handleResizing(e)}}else{t.finishEditing();i!=t._root&&i!=t._fCt&&t._edtHdl._commitRowEdits()}};_MouseHandler.prototype._mousemove=function(e){if(this._htDown&&!e.defaultPrevented){if(0==e.buttons&&this._eMouse&&e.timeStamp-this._eMouse.timeStamp>600){this.resetMouseState();return}this._eMouse=e;if(this._szRowCol)this._handleResizing(e);else{var t=this._g,i=t.allowDragging,o=AllowDragging,n=CellType;switch(this._htDown.cellType){case n.Cell:this._mouseSelect(e,!0);break;case n.RowHeader:i&o.Rows||this._mouseSelect(e,!0);break;case n.ColumnHeader:i&o.Columns||t.allowSorting||this._mouseSelect(e,!0)}}}};_MouseHandler.prototype._mouseup=function(e){var t=this._g;if(!t.isTouching||!(this._dragSrc||e.target instanceof HTMLHtmlElement)){var i=t.hitTest(e),o=this._htDown;if(o&&!e.defaultPrevented){this._szArgs&&this._finishResizing(e);if(!this._szArgs&&(null==i.panel&&null==o.panel||i.panel&&o.panel&&i.panel._uid==o.panel._uid)&&i.row==o.row&&i.col==o.col){var n=i.getColumn();if(n){if(!(n._getFlag(RowColFlags.HasTemplate)&&!n.cellTemplate)){var l=i.target;if(l!=o.target&&l instanceof HTMLElement){if(o.target instanceof HTMLInputElement){var r=i.point,s=o.point;Math.abs(r.x-s.x)+Math.abs(r.y-s.y)<10&&(l=l.querySelector("input")||l)}var a=document.createEvent("Event");a.initEvent("click",!0,!0);for(var c in e)/Key$|X$|Y$|^button|^(x|y|which)$/.test(c)&&(a[c]=e[c]);l.dispatchEvent(a)}}}}}this.resetMouseState()}};_MouseHandler.prototype._click=function(e){if(this._ignoreClick){this._ignoreClick=!1;e.preventDefault()}if(!e.defaultPrevented){var t=this._g,i=e.target,o=t.hitTest(i),n=wijmo_1.tryCast(i,HTMLInputElement),l="input."+CellFactory._WJC_CHECKBOX;if(!n){var r=wijmo_1.closest(i,"label");r&&(n=r.querySelector(l))}!n&&t.bigCheckboxes&&(n=i.querySelector(l));if(n!=t.activeEditor&&t._isNativeCheckbox(n)){if(null==o.panel&&null==t.cells||o.panel&&t.cells&&o.panel._uid==t.cells._uid){var s=t.getCellData(o.row,o.col,!1);if(t.startEditing(!1,o.row,o.col,!1,e)){t.activeEditor.checked=!s;t.finishEditing();t.focus()}else"boolean"!=typeof s&&null!=s||(n.checked=s)}return}if(this._hasRadioMap(e)){this._handleClick(e);return}var a=e.ctrlKey||e.metaKey;if(t.rows.maxGroupLevel>-1&&wijmo_1.closestClass(i,CellFactory._WJC_COLLAPSE)){var c=t.rows[o.row];if(null==o.panel&&null==t.cells||o.panel&&t.cells&&o.panel._uid==t.cells._uid&&c instanceof GroupRow){a?t.collapseGroupsToLevel(c.isCollapsed?c.level+1:c.level):c.isCollapsed=!c.isCollapsed;return}}if(!a&&!e.shiftKey&&!t.activeEditor&&(null==o.panel&&null==t.cells||o.panel&&t.cells&&o.panel._uid==t.cells._uid)){var u=t._selHdl.selection;if(u.equals(this._selDown)&&o.range.contains(u)){t.startEditing(!0,null,null,!0,e);return}}this._handleClick(e)}};_MouseHandler.prototype._handleClick=function(e){var t=this._g,i=e.target,o=t.hitTest(i),n=e.ctrlKey||e.metaKey,l=o.panel;if(!e.defaultPrevented&&o.grid&&t&&o.grid._uid==t._uid){if(l&&t.cells&&l._uid==t.cells._uid&&this._hasRadioMap(e)){var r=wijmo_1.closest(i,"label"),s=r&&r.querySelector("input");s&&!s.disabled&&t.startEditing(!1,o.row,o.col,!1,e)&&t.finishEditing()&&(t._edtHdl._edtCanceled?e.preventDefault():t.setCellData(o.row,o.col,r.textContent,!0,t.refreshOnEdit));return}if(!t._isInputElement(i)){if(l&&t.topLeftCells&&l._uid==t.topLeftCells._uid){var a=SelectionMode;switch(t.selectionMode){case a.None:case a.Cell:break;default:t.selectAll()}return}if(l&&t.columnHeaders&&l._uid==t.columnHeaders._uid){if(t.allowPinning&&wijmo_1.closestClass(i,CellFactory._WJC_PIN))this._clickPin(e,o);else if(!t._isTransposed()&&wijmo_1.closestClass(e.target,CellFactory._WJC_COLLAPSE)){if(_=t._getColumnGroup(o.row,o.col))if(n){for(var c=_.isCollapsed,u=_.level,d=[],h=0;h<t.columns.length;h++)if((_=t._getColumnGroup(o.row,h))&&_.collapseTo&&_.level==u&&d.indexOf(_)<0){d.push(_);_.isCollapsed=!c}}else _.isCollapsed=!_.isCollapsed}else{i instanceof HTMLSpanElement&&i.parentElement instanceof HTMLLabelElement&&(i=i.parentElement.querySelector("input"));i instanceof HTMLInputElement||this._clickSort(e,o);t.focus()}return}if(l&&t.rowHeaders&&l._uid==t.rowHeaders._uid){if(t._isTransposed()&&wijmo_1.closestClass(e.target,CellFactory._WJC_COLLAPSE)){var _;if(_=t._getColumnGroup(o.row,o.col))if(n){c=_.isCollapsed,u=_.level,d=[];for(var p=0;p<t.rows.length;p++)if((_=t._getColumnGroup(p,o.col))&&_.collapseTo&&_.level==u&&d.indexOf(_)<0){d.push(_);_.isCollapsed=!c}}else _.isCollapsed=!_.isCollapsed}return}if(l&&t.cells&&l._uid==t.cells._uid){if(o.row<0){this._clickSort(e,o);return}if(wijmo_1.closestClass(i,CellFactory._WJC_COLLAPSE)){var f=t.rows[o.row];f instanceof GroupRow&&(n?t.collapseGroupsToLevel(f.isCollapsed?f.level+1:f.level):f.isCollapsed=!f.isCollapsed);return}wijmo_1.closestClass(i,CellFactory._WJC_DROPDOWN)&&t._edtHdl._toggleListBox(e,o.range)}}}};_MouseHandler.prototype._hasRadioMap=function(e){var t=e.target;if(wijmo_1.closest(t,"label")){var i=wijmo_1.closestClass(t,CellFactory._WJC_RADIOMAP);return wijmo_1.closestClass(i,_WJC_FLEXGRID)==this._g.hostElement}return!1};_MouseHandler.prototype._clickSort=function(e,t){var i=this._g,o=i.allowSorting,n=i.collectionView,l=n?n.sortDescriptions:null,r=e.ctrlKey||e.metaKey,s=e.shiftKey;if(n&&n.canSort&&o!=AllowSorting.None){var a=t.panel.columns[t.col],c=i._getBindingColumn(t.panel,t.row,a),u=c?c._getBindingSort():null;if(c.allowSorting&&u){if(a&&c&&a._uid==c._uid){var d=i.getMergedRange(t.panel,t.row,t.col,!1);if(d&&d.columnSpan>1)return}var h=new CellRangeEventArgs(t.panel,t.range,e);if(i.onSortingColumn(h)){i._edtHdl._commitRowEdits();for(var _=-1,p=null,f=0;f<l.length;f++)if(l[f].property==u){_=f;p=l[f];break}l.deferUpdate((function(){if(r&&s)l.clear();else if(p){var e=r;!e&&i.isTouching&&(e=0==p.ascending);e?l.removeAt(_):l[_]=new wijmo_1.SortDescription(u,!p.ascending)}else{o!=AllowSorting.MultiColumn&&l.clear();var t=new wijmo_1.SortDescription(u,!0);l.push(t)}}));i.onSortedColumn(h)}}}};_MouseHandler.prototype._clickPin=function(e,t){var i=this._g,o=i.columns,n=o.frozen,l=i.allowPinning;l==AllowPinning.Both&&(l=e.shiftKey?AllowPinning.ColumnRange:AllowPinning.SingleColumn);var r=new CellRangeEventArgs(i.cells,t.range);if(i.onPinningColumn(r)){if(l==AllowPinning.SingleColumn)if(t.col>=n){o.moveElement(t.col,n,!1);o.frozen++}else{o.moveElement(t.col,n-1,!1);o.frozen--}l==AllowPinning.ColumnRange&&(t.col+1!=n?o.frozen=t.col+1:o.frozen=0);i.onPinnedColumn(r)}};_MouseHandler.prototype._dblclick=function(e){if(!e.defaultPrevented){var t,i=this._g,o=i.hitTest(e),n=e.ctrlKey||e.metaKey,l=o.range,r=o.cellType,s=CellType,a=i.selection,c=i.allowResizing,u=AllowResizing;if(o.edgeRight&&c&u.Columns){if(r==s.TopLeft){if(o.panel.columns[o.col].allowResizing){t=new CellRangeEventArgs(o.panel,new CellRange(-1,o.col));if(i.onAutoSizingColumn(t)&&i.onResizingColumn(t)){this._ignoreClick=!0;i.autoSizeColumn(o.col,!0);i.onAutoSizedColumn(t);i.onResizedColumn(t);e.preventDefault()}}}else if(r==s.ColumnHeader||c&_AR_ALLCELLS){r==s.ColumnHeader&&n&&a.containsColumn(o.col)&&(l=a);for(var d=r==s.RowHeader||r==s.BottomLeft,h=l.leftCol;h<=l.rightCol;h++)if(o.panel.columns[h].allowResizing){t=new CellRangeEventArgs(o.panel,new CellRange(-1,h));if(i.onAutoSizingColumn(t)&&i.onResizingColumn(t)){this._ignoreClick=!0;i.autoSizeColumn(h,d);i.onResizedColumn(t);i.onAutoSizedColumn(t);e.preventDefault()}}}this.resetMouseState()}else if(o.edgeBottom&&c&u.Rows){if(r==s.TopLeft||r==s.BottomLeft){if(o.getRow().allowResizing){d=r==s.TopLeft||null;t=new CellRangeEventArgs(o.panel,new CellRange(o.row,-1));if(i.onAutoSizingRow(t)&&i.onResizingRow(t)){this._ignoreClick=!0;i.autoSizeRow(o.row,d);i.onResizedRow(t);i.onAutoSizedRow(t);e.preventDefault()}}}else if(r==s.RowHeader||c&_AR_ALLCELLS){var _=o.panel;d=_==i.columnHeaders||_==i.columnFooters&&null;n&&a.containsRow(o.row)&&_&&i.cells&&_._uid==i.cells._uid&&(l=a);for(var p=l.topRow;p<=l.bottomRow;p++)if(_.rows[p].allowResizing){t=new CellRangeEventArgs(_,new CellRange(p,-1));if(i.onAutoSizingRow(t)&&i.onResizingRow(t)){this._ignoreClick=!0;i.autoSizeRow(p,d);i.onResizedRow(t);i.onAutoSizedRow(t);e.preventDefault()}}}this.resetMouseState()}else;}};_MouseHandler.prototype._hover=function(e){if(!this._isDown){var t=this._g,i=t.hitTest(e),o="";this._szRowCol=this._getResizeColHt(i)||this._getResizeRowHt(i);this._szRowCol instanceof Column?o="col-resize":this._szRowCol instanceof Row&&(o="row-resize");this._szStart=this._szRowCol?this._szRowCol.renderSize:0;t.hostElement.style.cursor=o;return i}return null};_MouseHandler.prototype._getResizeColHt=function(e){var t,i=this._g.allowResizing,o=e.cellType,n=CellType;if(i&AllowResizing.Columns&&(o==n.ColumnHeader||o==n.TopLeft||i&_AR_ALLCELLS)){e.edgeRight&&(t=e.getColumn());e.edgeFarRight&&(t=this._getResizeCol(e.panel,e.col)||e.getColumn());e.edgeLeft&&(t=this._getResizeCol(e.panel,e.col,!0)||t)}return t&&t.allowResizing?t:null};_MouseHandler.prototype._getResizeRowHt=function(e){var t,i=this._g.allowResizing,o=AllowResizing,n=e.cellType,l=CellType;if(i&o.Rows&&(n==l.RowHeader||n==l.TopLeft||i&_AR_ALLCELLS)){e.edgeBottom&&(t=e.getRow());e.edgeFarBottom&&(t=this._getResizeRow(e.panel,e.row)||e.getRow());e.edgeTop&&(t=this._getResizeRow(e.panel,e.row,!0)||t)}return t&&t.allowResizing?t:null};_MouseHandler.prototype._getResizeCol=function(e,t,i){void 0===i&&(i=!1);var o=this._g,n=e.columns;if(i){for(var l=t-1;l>=0;l--){if((r=n[l]).isVisible)return this._asResizable(r)}if(n==o.columns&&0!=(o.headersVisibility&HeadersVisibility.Row))for(l=(n=o.rowHeaders.columns).length-1;l>=0;l--){if((r=n[l]).isVisible)return this._asResizable(r)}return null}for(l=t+1;l<n.length;l++){if((r=n[l]).isVisible)return this._asResizable(r)}if(t==n.length-1&&n==o.rowHeaders.columns){n=o.columns;for(l=0;l<n.length;l++){var r;if((r=n[l]).isVisible)return this._asResizable(r)}}return null};_MouseHandler.prototype._getResizeRow=function(e,t,i){void 0===i&&(i=!1);var o=this._g,n=e.rows;if(i){for(var l=t-1;l>=0;l--){if((r=n[l]).isVisible)return this._asResizable(r)}if(n==o.rows&&0!=(o.headersVisibility&HeadersVisibility.Column))for(l=(n=o.columnHeaders.rows).length-1;l>=0;l--){if((r=n[l]).isVisible)return this._asResizable(r)}return null}for(l=t+1;l<n.length;l++){if((r=n[l]).isVisible)return this._asResizable(r)}if(t==n.length-1&&n==o.columnHeaders.rows){n=o.rows;for(l=0;l<n.length;l++){var r;if((r=n[l]).isVisible)return this._asResizable(r)}}return null};_MouseHandler.prototype._asResizable=function(e){return 0==e.renderSize&&e.allowResizing?e:null};_MouseHandler.prototype._mouseSelect=function(e,t){var i=this,o=this._g;if(e&&this._htDown&&this._htDown.panel&&o.selectionMode!=SelectionMode.None){var n=new HitTestInfo(this._htDown.panel,e);this._handleSelection(n,t);!wijmo_1.isIE9()&&e.button>=0&&e.target!=o._root&&((n=new HitTestInfo(o,e)).panel||setTimeout((function(){i._isDown&&i._eMouse&&i._mouseSelect(i._eMouse,t)}),100))}};_MouseHandler.prototype._handleResizing=function(e){"mousedown"==e.type&&(wijmo_1.isSafari()?wijmo_1.setAttribute(e.target,"draggable",null):e.preventDefault());var t=this._szRowCol,i=CellType;if(t instanceof Column){var o=this._g,n=wijmo_1.mouseToPage(e).x,l=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(n-this._htDown.point.x)*(o.rightToLeft?-1:1)));if(t.renderSize!=l){if(null==this._szArgs){var r=o.rowHeaders.columns.indexOf(t)>-1?o.rowHeaders:o.cells;this._szArgs=new CellRangeEventArgs(r,new CellRange(-1,t.index))}this._szArgs.cancel=!1;if(o.onResizingColumn(this._szArgs))if(o.deferResizing){var s=o.columns.indexOf(t);if(o.columns.isFrozen(s)&&(this._htDown.cellType==i.ColumnHeader||this._htDown.cellType===i.Cell)){for(var a=0,c=0;c<o.columns.frozen;c++)c!=s&&(a+=null==o.columns[c].width?o.columns[c].renderWidth:o.columns[c].width);var u=o._szClient.width-a-5;l>u&&(l=u)}this._showResizeMarker(l)}else t.width=l}}var d=this._szRowCol;if(d instanceof Row){o=this._g;var h=wijmo_1.mouseToPage(e).y;l=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(h-this._htDown.point.y)));if(d.renderSize!=l){if(null==this._szArgs){r=o.columnHeaders.rows.indexOf(d)>-1?o.columnHeaders:o.columnFooters.rows.indexOf(d)>-1?o.columnFooters:o.cells;this._szArgs=new CellRangeEventArgs(r,new CellRange(d.index,-1))}this._szArgs.cancel=!1;if(o.onResizingRow(this._szArgs))if(o.deferResizing){var _=o.rows.indexOf(d);if(o.rows.isFrozen(_)&&(this._htDown.cellType==i.RowHeader||this._htDown.cellType===i.Cell)){var p=0;for(c=0;c<o.rows.frozen;c++)c!=_&&(p+=null==o.rows[c].height?o.rows[c].renderHeight:o.rows[c].height);var f=o._szClient.height-p-5;l>f&&(l=f)}this._showResizeMarker(l)}else d.height=l}}this._szArgs&&e.preventDefault()};_MouseHandler.prototype._dragstart=function(e){var t=this._g,i=this._htDown,o=AllowDragging,n=CellType;if(i){this._dragSrc=null;this._htDrag=null;this._chldColGrpMarker=!1;if(!this._szRowCol){var l=new CellRangeEventArgs(i.panel,i.range),r=t.allowDragging,s=i.cellType,a=i.panel.rows,c=i.getColumn(!0);c&&c.allowDragging&&(s==n.ColumnHeader||s==n.TopLeft)&&r&o.Columns&&(t.onDraggingColumn(l)?this._dragSrc=e.target:e.preventDefault());if(!this._dragSrc&&i.row>-1&&a[i.row].allowDragging){var u=a[i.row];u instanceof GroupRow||u instanceof _NewRowTemplate||s==n.RowHeader&&r&o.Rows&&(t.onDraggingRow(l)?this._dragSrc=e.target:e.preventDefault())}}if(this._dragSrc&&e.dataTransfer&&!e.defaultPrevented){this._htDrag=i;wijmo_1._startDrag(e.dataTransfer,"move");e.stopPropagation();wijmo_1.addClass(this._dragSrc,_WJC_DRAGSRC);t.beginUpdate();this._updating=!0}}};_MouseHandler.prototype._dragend=function(e){this._dragSrc=null;this._htDrag=null;this.resetMouseState()};_MouseHandler.prototype._dragover=function(e){var t=this._g,i=this._hitTest(e),o=this._dragSrc?this._htDrag:null,n=CellType,l=!1;if(o&&i.cellType==o.cellType){var r=new CellRangeEventArgs(i.panel,i.range,o);if(i.cellType==n.ColumnHeader&&t._hasColumnGroups()){r.cancel=!t._canMoveColumnGroup(o.row,o.col,i.row,i.col);l=t.onDraggingColumnOver(r)}else if(i.cellType==n.ColumnHeader){r.cancel=!t.columns.canMoveElement(o.col,i.col);l=t.onDraggingColumnOver(r)}else if(i.cellType==n.RowHeader){r.cancel=!t.rows.canMoveElement(o.row,i.row);l=t.onDraggingRowOver(r)}else if(i.cellType==n.TopLeft){r.cancel=!t.topLeftCells.columns.canMoveElement(o.col,i.col);l=t.onDraggingColumnOver(r)}}if(l){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation();this._showDragMarker(i)}else this._showDragMarker(null);if(o&&t.autoScroll){var s=t.controlRect,a=t.scrollPosition,c=wijmo_1.Control._DRAG_SCROLL_EDGE,u=wijmo_1.Control._DRAG_SCROLL_STEP;if(o.panel==t.columnHeaders){e.pageX-s.left<c&&(a.x+=u);s.right-e.pageX<c&&(a.x-=u)}else if(o.panel==t.rowHeaders){e.pageY-s.top<c&&(a.y+=u);s.bottom-e.pageY<c&&(a.y-=u)}if(!a.equals(t._ptScrl)){t.scrollPosition=a;t._rcBounds=null}}};_MouseHandler.prototype._dragleave=function(e){this._showDragMarker(null)};_MouseHandler.prototype._drop=function(e){var t=this._g,i=this._hitTest(e),o=this._dragSrc?this._htDrag:null,n=CellType;if(o&&i.cellType==o.cellType){var l=t.selection,r=new CellRangeEventArgs(i.panel,i.range,o);if(i.cellType==n.ColumnHeader&&t._hasColumnGroups()){var s=t._getColumnGroup(o.row,o.col).columns.length,a=s>0?s:1,c=t.columns.frozen;t._moveColumnGroup(o.row,o.col,i.row,i.col,this._chldColGrpMarker);o.col<c&&i.col>=c?t.columns.frozen-=a:o.col>=c&&i.col<c&&(t.columns.frozen+=a);t.select(l.row,i.col);t.onDraggedColumn(r)}else if(i.cellType==n.ColumnHeader){t.columns.moveElement(o.col,i.col);t.select(l.row,i.col);t.onDraggedColumn(r)}else if(i.cellType==n.RowHeader){t.rows.moveElement(o.row,i.row);t.select(i.row,l.col);t.onDraggedRow(r)}else if(i.cellType==n.TopLeft){t.topLeftCells.columns.moveElement(o.col,i.col);t.onDraggedColumn(r)}}this.resetMouseState()};_MouseHandler.prototype._hitTest=function(e){var t=this._g;t._rcBounds=null;return t.hitTest(e)};_MouseHandler.prototype._showResizeMarker=function(e){var t,i=this._g,o=i._ptScrl,n=this._szArgs.panel.cellType,l=CellType,r=this._dvMarker,s=i.cells.hostElement;r.parentElement!=s&&s.appendChild(r);if(this._szRowCol instanceof Column){t={left:this._szRowCol.pos+e-1,top:-1e3,right:"",bottom:0,width:3,height:""};n!=l.TopLeft&&n!=l.RowHeader||(t.left-=i._eTL.offsetWidth+o.x);n==l.Cell&&this._szRowCol.index<i.columns.frozen&&(t.left-=o.x);i.rightToLeft&&(t.left=s.clientWidth-t.left-t.width)}else{t={left:-1e3,top:this._szRowCol.pos+e-1,right:0,bottom:"",width:"",height:3};n!=l.TopLeft&&n!=l.ColumnHeader||(t.top-=i._eTL.offsetHeight+o.y);n==l.Cell&&this._szRowCol.index<i.rows.frozen&&(t.top-=o.y)}wijmo_1.setCss(r,t)};_MouseHandler.prototype._showDragMarker=function(e){var t=this._dvMarker;if(e&&e.panel){if(!e.range.equals(this._rngTarget)){this._rngTarget=e.range;var i=e.panel.hostElement;t.parentElement!=i&&i.appendChild(t);var o=this._g,n=o._ptScrl,l=CellType,r={left:0,top:0,width:6,height:6,right:"",bottom:""};switch(e.cellType){case l.ColumnHeader:var s=o._getColumnGroup(e.row,e.col);if(s){var a=s._rng,c=e.panel.rows,u=e.panel.columns;if(s.isEmpty&&null===s.binding){var d=c[a.bottomRow],h=u[a.leftCol],_=o.rightToLeft,p=_?t.parentElement.clientWidth-e.point.x:e.point.x,f=Math.max(h.renderWidth/5,_MouseHandler._SZ_MAX_COLGRP_EDGE),g=h.pos+f,m=h.pos+h.renderWidth-f,w=this._htDown&&e.col>this._htDown.col;if(!w&&p>g||w&&p<m){r.top=d.pos-r.height/2+d.renderHeight;r.left=_?t.parentElement.clientWidth-h.pos-h.renderWidth:h.pos;r.width=h.renderWidth;this._chldColGrpMarker=!0;break}}this._chldColGrpMarker=!1;r.top=0;r.height=0;for(var C=0;C<a.topRow;C++)r.top+=c[C].renderHeight;for(C=a.topRow;C<=a.bottomRow;C++)r.height+=c[C].renderHeight;r.left=0;if(this._htDown&&e.col>this._htDown.col){var v=u[a.rightCol];r.left=v.pos-r.width/2+v.renderWidth}else{var y=u[a.leftCol];r.left=y.pos-r.width/2}o.rightToLeft&&(r.left=t.parentElement.clientWidth-r.left-r.width);break}case l.TopLeft:case l.ColumnHeader:var b=e.panel.columns[e.col];r.left=b.pos-r.width/2;r.height=e.panel.height;this._htDown&&e.col>this._htDown.col&&(r.left+=b.renderWidth);e.cellType==l.ColumnHeader&&e.col<o.columns.frozen&&(r.left-=n.x);o.rightToLeft&&(r.left=t.parentElement.clientWidth-r.left-r.width);break;case l.RowHeader:var R=e.getRow();r.top=R.pos-r.height/2;r.width=e.panel.width;e.row>this._htDown.row&&(r.top+=R.renderHeight);e.row<o.rows.frozen&&(r.top-=n.y)}wijmo_1.setCss(t,r)}}else{wijmo_1.removeChild(t);this._rngTarget=null}};_MouseHandler.prototype._finishResizing=function(e){var t=this._g,i=t.selection,o=this._szArgs,n=this._eMouse,l=n&&(n.ctrlKey||n.metaKey),r=CellType;if(o&&!o.cancel){if(o.col>-1){var s=o.col,a=wijmo_1.mouseToPage(e).x,c=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(a-this._htDown.point.x)*(this._g.rightToLeft?-1:1)));if(t.columns.isFrozen(s)&&(this._htDown.cellType==r.ColumnHeader||this._htDown.cellType===r.Cell)){for(var u=0,d=0;d<t.columns.frozen;d++)d!=s&&(u+=null==t.columns[d].width?t.columns[d].renderWidth:t.columns[d].width);var h=t._szClient.width-u-5;c>h&&(c=h)}o.panel.columns[s].width=Math.round(c);t.onResizedColumn(o);if(l&&this._htDown.cellType==r.ColumnHeader&&i.containsColumn(s)){for(var _=t.columns[s].size,p=i.leftCol;p<=i.rightCol;p++)if(t.columns[p].allowResizing&&p!=s){o=new CellRangeEventArgs(t.cells,new CellRange(-1,p));if(t.onResizingColumn(o)){if(t.columns.isFrozen(p)){u=t.columns[s].size*t.columns.frozen;t._szClient.width<=u&&(_=t._szClient.width/t.columns.frozen-5)}t.columns[p].size=_;t.onResizedColumn(o)}}t.columns.isFrozen(s)&&(t.columns[s].size=_)}e.preventDefault()}if(o.row>-1){var f=o.row,g=wijmo_1.mouseToPage(e).y;c=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(g-this._htDown.point.y)));if(t.rows.isFrozen(f)&&(this._htDown.cellType==r.RowHeader||this._htDown.cellType===r.Cell)){var m=0;for(d=0;d<t.rows.frozen;d++)d!=f&&(m+=null==t.rows[d].height?t.rows[d].renderHeight:t.rows[d].height);var w=t._szClient.height-m-5;c>w&&(c=w)}o.getRow().height=Math.round(c);if("setHeights"in t){var C=t;C.setHeights(Array.from(C.rows).map((function(e){return e.height})))}t.onResizedRow(o);if(l&&this._htDown.cellType==r.RowHeader&&i.containsRow(f)){for(var v=t.rows[f].size,y=i.topRow;y<=i.bottomRow;y++)if(t.rows[y].allowResizing&&y!=f){o=new CellRangeEventArgs(t.cells,new CellRange(y,-1));if(t.onResizingRow(o)){if(t.rows.isFrozen(y)){var b=t.rows[f].size*t.rows.frozen;t._szClient.height<=b&&(v=t._szClient.height/t.rows.frozen-5)}t.rows[y].size=v;t.onResizedRow(o)}}t.rows.isFrozen(f)&&(t.rows[f].size=v)}t.rows[f].resizedManually=!0;e.preventDefault()}}};_MouseHandler.prototype._handleSelection=function(e,t){var i=this._g,o=i._selHdl.selection,n=new CellRange(e.row,e.col),l=CellType,r=SelectionMode,s=null,a=e.col>=this._anchorCol;if(n.isValid)if(null==this._lbSelState){e.cellType!=l.ColumnHeader&&i._clearAnchorCell();switch(e.cellType){case l.RowHeader:n.col=0;n.col2=i.columns.length-1;break;case l.ColumnHeader:switch(i.selectionMode){case r.Row:case r.Cell:n.row=n.row2=o.row;t=!1;break;default:n.row=0;n.row2=i.rows.length-1;if(null!=(s=i._getColumnGroup(e.row,e.col))){if(i.anchorCursor){s._rng.col<=this._anchorCol&&this._anchorCol<=s._rng.col2&&(this._anchorCol=s._rng.col2);i._setAnchorCell(0,this._anchorCol)}else s._rng.col<this._anchorCol&&this._anchorCol<=s._rng.col2&&(this._anchorCol=s._rng.col);if(a){n.col=s._rng.col2;n.col2=s._rng.col}else{n.col=s._rng.col;n.col2=s._rng.col2;o.col2<n.col2&&(o.col2=n.col2)}}}}if(t){if(e.cellType==l.ColumnHeader){i.anchorCursor?null==i._getAnchorCell()&&i.selectionMode!=SelectionMode.Row&&i.selectionMode!=SelectionMode.Cell&&i._setAnchorCell(o.row,o.col):i._clearAnchorCell();n.row2=o.row2;!a&&o.col>o.col2?n.col2=o.col:n.col2=o.col2;null!=s&&a&&n.col2>s._rng.col&&(n.col2=s._rng.col)}else if(i.anchorCursor){n.row=o.row;n.col=o.col}else{n.row2=o.row2;n.col2=o.col2}if(!n.isValid){var c=this._htDown;c&&(n=new CellRange(c.row,c.col))}}if(i.selectionMode==SelectionMode.MultiRange){var u=i._mouseHdl._eMouse,d=u&&(u.ctrlKey||u.metaKey),h=i._selHdl,_=h.selection,p=h.extendedSelection,f=e.panel!=i.cells;wijmo_1.closest(u.target,".wj-elem-collapse")&&(d=!1);if(d){if(!t&&h._deselectRange(n))h.selection.isValid&&(n=null);else if(_.isValid&&(f||!_.intersects(n))){var g=this._g,m=g._selHdl,w=m.extendedSelection;if(g._getProductInfo().indexOf("MultiRow")>-1){var C=!1;_=m.selection.clone();for(x=0;x<w.length&&!C;x++)w[x].equals(_)&&(C=!0);C||w.push(_)}else{var v=m.selection;(f?this._splitRange(v):[v.clone()]).forEach((function(e){for(var t=!1,i=0;i<w.length&&!t;i++)w[i].equals(e)&&(t=!0);t||w.push(e)}))}}}else p.clear()}if(n){i.select(n,!1);switch(e.cellType){case l.RowHeader:i.scrollIntoView(e.row,-1);break;case l.ColumnHeader:i.scrollIntoView(-1,e.col);break;default:i.scrollIntoView(e.row,e.col)}}else{var y=new CellRangeEventArgs(i.cells,new CellRange(e.row,e.col));i.onSelectionChanging(y);i.onSelectionChanged(y);i.invalidate()}}else{var b=this._htDown.row,R=e.row,j=this._lbSel;if(b>R){R=b;b=e.row}var E=this._lbSelStateRows||{};if(this._lbSel)for(var x=j.row;x<=j.row2;x++)(x<b||x>R)&&(i.rows[x].isSelected=E[x]);for(var x=b;x<=R;x++){E.hasOwnProperty(x)||(E[x]=i.rows[x].isSelected);i.rows[x].isSelected=!this._lbSelState}this._lbSel=new CellRange(b,0,R,0);i.scrollIntoView(e.row,e.col)}};_MouseHandler.prototype._splitRange=function(e){var t=this._g,i=t.columns.length,o=t.rows.length,n=[];if(e.columnSpan==i)for(var l=e.topRow;l<=e.bottomRow;l++)n.push(new CellRange(l,0,l,i-1));else if(e.rowSpan==o)for(var r=e.leftCol;r<=e.rightCol;r++)n.push(new CellRange(0,r,o-1,r));else n.push(e.clone());return n};_MouseHandler._SZ_MIN=0;_MouseHandler._SZ_MAX_COLGRP_EDGE=50;return _MouseHandler}();exports._MouseHandler=_MouseHandler;wijmo_1._registerModule("wijmo.grid",selfModule);
|