UNPKG

@mescius/wijmo.grid

Version:

UI library for pure JS, Angular, React, Vue and more...

14 lines (13 loc) 344 kB
/*! * * Wijmo Library 5.20251.40 * https://developer.mescius.com/wijmo * * Copyright(c) MESCIUS inc. All rights reserved. * * Licensed under the End-User License Agreement For MESCIUS Wijmo Software. * us.sales@mescius.com * https://developer.mescius.com/wijmo/licensing * */ "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 __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)},__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]}}}exports.FlexGridClsNames={alt:"wj-alt",bigHeader:"wj-big-header",bottomLeft:"wj-bottomleft",cell:"wj-cell",cellCheck:"wj-cell-check",cellIndex:"wj-cell-index",cells:"wj-cells",colFooters:"wj-colfooters",colGroup:"wj-colgroup",colHeaders:"wj-colheaders",elemCollapse:"wj-elem-collapse",elemCollapseSpace:"wj-elem-collapse-space",elemDropDown:"wj-elem-dropdown",elemPin:"wj-elem-pin",errorTip:"wj-error-tip",focusHeaderCell:"wj-focus-header-cell",frozen:"wj-frozen",frozenClone:"wj-frozen-clone",frozenCol:"wj-frozen-col",frozenColLeft:"wj-frozen-col-left",frozenColRight:"wj-frozen-col-right",frozenColRightEdge:"wj-frozen-col-right-edge",frozenRow:"wj-frozen-row",frozenRowBottom:"wj-frozen-row-bottom",gridEditor:"wj-grid-editor",gridIme:"wj-grid-ime",gridListBox:"wj-grid-listbox",group:"wj-group",groupSummary:"wj-group-summary",hasDropDown:"wj-hasdropdown",header:"wj-header",headerAlt:"wj-header-alt",hostElement:"wj-flexgrid",lastFrozenRow:"wj-last-frozen-row",lastFrozenRowBottom:"wj-last-frozen-row-bottom",lastVisibleCol:"wj-last-visible-col",lastVisibleRow:"wj-last-visible-row",marker:"wj-marker",marquee:"wj-marquee",multiline:"wj-multiline",new:"wj-new",radioMap:"wj-radio-map",row:"wj-row",rowHeaders:"wj-rowheaders",sortAsc:"wj-sort-asc",sortDesc:"wj-sort-desc",sortIndex:"wj-sort-index",topLeft:"wj-topleft",whiteSpacePre:"wj-whitespace-pre",wrap:"wj-wrap",noDataOverlay:"wj-no-data-overlay",screenReaderOnly:"wj-sr-only"};exports._CustomEditorClsNames={editorsContainer:"wj-grid-editors-container"};!function(e){e[e.AutoComplete=0]="AutoComplete";e[e.DropDownList=1]="DropDownList";e[e.RadioButtons=2]="RadioButtons";e[e.Menu=3]="Menu"}(DataMapEditor=exports.DataMapEditor||(exports.DataMapEditor={}));var DataMap=function(){function DataMap(e,t,i){this._keyPath="";this._displayPath="";this._sortByVal=!0;this._editable=!1;this._useFilter=!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.getFilteredItems=function(e){return this._cv?this._cv.items:[]};Object.defineProperty(DataMap.prototype,"useFilter",{get:function(){return this._useFilter},set:function(e){this._useFilter=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});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,r=-1;if(this._cv&&t){var l=null!=e?e.toString():"";l&&i&&(e=wijmo_1.toPlainText(l));for(var s=o?l:l.toLowerCase(),a=this._cv.sourceCollection,d=0;d<a.length;d++){var c=a[d],u=c?c[t]:void 0;null!=u&&null!=u||(u="");i&&wijmo_1.isString(u)&&(u=wijmo_1.toPlainText(u));u==e?n=d:o||u.length!=s.length||u.toLowerCase()!=s?null!=u&&u.toString()==l&&(n=d):n=d;if(n==d){if(!this._cv.filter||this._cv.filter(c))return n;r<0&&(r=n)}}}return r};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,"activeCell",{get:function(){return this._activeCell},enumerable:!0,configurable:!0});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){t=this._toIndex(t);return this._getCellData(e,t,i)};GridPanel.prototype._getCellData=function(e,t,i){var o,n,r=this._g,l=this._rows[wijmo_1.asNumber(e,!1,!0)];if(!l)return null;o=this._cols[wijmo_1.asNumber(t,!1,!0)];var s=r?r._getBindingColumn(this,e,o):o,a=null,d=l instanceof GroupRow;d&&l.dataItem instanceof wijmo_1.CollectionViewGroup&&!r.childItemsPath&&(a=l.dataItem);s&&l&&s.binding&&l.dataItem&&!a?n=s._binding.getValue(l.dataItem):l._ubv&&(n=l._ubv[o._hash]);null==n&&(n=this._getSpecialData(e,l,t,o,s,d,a,n));if(i){var c=s.dataMap||l.dataMap;if(this.cellType==CellType.Cell&&s._edt&&s._edt._ctl instanceof wijmo_input_1.MultiSelect&&n){var u=new wijmo_1.Binding(s._edt._ctl.displayMemberPath),h=u&&wijmo_1.isArray(n)?n.map((function(e){return u.getValue(e)})):n;if(wijmo_1.isArray(h)&&h.length>0){var _=h.join(", ");n=wijmo_1.format(_||wijmo_1.culture.MultiSelect.itemsSelected,{count:h.length})}}else this.cellType==CellType.Cell&&c&&(n=c.getDisplayValue(n));n=null!=n?wijmo_1.Globalize.format(n,s.format||l.format):""}return n};GridPanel.prototype.setCellData=function(e,t,i,o,n,r){void 0===o&&(o=!0);void 0===n&&(n=!0);void 0===r&&(r=!1);var l=this._g,s=this._rows[wijmo_1.asNumber(e,!1,!0)],a=wijmo_1.asNumber(this._toIndex(t),!1,!0),d=this._cols[a],c=wijmo_1.DataType;if(!s)return!1;var u=l?l._getBindingColumn(this,e,d):d;if(!u)return!1;var h=u.dataMap||s.dataMap;if(this._ct==CellType.Cell){var _=u.getIsRequired(s),p=u.isContentHtml||s.isContentHtml;if(!r&&h&&null!=i){var g=h.getKeyValue(i,p);if(null==g&&null==h.getDisplayValue(null)){if(h.getDisplayValue(i)!=i);else if(!h.isEditable||h.displayMemberPath!=h.selectedValuePath){if(""!=i||_||!l.commitEmptyEdits)return!1;i=null}}else{var f=l.getRowDataItem(e,a);if(h.useFilter&&f){var m=h.getFilteredItems(f);if(!(m.length>0))return!1;if(m.filter((function(e){return e[h._keyPath]==g})).length>0)i=g;else{var w=m.filter((function(e){return e[h.displayMemberPath]==i}));w.length>0&&(i=w[0][h._keyPath])}}else i=g}}var C=c.Object,v=u.dataType||s.dataType,y=this.getCellData(e,t,!1);this.cellType==CellType.Cell&&u._edt&&u._edt._ctl instanceof wijmo_input_1.MultiSelect&&i&&(v=c.Array);C=v||wijmo_1.getType(y);if(null==i||""===i&&o&&!h){if(_||!l.commitEmptyEdits&&(null==y||""===y))return!1;C!=c.String&&(i=null);o=!1}if("NaN"==i&&Number.isNaN(y)&&!l.commitEmptyEdits)return!1;if(o){var b=u.format||s.format;b||C!=c.Date||(b="d");u.mask&&wijmo_1.isString(i)&&C!=c.String&&(i=i.replace(/_/g,""));i=wijmo_1.changeType(i,C,b,y);if(C!=c.Object&&wijmo_1.getType(i)!=C)return!1}}if(s.dataItem&&u.binding){var R=u._binding,x=s.dataItem,S=R.getValue(x);if(i!==S&&(h&&!h.serializeKeys||!wijmo_1.DateTime.equals(i,S))){var E=l.collectionView,j=E instanceof wijmo_1.CollectionView&&x!=E.currentEditItem&&E.trackChanges,H=null;j&&(H=E._extend({},x));R.setValue(x,i);if(j){var F=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,x,E.items.indexOf(x));E.onCollectionChanged(F,H)}}}else{s._ubv||(s._ubv={});s._ubv[d._hash]=i}n&&l&&l.invalidate();return!0};GridPanel.prototype._getRowData=function(e){var t,i=this._g,o=this._rows[wijmo_1.asNumber(e,!1,!0)],n=null,r=[];if(null!=o){var l=null,s=o instanceof GroupRow;s&&o.dataItem instanceof wijmo_1.CollectionViewGroup&&!i.childItemsPath&&(l=o.dataItem);for(var a=!l&&o.dataItem,d=0;d<i.columns.length;d++){var c=t=this._cols[d];a&&i&&(c=i._getBindingColumn(this,e,t));c.binding?n=c._binding.getValue(o.dataItem):o._ubv&&(n=o._ubv[t._hash]);null==n&&(n=this._getSpecialData(e,o,d,t,c,s,l,n));r[d]=n}}return r};GridPanel.prototype._getSpecialData=function(e,t,i,o,n,r,l,s){var a=s,d=CellType;switch(this._ct){case d.TopLeft:case d.ColumnHeader:e!=this._rows.length-1&&n==o||(a=n.header);break;case d.ColumnFooter:if(r&&n.aggregate!=wijmo_1.Aggregate.None){var c=this._g.collectionView;if(c){var u=wijmo_1.tryCast(c,wijmo_1.CollectionView);a=u?u.getAggregate(n.aggregate,n.binding):wijmo_1.getAggregate(n.aggregate,c.items,n.binding)}}break;case d.Cell:var h=void 0,_=this._g._isServerCollectionView(this._g.collectionView);_&&(h=this._g.collectionView);if(t instanceof GroupRow)if(i==this._cols.firstVisibleIndex)a=t.getGroupHeader();else if(_&&h.groupOnServer&&(h.groupLazyLoading||h._virtualization)){var p=t.dataItem;a=h.getGroupAggregate(n.binding,p,n.aggregate)}else l&&n.aggregate!=wijmo_1.Aggregate.None&&(a=l.getAggregate(n.aggregate,n.binding,this._g.collectionView,this._g))}return a};GridPanel.prototype.getCellBoundingRect=function(e,t,i){var o=this._g,n=this.rows[e],r=this.columns[this._toIndex(t)],l=this.rows._frozenInternal<0&&this.rows.isFrozen(e)&&o._hasScroll(this.rows)?this._g._szClient.height+n._antipos:n.pos,s=this.columns._frozenInternal<0&&this.columns.isFrozen(Number(t))&&o._hasScroll(this.columns)?this._g._szClient.width+r._antipos:r.pos,a=new wijmo_1.Rect(s,l,r.renderSize,n.renderSize);if(o.rightToLeft){a.left=this.hostElement.clientWidth-a.right;wijmo_1.isIE()||(a.left-=o._root.offsetWidth-o._root.clientWidth)}if(!i){var d=this.hostElement.getBoundingClientRect();a.left+=d.left;a.top+=d.top-this._offsetY}this.rows.isFrozen(e)&&(this.rows._frozenInternal>0||!this.rows.isFrozen(this.rows._firstVisible))&&(a.top-=o.scrollPosition.y);this.columns.isFrozen(Number(t))&&(a.left-=o.scrollPosition.x*(o.rightToLeft?-1:1));return a};GridPanel.prototype.getCellElement=function(e,t){var i=this.hostElement.children,o=this._g.rows._frozenInternal<0?i.length:Math.min(e+2,i.length);t=this._toIndex(t);for(var n=0;n<o;n++)for(var r=i[n].children,l=this._g.columns._frozenInternal<0?r.length:Math.min(t+2,r.length),s=0;s<l;s++){var a=r[s],d=a[GridPanel._INDEX_KEY];if(d&&(d.row==e&&d.col==t||d.rng&&d.rng.contains(e,t)))return a}return null};GridPanel.prototype.getSelectedState=function(e,t,i){var o=this._g,n=o.selectionMode,r=o._selHdl.selection,l=SelectionMode,s=SelectedState;if(n==l.None)return s.None;t=this._toIndex(t);switch(this._ct){case CellType.Cell:if(o.activePanelType!=this.cellType){i||(i=o.getMergedRange(this,e,t)||new CellRange(e,t));for(var a=i.leftCol;a<=i.rightCol;a++)if(o.columns[a]&&o.columns[a].isSelected)return s.Selected;for(var d=i.topRow;d<=i.bottomRow;d++)if(o.rows[d].isSelected)return s.Selected;return s.None}i||(i=o.getMergedRange(this,e,t));var c=o._getAnchorCell();if(i){if(i.contains(r.row,r.col)){if(!o.anchorCursor||null==c)return o.showMarquee?s.Active:s.Cursor;if(e==c.y&&t==c.x||i.row==c.y&&i.col==c.x)return o.showMarquee?s.Active:s.Cursor}if(i.intersects(r)&&o.anchorCursor&&null!=c&&(e==c.y&&t==c.x||i.row==c.y&&i.col==c.x))return o.showMarquee?s.Active:s.Cursor;if(i.intersects(r)&&n!=l.ListBox)return s.Selected;for(a=i.leftCol;a<=i.rightCol;a++)if(o.columns[a]&&o.columns[a].isSelected)return s.Selected;for(d=i.topRow;d<=i.bottomRow;d++)if(o.rows[d].isSelected)return s.Selected}if(o.anchorCursor&&null!=c){if(e==c.y&&t==c.x)return o.showMarquee?s.Active:s.Cursor}else if(r.row==e&&r.col==t)return o.showMarquee?s.Active:s.Cursor;if(o.rows[e].isSelected||o.columns[t].isSelected)return s.Selected;if(n==l.MultiRange)for(var u=o._selHdl.extendedSelection,h=0;h<u.length;h++)if(u[h].contains(e,t)||i&&i.intersects(u[h]))return s.Selected;if(i)switch(n){case l.Row:case l.RowRange:if(i.containsRow(r.row))return s.Selected}return n==l.ListBox?s.None:(r=this._getAdjustedSelection(r)).containsRow(e)&&r.containsColumn(t)?s.Selected:s.None;case CellType.ColumnHeader:if(o.activePanelType==CellType.ColumnHeader){if((i=o.getMergedRange(this,e,t,!1))&&i.contains(r))return s.Cursor;if(r.row==e&&r.col==t)return s.Cursor}if(o.activePanelType==CellType.Cell&&o.showSelectedHeaders&HeadersVisibility.Column&&(o.columns[t].isSelected||r.containsColumn(t)||r.intersectsColumn(i))){i&&(e=i.bottomRow);if(e==this.rows.length-1)return s.Selected}break;case CellType.RowHeader:if(o.activePanelType==CellType.RowHeader){if((i=o.getMergedRange(this,e,t,!1))&&i.contains(r))return s.Cursor;if(r.row==e&&r.col==t)return s.Cursor}if(o.activePanelType==CellType.Cell&&o.showSelectedHeaders&HeadersVisibility.Row&&(o.rows[e].isSelected||r.containsRow(e)||r.intersectsRow(i))){i&&(t=i.rightCol);if(t==this.columns.length-1)return s.Selected}break;case CellType.TopLeft:if(o.activePanelType==CellType.TopLeft){i||(i=o.getMergedRange(this,e,t,!1));if(i&&i.contains(r))return s.Cursor;if(r.row==e&&r.col==t)return s.Cursor}break;case CellType.BottomLeft:if(o.activePanelType===CellType.BottomLeft){i||(i=o.getMergedRange(this,e,t,!1));if(i&&i.contains(r))return s.Cursor;if(r.row==e&&r.col==t)return s.Cursor}break;case CellType.ColumnFooter:if(o.activePanelType===CellType.ColumnFooter){i||(i=o.getMergedRange(this,e,t,!1));if(i&&i.contains(r))return s.Cursor;if(r.row==e&&r.col==t)return s.Cursor}}return s.None};Object.defineProperty(GridPanel.prototype,"hostElement",{get:function(){return this._e},enumerable:!0,configurable:!0});GridPanel.prototype.isRangeValid=function(e){return e&&e.isValid&&e.bottomRow<this.rows.length&&e.rightCol<this.columns.length};GridPanel.prototype.getNextVisibleRow=function(e){void 0===e&&(e=0);for(var t=Math.max(e,0);t<this.rows.length;t++)if(this.rows[t].isVisible)return t;return-1};GridPanel.prototype.getLastVisibleRow=function(e){void 0===e&&(e=1/0);for(var t=Math.min(e,this.rows.length-1);t>=0;t--)if(this.rows[t].isVisible)return t;return-1};GridPanel.prototype.getNextVisibleColumn=function(e){void 0===e&&(e=0);for(var t=Math.max(e,0);t<this.columns.length;t++)if(this.columns[t].isVisible)return t;return-1};GridPanel.prototype.getLastVisibleColumn=function(e){void 0===e&&(e=1/0);for(var t=Math.min(e,this.columns.length-1);t>=0;t--)if(this.columns[t].isVisible)return t;return-1};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,o){var n=this._g,r=this._e,l=this._rows,s=this._cols,a=this._ct;if(a==CellType.ColumnHeader||a==CellType.ColumnFooter||a==CellType.RowHeader){var d=n._ptScrl,c=r.style;a==CellType.RowHeader?c.top=d.y+"px":n.rightToLeft?c.right=d.x+"px":c.left=d.x+"px"}if(this._offsetY!=i){e=!1;this._offsetY=i}var u=this._getViewRange(),h=u;if(h.isValid){var _=l.length<=n._vtRows?l.length:0,p=s.length<=n._vtCols?s.length:0,g=l._frozenInternal>=0?Math.max(u.row-_,l._frozenInternal):Math.max(u.row-_,0),f=l._frozenInternal>=0?Math.min(u.row2+_,l.length-1):Math.min(u.row2+_,l.length-1+l._frozenInternal),m=s._frozenInternal>=0?Math.max(u.col-p,s._frozenInternal):Math.max(u.col-p,0),w=s._frozenInternal>=0?Math.min(u.col2+p,s.length-1):Math.min(u.col2+p,s.length-1+s._frozenInternal);h=new CellRange(g,m,f,w)}if(e&&!t&&this._vrb.contains(u)&&!l._frozenInternal&&!s._frozenInternal)return this._activeCell;e&&h.equals(this._vrb)||(t=!1);e&&!t&&this._ct!=CellType.TopLeft&&this._reorderCells(h,this._vrb);this._activeCell=null;this._vru=u;this._vrb=h;this._recycle=e;var C=this.grid.topLeftCells.hostElement.parentElement;[HeadersVisibility.Row,HeadersVisibility.Column].includes(n.headersVisibility)?wijmo_1.setAttribute(C,"aria-hidden",!0):C.removeAttribute("aria-hidden");this._updateCells(t,0,o);return this._activeCell};GridPanel.prototype._updateCells=function(e,t,i){var o=this,n=this._rows,renderVisibleRange=function(){for(var n=o._vrb.topRow;n<=o._vrb.bottomRow&&n>-1;n++)t=o._renderRow(n,o._vrb,e,t,i)};if(n._frozenInternal>0){!function(){for(var r=0;r<n._frozenInternal&&r<n.length;r++)t=o._renderRow(r,o._vrb,e,t,i)}();renderVisibleRange()}else if(n._frozenInternal<0){renderVisibleRange();!function(){for(var r=n._lastFrozen;r<n.length;r++)t=o._renderRow(r,o._vrb,e,t,i)}()}else renderVisibleRange();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--){for(var o=e.children[i],n=o.childElementCount-1;n>=0;n--){delete o.children[n][GridPanel._INDEX_KEY];t.disposeCell(o.children[n])}wijmo_1.removeChild(o)}e.innerHTML=""};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,r,l){wijmo_1.assert(o<0,"Scroll delta must be a negative number");var s,a,d=-o,c=t+(n-r+1),u=e.childElementCount-c;if(u<d&&u>0){s=u;a=d-u}else{s=d;a=0}if(s>0){var h=i._createRange(e,c,c+s);h&&e.insertBefore(h.extractContents(),e.children[t])}if(a>0)for(var _=e.children[t],p=0;p<a;p++){var g=document.createElement("div");g.className=l;e.insertBefore(g,_)}};if(e.row!=t.row){var o=this._e;if(0!=(a=e.row-t.row)){var n=this._ct==CellType.Cell?1:0,r=o.childElementCount;this.rows._frozenInternal>0&&(n+=this.rows._frozenInternal);if(a>0){var l=n,s=Math.min(n+a,r);(h=this._createRange(o,l,s))&&o.appendChild(h.extractContents())}else relocateForScrollToBeginning(o,n,a,e.row2,t.row,exports.FlexGridClsNames.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;this.columns._frozenInternal>=0&&(n+=this.columns._frozenInternal);for(var d=0;d<o.children.length;d++){var c=o.children[d],u=r=c.children.length;this.columns._frozenInternal<0&&(u+=this.columns._frozenInternal);if(wijmo_1.hasClass(c,exports.FlexGridClsNames.row))if(a>0){var h;l=n,s=Math.min(n+a,u);(h=this._createRange(c,l,s))&&c.appendChild(h.extractContents())}else relocateForScrollToBeginning(c,n,a,e.col2,t.col,exports.FlexGridClsNames.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._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,n){var r=this._g,l=this.rows[e];if(l.renderSize<=0)return o;var s=this._e.children[o];s||(s=wijmo_1.createElement('<div class="'+exports.FlexGridClsNames.row+'"></div>',this._e));var a=this._g.columnHeaders&&this._g.columnHeaders.rows&&this._g.columnHeaders.rows.length||0,d=this._g.headersVisibility&HeadersVisibility.Column?a:0,makeId=function(e,t,i){return r._ariaId+"-"+e+"-"+t+"-"+i},setAriaOwns=function(t,i){for(var o=[],n=0;n<i;n++)o.push(makeId(t,e,n));return o.join(" ")};switch(this._ct){case CellType.ColumnHeader:if(r.headersVisibility&HeadersVisibility.Row&&r.headersVisibility&HeadersVisibility.Column){var c=[],u=setAriaOwns("tl",r.topLeftCells.columns.length);u&&c.push(u);var h=setAriaOwns("ch",this.columns.length);h&&c.push(h);(g=c.join(" "))&&wijmo_1.setAttribute(s,"aria-owns",g)}wijmo_1.setAttribute(s,"aria-rowindex",e+1);break;case CellType.TopLeft:wijmo_1.setAttribute(s,"aria-rowindex",e+1);break;case CellType.Cell:if(r.headersVisibility&HeadersVisibility.Row){c=[];var _=setAriaOwns("rh",r.rowHeaders.columns.length);_&&c.push(_);var p=setAriaOwns("cell",r.cells.columns.length);p&&c.push(p);var g=c.join(" ");this._allowSetAriaOwns(g,s)?wijmo_1.setAttribute(s,"aria-owns",g):wijmo_1.setAttribute(s,"aria-owns")}wijmo_1.setAttribute(s,"aria-rowindex",e+1+d);break;case CellType.RowHeader:wijmo_1.setAttribute(s,"aria-rowindex",e+1+d);break;case CellType.BottomLeft:case CellType.ColumnFooter:if(r.headersVisibility&HeadersVisibility.Row){c=[];var f=setAriaOwns("bl",r.bottomLeftCells.columns.length);f&&c.push(f);var m=setAriaOwns("cf",r.columnFooters.columns.length);m&&c.push(m);(g=c.join(" "))&&wijmo_1.setAttribute(s,"aria-owns",g)}var w=a+r.rows.length+e+1;wijmo_1.setAttribute(s,"aria-rowindex",w)}if(this._ct==CellType.Cell){s.setAttribute("role","row");var C=SelectionMode,v=l.isSelected;switch(r.selectionMode){case C.Row:case C.RowRange:v=v||this._g._selHdl.selection.containsRow(e)}wijmo_1.setAttribute(s,"aria-selected",!!v||null);wijmo_1.setAttribute(s,"aria-level",l instanceof GroupRow?l.level+1:null);wijmo_1.setAttribute(s,"aria-expanded",l instanceof GroupRow?!l.isCollapsed:null);this.rows.ariaLabel&&wijmo_1.setAttribute(s,"aria-label",this.rows.ariaLabel)}this._ct!==CellType.TopLeft&&this._ct!==CellType.ColumnFooter&&this._ct!==CellType.BottomLeft||s.setAttribute("role","row");var y=0;if(this._ct==CellType.Cell||this._ct==CellType.ColumnHeader){var b=this._g._getRowHeaderPath();if(b){var R=this._ct==CellType.Cell?[b.getValue(l.dataItem),e]:[b.path,-1],x=R[0],S=R[1];y=this._renderRowHdrCell(s,S,x)}}var E=t.clone();E.col=this.columns._frozenInternal>=0?0:this.columns.length+this.columns._frozenInternal;E.col2=this.columns._frozenInternal>=0?this.columns._frozenInternal-1:this.columns.length-1;if(this.columns._frozenInternal>=0)for(var j=0;j<this.columns._frozenInternal&&j<this.columns.length;j++)y=this._renderCell(s,e,j,E,i,y,n);else for(j=Math.max(0,this.columns.length+this.columns._frozenInternal);j<this.columns.length;j++)y=this._renderCell(s,e,j,E,i,y,n);if(t.leftCol>-1){var H=r.getMergedRange(this,e,t.leftCol,!1),F=-1;if(H){F=H.leftCol;for(;!this.columns[F].isVisible&&F<H.rightCol;)F++}H&&F<t.leftCol&&(y=this._renderCell(s,e,F,t,i,y,n))}for(j=t.leftCol;j<=t.rightCol&&j>-1;j++)y=this._renderCell(s,e,j,t,i,y,n);this._removeExtraCells(s,y);return o+1};GridPanel.prototype._allowSetAriaOwns=function(e,t){return!!e&&!wijmo_1.hasClass(t,"wj-detail-row")};GridPanel.prototype._renderCell=function(e,t,i,o,n,r,l){var s=this._g,a=this._ct==CellType.Cell||s.rows.length<=s._vtRows||s.columns.length<=s._vtCols?s.getMergedRange(this,t,i,!1):s.getMergedRange(this,t,i);if(a){for(var d=Math.max(o.row,a.row);d<t;d++)if(this.rows[d].renderSize)return r;for(d=Math.max(o.col,a.col);d<i;d++)if(this.columns[d].renderSize)return r;if(t>=a.row&&t<=a.row2&&i>a.col&&i<=a.col2&&this._ct===CellType.Cell&&a.isSingleCell)return r;var c=this.columns._frozenInternal;if(c&&a.col<c&&a.col2>=c&&i>a.col)return r;if(!this.columns[i].isVisible&&"DetailRow"!==this._rows[t].constructor.name)return r;if(a.leftCol!=i)for(var u=a.leftCol;u<i;u++)if(this.columns[u].isVisible)return r}var h=this.columns[i];if((!h||h.renderSize<=0)&&(!a||a.getRenderSize(this).width<=0))return r;var _=e.children[r];if(_&&!n&&this._recycle&&s._lazyRender&&!s.activeEditor){var p=_[GridPanel._INDEX_KEY];p&&p.row==t&&p.col==i&&p.rng==a&&(this.rows.isFrozen(t)||this.columns.isFrozen(i)||(n=!0))}var g=SelectedState,f=this.getSelectedState(t,i,a),m=f==g.Cursor||f==g.Active,w=!1;switch(this.cellType){case CellType.RowHeader:case CellType.ColumnHeader:case CellType.TopLeft:case CellType.BottomLeft:case CellType.ColumnFooter:w=!0}if(_&&n){wijmo_1.toggleClass(_,wijmo_1.ControlStateClsNames.active,m);wijmo_1.toggleClass(_,w?exports.FlexGridClsNames.focusHeaderCell:wijmo_1.ControlStateClsNames.selected,f==g.Cursor);wijmo_1.toggleClass(_,wijmo_1.ControlStateClsNames.multiSelected,f==g.Selected);var C=_.querySelector(".wj-column-selector");C?m||f!=g.None?wijmo_1.setAttribute(_,"aria-selected",!!C.checked):wijmo_1.setAttribute(_,"aria-selected",null):wijmo_1.setAttribute(_,"aria-selected",!(!m&&f==g.None)||null);m&&(this._activeCell=_);return r+1}_||(_=wijmo_1.createElement(GridPanel._HTML_CELL,e));var v=l?i+1+l:i+1;wijmo_1.setAttribute(_,"aria-colindex",v);m&&(this._activeCell=_);if(this._ct==CellType.Cell){wijmo_1.setAttribute(_,"role","gridcell");wijmo_1.setAttribute(_,"aria-selected",!(f==g.None&&!m)||null);var y=!s.canEditCell(t,i)||null;wijmo_1.setAttribute(_,"aria-readonly",y);wijmo_1.setAttribute(_,"aria-required",y?null:h.getIsRequired())}this._ct!==CellType.ColumnFooter&&this._ct!==CellType.BottomLeft||wijmo_1.setAttribute(_,"role","gridcell");s.cellFactory.updateCell(this,t,i,_,a);_[GridPanel._INDEX_KEY]={row:t,col:i,rng:a,panel:this};return r+1};GridPanel.prototype._removeExtraCells=function(e,t){var i=this._g.cellFactory;this.cellType===CellType.RowHeader&&0===t&&wijmo_1.setAttribute(e,"aria-hidden","true");for(;e.childElementCount>t;){var o=e.lastElementChild;delete o[GridPanel._INDEX_KEY];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,r=new CellRange(0,0,o.length-1,n.length-1);if(this._ct==CellType.Cell||this._ct==CellType.RowHeader){var l=-t.y+this._offsetY,s=i.height;if((u=Math.min(Math.abs(o._frozenInternal),o.length-1))>0)if(o._frozenInternal>=0){l+=p=o[u-1].pos;s-=p}else{s+=p=o[o.length-u]._antipos}if(o._frozenInternal>=0)if(u>0&&o[u].pos>i.height)r.row=r.row2=-1;else{r.row=Math.min(o.length-1,Math.max(u,o.getItemAt(l)));r.row2=Math.max(r.row,o.getItemAt(l+s))}else if(u>0&&o[o.length-u]._antipos+i.height<0)r.row=r.row2=-1;else{r.row=Math.min(o.length+o._frozenInternal-1,o.getItemAt(l));r.row2=Math.max(r.row,o.getItemAt(l+s));e.columnFooters.rows.length>0&&(r.row2-=e.columnFooters.rows.length)}var a=e.hostElement;if(e._clipToScreen&&a){var d=a.getBoundingClientRect(),c=-d.top-e.cells._e.offsetTop;d.top<0&&(r.row=Math.max(r.row,o.getItemAt(c)-1));d.bottom>innerHeight&&(r.row2=Math.min(r.row2,o.getItemAt(c+innerHeight)+1))}}if(this._ct==CellType.Cell||this._ct==CellType.ColumnHeader){var u,h=-t.x,_=i.width;if((u=Math.min(Math.abs(n._frozenInternal),n.length-1))>0&&n._frozenInternal>0){h+=p=n[u-1].pos;_-=p}else if(u>0&&n._frozenInternal<0){var p;h+=p=n[0].pos}if(n._frozenInternal>=0?u>0&&n[u].pos>i.width:u>0&&Math.abs(n[n.length-u]._antipos)>i.width)r.col=r.col2=-1;else if(n._frozenInternal>=0){r.col=Math.min(n.length-1,Math.max(u,n.getItemAt(h)));r.col2=Math.max(r.col,n.getItemAt(h+_))}else{r.col=Math.min(n.length-1,Math.max(0,n.getItemAt(h)));r.col2=Math.max(r.col,n.getItemAt(h+_-n._frozenColAreaWidth))}}o.length<=Math.abs(o._frozenInternal)&&(r.row=r.row2=-1);n.length<=Math.abs(n._frozenInternal)&&(r.col=r.col2=-1);return r};GridPanel.prototype._getFrozenPos=function(){var e=this._rows._frozenInternal,t=this._cols._frozenInternal,i=null,o=null,n=0,r=0;e>0?n=(i=e>0?this._rows[e-1]:null)?i.pos+i.renderSize:0:e<0&&this._rows.lastFrozen&&(n=Math.min(this._rows.lastFrozen.pos,this._g._szClient.height+this._rows.lastFrozen._antipos));t>0?r=(o=t>0?this._cols[t-1]:null)?o.pos+o.renderSize:0:t<0&&this._cols.lastFrozen&&(r=Math.min(this._cols.lastFrozen.pos,this._g._szClient.width+this._cols.lastFrozen._antipos));return new wijmo_1.Point(r,n)};GridPanel.prototype.dispose=function(){this._clearCells();if(this._docRange){this._docRange.detach();this._docRange=null}this._g=null;this._e=null;this._rows=null;this._cols=null;this._activeCell=null};GridPanel._INDEX_KEY=exports.FlexGridClsNames.cellIndex;GridPanel._HTML_CELL='<div class="'+exports.FlexGridClsNames.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 r=e.call(this,t,i)||this;r._updateContent=!0;r._cell=wijmo_1.asType(o,HTMLElement);return r}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 softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;function softDetailRow(){return wijmo_1._getModule("wijmo.grid.detail")}exports.softDetailRow=softDetailRow;function softMultirow(){return wijmo_1._getModule("wijmo.grid.multirow")}exports.softMultirow=softMultirow;function softTransposed(){return wijmo_1._getModule("wijmo.grid.transposed")}exports.softTransposed=softTransposed;function softTransposedMultirow(){return wijmo_1._getModule("wijmo.grid.transposedmultirow")}exports.softTransposedMultirow=softTransposedMultirow;function softRestCV(){return wijmo_1._getModule("wijmo.rest")}exports.softRestCV=softRestCV;function softODataCV(){return wijmo_1._getModule("wijmo.odata")}exports.softODataCV=softODataCV;function softGridInteropBase(){return wijmo_1._getModule("wijmo.interop.grid")}exports.softGridInteropBase=softGridInteropBase;!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._collectionChangedHandler=function(){e.invalidate()};this._xSel.collectionChanged.addHandler(this._collectionChangedHandler)}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});Object.defineProperty(_SelectionHandler.prototype,"cellRangeEventArgs",{get:function(){return this._e},enumerable:!0,configurable:!0});_SelectionHandler.prototype.select=function(e,t,i,o){void 0===t&&(t=!0);void 0===i&&(i=!1);o||(o=this._g._gpCells);var n=this._g,r=this._e.range,l=this._sel,s=r,a=!1,d=SelectionMode,c=n.activePanelType,u=o.cellType==CellType.RowHeader||o.cellType==CellType.ColumnHeader,h=o.cellType==CellType.BottomLeft||o.cellType==CellType.ColumnFooter,_=!u&&!h;n._mouseHdl._eMouse&&(n._mouseHdl._eMouse.ctrlKey||n._mouseHdl._eMouse.metaKey);if(wijmo_1.isNumber(e)&&wijmo_1.isString(t)){var p=o.columns.indexOf(t);if(p<0)throw"Invalid column name or binding.";r.setRange(e,p);t=!0}else if(wijmo_1.isNumber(e)&&wijmo_1.isNumber(t)){r.setRange(e,t);t=!0}else e instanceof CellRange?r.copy(e):wijmo_1.assert(!1,"CellRange expected");n.activePanel=o;switch(n.selectionMode){case d.Cell:s.row2=s.row;s.col2=s.col;break;case d.Row:s.row2=s.row;break;case d.ListBox:a=!0}if(u||h){s.row2=s.row;s.col2=s.col}var g=s.equals(l)&&c==o.cellType;if(g&&a&&_)for(var f=0;f<n.rows.length;f++)if(n.rows[f].isSelected!==s.containsRow(f)){g=!1;break}if(g){t&&o.isRangeValid(s)&&this._showSelection();return!0}var m=wijmo_1.Control.getControl(wijmo_1.closest(wijmo_1.getActiveElement(),"."+exports.FlexGridClsNames.hostElement));if(m&&m==n&&m.activeEditor&&!m.finishEditing())return!1;var w=this._e;w._rng=s;w.cancel=!1;if(!n.onSelectionChanging(w)&&!i)return!1;_&&a&&n.rows.forEach((function(e,t){e._setFlag(RowColFlags.Selected,s.containsRow(t),!0)}));s.row=Math.min(s.row,o.rows.length-1);s.row2=Math.min(s.row2,o.rows.length-1);this._sel.copy(s);n.refreshCells(!1,!0,!0);t&&this._showSelection();var C=n.collectionView;if(C&&_){var v=n._getCvIndex(s.row);C.moveCurrentToPosition(v)}var y=wijmo_1.getActiveElement();this._g.errorTip&&(y.classList.contains(wijmo_1.ControlStateClsNames.invalid)?this._g.errorTip._showAutoTip(void 0,y):this._g.errorTip.hide());n.onSelectionChanged(w);return!0};_SelectionHandler.prototype.moveSelectionWithinSelectedPanel=function(e,t){var i=this._g,o=this._sel.clone(),n=i.activePanel,r=i.getMergedRange(n,o.row,o.col,!1);r||(r=new CellRange(o.row,o.col));if(e>0){var l=n.getNextVisibleRow(r.bottomRow+e);l>=0&&(o.row=o.row2=l);if(!n.columns[o.col].isVisible){var s=n.getNextVisibleColumn(r.leftCol);s>=0&&(o.col=o.col2=s)}}else if(e<0){var a=n.getLastVisibleRow(r.topRow+e);a>=0&&(o.row=o.row2=a)}if(t>0){var d=n.getNextVisibleColumn(r.rightCol+t);d>=0&&(o.col=o.col2=d)}else if(t<0){var c=n.getLastVisibleColumn(r.leftCol+t);c>=0&&(o.col=o.col2=c)}o.equals(this._sel)||i.select(o,!0,n)};_SelectionHandler.prototype.moveSelection=function(e,t,i){var o=this._g,n=this._sel,r=i&&o.anchorCursor?new CellRange(n.row2,n.col2):new CellRange(n.row,n.col),l=r.row,s=r.col,a=o.columns,d=Math.max(0,o._szClient.height-o.columnHeaders.height),c=SelMove,u=-1,h=o.getMergedRange(o.cells,l,s),_=0;if(h){t==c.Next||t==c.NextCell||t==c.NextEditableCell?s=h.rightCol:t!=c.Prev&&t!=c.PrevCell&&t!=c.PrevEditableCell||(s=h.leftCol);if(e==c.Next||e==c.NextCell||e==c.NextEditableCell){l=h.bottomRow;if(softMultirow()&&o instanceof softMultirow().MultiRow){_=r.row-h.topRow;if(h.bottomRow===o.rows.length-1)return}}else if(e==c.Prev||e==c.PrevCell||e==c.PrevEditableCell){l=h.topRow;if(softMultirow()&&o instanceof softMultirow().MultiRow){_=r.row-h.bottomRow;if(0===h.topRow)return}}}switch(t){case c.NextCell:case c.NextEditableCell:u=s;(s=this._getNextColumnCell(l,u,t))!=u&&(h=o.getMergedRange(o.cells,l,s))&&s<h.col2&&(s=h.col2);if(s==u)for(;;){if(l==o.rows.length-1){s=r.col;l=r.row;break}var p=!1;if((l=this._getNextRowCell(l,s,t))>r.row){u=-1;for(;u<a.length;){if((s=this._getNextColumnCell(l,u,t))==u){p=!0;break}(h=o.getMergedRange(o.cells,l,s))&&s<h.col2&&(s=h.col2);break}if(p)continue}break}o.select(l,s);break;case c.PrevCell:case c.PrevEditableCell:u=s;(s=this._getNextColumnCell(l,u,t))!=u&&(h=o.getMergedRange(o.cells,l,s))&&s>h.col&&(s=h.col);if(s==u)for(;;){if(0==l){s=r.col;l=r.row;break}p=!1;if((l=this._getNextRowCell(l,s,t))<r.row){u=a.length;for(;u>-1;){(s=this._getNextColumnCell(l,u,t))!=u?(h=o.getMergedRange(o.cells,l,s))&&s>h.col&&(s=h.col):p=!0;break}if(p)continue}break}o.select(l,s);break;default:l=this._getNextRowCell(l,s,e,d);l+=_;s=this._getNextColumnCell(l,s,t,d);i?o.selection=o.anchorCursor?new CellRange(n.row,n.col,l,s):new CellRange(l,s,n.row2,n.col2):o.select(l,s)}};_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,r=void 0;if(this._g.hostElement){r=this._g.hostElement.querySelector("input.wj-column-selector")instanceof HTMLInputElement}if(!r)for(var l=0;l<o.length;l++)o[l]._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(r)return;for(l=0;l<o.length;l++)o[l]._setFlag(RowColFlags.Selected,s.containsRow(l),!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),r=this._expandSelectionRange(n)||n,l=r.topRow;l<=r.bottomRow;l++)-1===i.indexOf(l)&&i.push(l);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),r=t.getMergedRange(i,e.topRow,e.rightCol,!1),l=t.getMergedRange(i,e.bottomRow,e.rightCol,!1);if(o||n||r||l){o=o||new CellRange(e.topRow,e.leftCol);n=n||new CellRange(e.bottomRow,e.leftCol);r=r||new CellRange(e.topRow,e.rightCol);l=l||new CellRange(e.bottomRow,e.rightCol);return new CellRange(Math.min(o.topRow,n.topRow,r.topRow,l.topRow),Math.min(o.leftCol,n.leftCol,r.leftCol,l.leftCol),Math.max(o.bottomRow,n.bottomRow,r.bottomRow,l.bottomRow),Math.max(o.rightCol,n.rightCol,r.rightCol,l.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],r=e&&e.indexOf(n.index)>-1;if(r&&o){o=!1;this.select(i,this.selection.col)}n.isSelected=r}};_SelectionHandler.prototype._showSelection=function(){var e=this._g,t=this._sel.clone();e.activePanelType===CellType.ColumnHeader?t.row=-1:e.activePanelType===CellType.RowHeader?t.col=-1:e.activePanelType===CellType.BottomLeft?t.row=-1:e.activePanelType===CellType.ColumnFooter&&(t.row=-1);e.activePanelType!==CellType.TopLeft&&(e.anchorCursor?e.scrollIntoView(t.row2,t.col2):e.scrollIntoView(t.row,t.col));e.activePanelType!==CellType.Cell&&this._showHeaderSelection()};_SelectionHandler.prototype._showHeaderSelection=function(){var e=this._g.activePanel.activeCell;if(e){var t=e.getBoundingClientRect(),i=0,o=0,n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;t.y<0?i=t.y:t.y>r-2&&(i=t.y-r+t.height);t.x<0?o=t.x:t.x>n-2&&(o=t.x-n+t.width);0==i&&0==o||window.scrollBy(o,i)}};_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 r=SelMove;switch(t){case r.Next:case r.NextCell:case r.NextEditableCell:e.row=n.bottomRow;break;case r.Prev:case r.PrevCell:case r.PrevEditableCell:e.row=n.topRow}switch(i){case r