UNPKG

@mescius/wijmo.grid

Version:

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

14 lines (13 loc) 304 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 __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});const wijmo_1=require("@mescius/wijmo"),wijmo_input_1=require("@mescius/wijmo.input"),mInput=__importStar(require("@mescius/wijmo.input")),selfModule=__importStar(require("@mescius/wijmo.grid"));let _safariVer=null;function _getSafariVer(){return _safariVer}exports._getSafariVer=_getSafariVer;if(wijmo_1.isSafari()){let e=navigator.userAgent.match(/version\/([\d\.]+)/i);if(null!=e){const t=e[1],i=(e=t.match(/(\d+)/g)).map(e=>parseInt(e));_safariVer={full:t,major:i[0],minor:i[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"};var DataMapEditor,CellType,SelectionMode,SelectedState,SelMove,RowColFlags,AllowSorting,SortOrder,AllowPinning,HeadersVisibility,ClipStringOptions,HeadersFocusability,FrozenRowCol,GroupSummaryPosition,AllowMerging;!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={}));class DataMap{constructor(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(e=>({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)}get sortByDisplayValues(){return this._sortByVal}set sortByDisplayValues(e){this._sortByVal=wijmo_1.asBoolean(e)}get serializeKeys(){return this._serK}set serializeKeys(e){if((e=wijmo_1.asBoolean(e))!==this._serK){let t=this._map,i=t&&t.size;this._map=null;this._serK=e;i&&this.onMapChanged(wijmo_1.EventArgs.empty)}}get collectionView(){return this._cv}get selectedValuePath(){return this._keyPath}get displayMemberPath(){return this._displayPath}getDataItem(e){if(!this._map){let e=this._cv.sourceCollection,t=new wijmo_1._Map(this.serializeKeys);wijmo_1.isArray(e)&&this._keyPath&&e.forEach(e=>{let i=e[this._keyPath];t.has(i)||t.set(i,e)});this._map=t}return this._map.get(e)}getDisplayValue(e){let t=this._displayPath,i=this.getDataItem(e);return t&&i?i[t]:e}getKeyValue(e,t){let i=this._displayPath,l=this._indexOf(e,i,t,!0);l<0&&(l=this._indexOf(e,i,t,!1));return l>-1?this._cv.sourceCollection[l][this._keyPath]:null}getDisplayValues(e){return this._cv&&this._displayPath?this._cv.items.map(e=>e[this._displayPath]):[]}getFilteredItems(e){return this._cv?this._cv.items:[]}get useFilter(){return this._useFilter}set useFilter(e){this._useFilter=wijmo_1.asBoolean(e)}getKeyValues(){return this._cv&&this._keyPath?this._cv.items.map(e=>e[this._keyPath]):[]}get isEditable(){return this._editable}set isEditable(e){this._editable=wijmo_1.asBoolean(e)}get search(){return this._search}set search(e){e&&(this._search=wijmo_1.asFunction(e))}onMapChanged(e){this._map=null;this.mapChanged.raise(this,e)}_indexOf(e,t,i,l){let s=-1,o=-1;if(this._cv&&t){let n=null!=e?e.toString():"";n&&i&&(e=wijmo_1.toPlainText(n));let r=l?n:n.toLowerCase(),a=this._cv.sourceCollection;for(let h=0;h<a.length;h++){let d=a[h],_=d?d[t]:void 0;null!=_&&null!=_||(_="");i&&wijmo_1.isString(_)&&(_=wijmo_1.toPlainText(_));_==e?s=h:l||_.length!=r.length||_.toLowerCase()!=r?null!=_&&_.toString()==n&&(s=h):s=h;if(s==h){if(!this._cv.filter||this._cv.filter(d))return s;o<0&&(o=s)}}}return o}}exports.DataMap=DataMap;class CellRange{constructor(e=-1,t=-1,i=e,l=t){this.setRange(e,t,i,l)}setRange(e=-1,t=-1,i=e,l=t){this._row=wijmo_1.asInt(e);this._col=wijmo_1.asInt(t);this._row2=wijmo_1.asInt(i);this._col2=wijmo_1.asInt(l)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e)}get row2(){return this._row2}set row2(e){this._row2=wijmo_1.asInt(e)}get col2(){return this._col2}set col2(e){this._col2=wijmo_1.asInt(e)}clone(){return new CellRange(this._row,this._col,this._row2,this._col2)}copy(e){this.setRange(e._row,e._col,e._row2,e._col2)}get rowSpan(){return Math.abs(this._row2-this._row)+1}get columnSpan(){return Math.abs(this._col2-this._col)+1}get topRow(){return Math.min(this._row,this._row2)}get bottomRow(){return Math.max(this._row,this._row2)}get leftCol(){return Math.min(this._col,this._col2)}get rightCol(){return Math.max(this._col,this._col2)}get isValid(){return this._row>-1&&this._col>-1&&this._row2>-1&&this._col2>-1}get isSingleCell(){return this._row==this._row2&&this._col==this._col2}contains(e,t){let 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."}containsRow(e){return wijmo_1.asInt(e)>=this.topRow&&e<=this.bottomRow}containsColumn(e){return wijmo_1.asInt(e)>=this.leftCol&&e<=this.rightCol}intersects(e){return this.intersectsRow(e)&&this.intersectsColumn(e)}intersectsRow(e){return e&&!(this.bottomRow<e.topRow||this.topRow>e.bottomRow)}intersectsColumn(e){return e&&!(this.rightCol<e.leftCol||this.leftCol>e.rightCol)}getRenderSize(e){let t=new wijmo_1.Size(0,0);if(this.isValid){for(let i=this.topRow;i<=this.bottomRow;i++)e.rows[i]&&(t.height+=e.rows[i].renderSize);for(let i=this.leftCol;i<=this.rightCol;i++)e.columns[i]&&(t.width+=e.columns[i].renderSize)}return t}equals(e){return e instanceof CellRange&&this._row==e._row&&this._col==e._col&&this._row2==e._row2&&this._col2==e._col2}combine(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}toString(){return wijmo_1.format("({row}, {col})-({row2}, {col2})",this)}}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={}));class GridPanel{constructor(e,t,i,l,s){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(l,ColumnCollection);this._e=wijmo_1.asType(s,HTMLElement);this._vrb=new CellRange;this._uid=wijmo_1.uidGenerator()}get activeCell(){return this._activeCell}get grid(){return this._g}get cellType(){return this._ct}get viewRange(){return this._getViewRange()}get width(){return this._cols.getTotalSize()}get height(){return this._rows.getTotalSize()}get rows(){return this._rows}get columns(){return this._cols}getCellData(e,t,i){t=this._toIndex(t);return this._getCellData(e,t,i)}_getCellData(e,t,i){let l,s,o=this._g,n=this._rows[wijmo_1.asNumber(e,!1,!0)];if(!n)return null;l=this._cols[wijmo_1.asNumber(t,!1,!0)];let r=o?o._getBindingColumn(this,e,l):l,a=null,h=n instanceof GroupRow;h&&n.dataItem instanceof wijmo_1.CollectionViewGroup&&!o.childItemsPath&&(a=n.dataItem);r&&n&&r.binding&&n.dataItem&&!a?s=r._binding.getValue(n.dataItem):n._ubv&&(s=n._ubv[l._hash]);null==s&&(s=this._getSpecialData(e,n,t,l,r,h,a,s));if(i){let e=r.dataMap||n.dataMap;if(this.cellType==CellType.Cell&&r._edt&&r._edt._ctl instanceof wijmo_input_1.MultiSelect&&s){let e=new wijmo_1.Binding(r._edt._ctl.displayMemberPath),t=e&&wijmo_1.isArray(s)?s.map(t=>e.getValue(t)):s;if(wijmo_1.isArray(t)&&t.length>0){let e=t.join(", ");s=wijmo_1.format(e||wijmo_1.culture.MultiSelect.itemsSelected,{count:t.length})}}else this.cellType==CellType.Cell&&e&&(s=e.getDisplayValue(s));s=null!=s?wijmo_1.Globalize.format(s,r.format||n.format):""}return s}setCellData(e,t,i,l=!0,s=!0,o=!1){let n=this._g,r=this._rows[wijmo_1.asNumber(e,!1,!0)],a=wijmo_1.asNumber(this._toIndex(t),!1,!0),h=this._cols[a],d=wijmo_1.DataType;if(!r)return!1;let _=n?n._getBindingColumn(this,e,h):h;if(!_)return!1;let c=_.dataMap||r.dataMap;if(this._ct==CellType.Cell){let s=_.getIsRequired(r),h=_.isContentHtml||r.isContentHtml;if(!o&&c&&null!=i){let t=c.getKeyValue(i,h);if(null==t&&null==c.getDisplayValue(null)){if(c.getDisplayValue(i)!=i);else if(!c.isEditable||c.displayMemberPath!=c.selectedValuePath){if(""!=i||s||!n.commitEmptyEdits)return!1;i=null}}else{let l=n.getRowDataItem(e,a);if(c.useFilter&&l){var u=c.getFilteredItems(l);if(!(u.length>0))return!1;if(u.filter(e=>e[c._keyPath]==t).length>0)i=t;else{let e=u.filter(e=>e[c.displayMemberPath]==i);e.length>0&&(i=e[0][c._keyPath])}}else i=t}}let g=d.Object,m=_.dataType||r.dataType,w=this.getCellData(e,t,!1);this.cellType==CellType.Cell&&_._edt&&_._edt._ctl instanceof wijmo_input_1.MultiSelect&&i&&(m=d.Array);g=m||wijmo_1.getType(w);if(null==i||""===i&&l&&!c){if(s||!n.commitEmptyEdits&&(null==w||""===w))return!1;g!=d.String&&(i=null);l=!1}if("NaN"==i&&Number.isNaN(w)&&!n.commitEmptyEdits)return!1;if(l){let e=_.format||r.format;e||g!=d.Date||(e="d");_.mask&&wijmo_1.isString(i)&&g!=d.String&&(i=i.replace(/_/g,""));i=wijmo_1.changeType(i,g,e,w);if(g!=d.Object&&wijmo_1.getType(i)!=g)return!1}}if(r.dataItem&&_.binding){let e=_._binding,t=r.dataItem,l=e.getValue(t);if(i!==l&&(c&&!c.serializeKeys||!wijmo_1.DateTime.equals(i,l))){let l=n.collectionView,s=l instanceof wijmo_1.CollectionView&&t!=l.currentEditItem&&l.trackChanges,o=null;s&&(o=l._extend({},t));e.setValue(t,i);if(s){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,t,l.items.indexOf(t));l.onCollectionChanged(e,o)}}}else{r._ubv||(r._ubv={});r._ubv[h._hash]=i}s&&n&&n.invalidate();return!0}_getRowData(e){let t,i=this._g,l=this._rows[wijmo_1.asNumber(e,!1,!0)],s=null,o=[];if(null!=l){let n=null,r=l instanceof GroupRow;r&&l.dataItem instanceof wijmo_1.CollectionViewGroup&&!i.childItemsPath&&(n=l.dataItem);let a=!n&&l.dataItem;for(let h=0;h<i.columns.length;h++){let d=t=this._cols[h];a&&i&&(d=i._getBindingColumn(this,e,t));d.binding?s=d._binding.getValue(l.dataItem):l._ubv&&(s=l._ubv[t._hash]);null==s&&(s=this._getSpecialData(e,l,h,t,d,r,n,s));o[h]=s}}return o}_getSpecialData(e,t,i,l,s,o,n,r){let a=r,h=CellType;switch(this._ct){case h.TopLeft:case h.ColumnHeader:e!=this._rows.length-1&&s==l||(a=s.header);break;case h.ColumnFooter:if(o&&s.aggregate!=wijmo_1.Aggregate.None){let e=this._g.collectionView;if(e){let t=wijmo_1.tryCast(e,wijmo_1.CollectionView);a=t?t.getAggregate(s.aggregate,s.binding):wijmo_1.getAggregate(s.aggregate,e.items,s.binding)}}break;case h.Cell:let r;const d=this._g._isServerCollectionView(this._g.collectionView);d&&(r=this._g.collectionView);if(t instanceof GroupRow)if(i==this._cols.firstVisibleIndex)a=t.getGroupHeader();else if(d&&r.groupOnServer&&(r.groupLazyLoading||r._virtualization)){let e=t.dataItem;a=r.getGroupAggregate(s.binding,e,s.aggregate)}else n&&s.aggregate!=wijmo_1.Aggregate.None&&(a=n.getAggregate(s.aggregate,s.binding,this._g.collectionView,this._g))}return a}getCellBoundingRect(e,t,i){let l=this._g,s=this.rows[e],o=this.columns[this._toIndex(t)],n=this.rows._frozenInternal<0&&this.rows.isFrozen(e)&&l._hasScroll(this.rows)?this._g._szClient.height+s._antipos:s.pos,r=this.columns._frozenInternal<0&&this.columns.isFrozen(Number(t))&&l._hasScroll(this.columns)?this._g._szClient.width+o._antipos:o.pos,a=new wijmo_1.Rect(r,n,o.renderSize,s.renderSize);if(l.rightToLeft){a.left=this.hostElement.clientWidth-a.right;wijmo_1.isIE()||(a.left-=l._root.offsetWidth-l._root.clientWidth)}if(!i){let e=this.hostElement.getBoundingClientRect();a.left+=e.left;a.top+=e.top-this._offsetY}this.rows.isFrozen(e)&&(this.rows._frozenInternal>0||!this.rows.isFrozen(this.rows._firstVisible))&&(a.top-=l.scrollPosition.y);this.columns.isFrozen(Number(t))&&(a.left-=l.scrollPosition.x*(l.rightToLeft?-1:1));return a}getCellElement(e,t){let i=this.hostElement.children,l=this._g.rows._frozenInternal<0?i.length:Math.min(e+2,i.length);t=this._toIndex(t);for(let s=0;s<l;s++){let l=i[s].children,o=this._g.columns._frozenInternal<0?l.length:Math.min(t+2,l.length);for(let i=0;i<o;i++){let s=l[i],o=s[GridPanel._INDEX_KEY];if(o&&(o.row==e&&o.col==t||o.rng&&o.rng.contains(e,t)))return s}}return null}getSelectedState(e,t,i){let l=this._g,s=l.selectionMode,o=l._selHdl.selection,n=SelectionMode,r=SelectedState;if(s==n.None)return r.None;t=this._toIndex(t);switch(this._ct){case CellType.Cell:if(l.activePanelType!=this.cellType){i||(i=l.getMergedRange(this,e,t)||new CellRange(e,t));for(let e=i.leftCol;e<=i.rightCol;e++)if(l.columns[e]&&l.columns[e].isSelected)return r.Selected;for(let e=i.topRow;e<=i.bottomRow;e++)if(l.rows[e].isSelected)return r.Selected;return r.None}i||(i=l.getMergedRange(this,e,t));var a=l._getAnchorCell();if(i){if(i.contains(o.row,o.col)){if(!l.anchorCursor||null==a)return l.showMarquee?r.Active:r.Cursor;if(e==a.y&&t==a.x||i.row==a.y&&i.col==a.x)return l.showMarquee?r.Active:r.Cursor}if(i.intersects(o)&&l.anchorCursor&&null!=a&&(e==a.y&&t==a.x||i.row==a.y&&i.col==a.x))return l.showMarquee?r.Active:r.Cursor;if(i.intersects(o)&&s!=n.ListBox)return r.Selected;for(let e=i.leftCol;e<=i.rightCol;e++)if(l.columns[e]&&l.columns[e].isSelected)return r.Selected;for(let e=i.topRow;e<=i.bottomRow;e++)if(l.rows[e].isSelected)return r.Selected}if(l.anchorCursor&&null!=a){if(e==a.y&&t==a.x)return l.showMarquee?r.Active:r.Cursor}else if(o.row==e&&o.col==t)return l.showMarquee?r.Active:r.Cursor;if(l.rows[e].isSelected||l.columns[t].isSelected)return r.Selected;if(s==n.MultiRange){let s=l._selHdl.extendedSelection;for(let l=0;l<s.length;l++)if(s[l].contains(e,t)||i&&i.intersects(s[l]))return r.Selected}if(i)switch(s){case n.Row:case n.RowRange:if(i.containsRow(o.row))return r.Selected}return s==n.ListBox?r.None:(o=this._getAdjustedSelection(o)).containsRow(e)&&o.containsColumn(t)?r.Selected:r.None;case CellType.ColumnHeader:if(l.activePanelType==CellType.ColumnHeader){if((i=l.getMergedRange(this,e,t,!1))&&i.contains(o))return r.Cursor;if(o.row==e&&o.col==t)return r.Cursor}if(l.activePanelType==CellType.Cell&&l.showSelectedHeaders&HeadersVisibility.Column&&(l.columns[t].isSelected||o.containsColumn(t)||o.intersectsColumn(i))){i&&(e=i.bottomRow);if(e==this.rows.length-1)return r.Selected}break;case CellType.RowHeader:if(l.activePanelType==CellType.RowHeader){if((i=l.getMergedRange(this,e,t,!1))&&i.contains(o))return r.Cursor;if(o.row==e&&o.col==t)return r.Cursor}if(l.activePanelType==CellType.Cell&&l.showSelectedHeaders&HeadersVisibility.Row&&(l.rows[e].isSelected||o.containsRow(e)||o.intersectsRow(i))){i&&(t=i.rightCol);if(t==this.columns.length-1)return r.Selected}break;case CellType.TopLeft:if(l.activePanelType==CellType.TopLeft){i||(i=l.getMergedRange(this,e,t,!1));if(i&&i.contains(o))return r.Cursor;if(o.row==e&&o.col==t)return r.Cursor}break;case CellType.BottomLeft:if(l.activePanelType===CellType.BottomLeft){i||(i=l.getMergedRange(this,e,t,!1));if(i&&i.contains(o))return r.Cursor;if(o.row==e&&o.col==t)return r.Cursor}break;case CellType.ColumnFooter:if(l.activePanelType===CellType.ColumnFooter){i||(i=l.getMergedRange(this,e,t,!1));if(i&&i.contains(o))return r.Cursor;if(o.row==e&&o.col==t)return r.Cursor}}return r.None}get hostElement(){return this._e}isRangeValid(e){return e&&e.isValid&&e.bottomRow<this.rows.length&&e.rightCol<this.columns.length}getNextVisibleRow(e=0){for(let t=Math.max(e,0);t<this.rows.length;t++)if(this.rows[t].isVisible)return t;return-1}getLastVisibleRow(e=1/0){for(let t=Math.min(e,this.rows.length-1);t>=0;t--)if(this.rows[t].isVisible)return t;return-1}getNextVisibleColumn(e=0){for(let t=Math.max(e,0);t<this.columns.length;t++)if(this.columns[t].isVisible)return t;return-1}getLastVisibleColumn(e=1/0){for(let t=Math.min(e,this.columns.length-1);t>=0;t--)if(this.columns[t].isVisible)return t;return-1}_toIndex(e){if(wijmo_1.isString(e)&&(e=this._cols.indexOf(e))<0)throw"Invalid column name or binding.";return e}_getAdjustedSelection(e){let t=this._g,i=this._rng,l=SelectionMode;switch(t.selectionMode){case l.Cell:i.setRange(e.row,e.col,e.row,e.col);break;case l.Row:i.setRange(e.row,0,e.row,t.columns.length-1);break;case l.RowRange:case l.ListBox:i.setRange(e.row,0,e.row2,t.columns.length-1);break;default:i.copy(e)}return i}_getOffsetY(){return this._offsetY}_updateContent(e,t,i,l){let s=this._g,o=this._e,n=this._rows,r=this._cols,a=this._ct;if(a==CellType.ColumnHeader||a==CellType.ColumnFooter||a==CellType.RowHeader){let e=s._ptScrl,t=o.style;a==CellType.RowHeader?t.top=e.y+"px":s.rightToLeft?t.right=e.x+"px":t.left=e.x+"px"}if(this._offsetY!=i){e=!1;this._offsetY=i}let h=this._getViewRange(),d=h;if(d.isValid){let e=n.length<=s._vtRows?n.length:0,t=r.length<=s._vtCols?r.length:0,i=n._frozenInternal>=0?Math.max(h.row-e,n._frozenInternal):Math.max(h.row-e,0),l=n._frozenInternal>=0?Math.min(h.row2+e,n.length-1):Math.min(h.row2+e,n.length-1+n._frozenInternal),o=r._frozenInternal>=0?Math.max(h.col-t,r._frozenInternal):Math.max(h.col-t,0),a=r._frozenInternal>=0?Math.min(h.col2+t,r.length-1):Math.min(h.col2+t,r.length-1+r._frozenInternal);d=new CellRange(i,o,l,a)}if(e&&!t&&this._vrb.contains(h)&&!n._frozenInternal&&!r._frozenInternal)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=h;this._vrb=d;this._recycle=e;let _=this.grid.topLeftCells.hostElement.parentElement;[HeadersVisibility.Row,HeadersVisibility.Column].includes(s.headersVisibility)?wijmo_1.setAttribute(_,"aria-hidden",!0):_.removeAttribute("aria-hidden");this._updateCells(t,0,l);return this._activeCell}_updateCells(e,t,i){let l=this._rows;const renderFrozenInternalMoreThanZero=()=>{for(let s=0;s<l._frozenInternal&&s<l.length;s++)t=this._renderRow(s,this._vrb,e,t,i)},renderFrozenInternalLessThanZero=()=>{for(let s=l._lastFrozen;s<l.length;s++)t=this._renderRow(s,this._vrb,e,t,i)},renderVisibleRange=()=>{for(let l=this._vrb.topRow;l<=this._vrb.bottomRow&&l>-1;l++)t=this._renderRow(l,this._vrb,e,t,i)};if(l._frozenInternal>0){renderFrozenInternalMoreThanZero();renderVisibleRange()}else if(l._frozenInternal<0){renderVisibleRange();renderFrozenInternalLessThanZero()}else renderVisibleRange();this._scanAndRemoveExtraCells(t)}_scanAndRemoveExtraCells(e){let t=this._e;for(;t.childElementCount>e;){let e=t.lastElementChild;wijmo_1.removeChild(e);this._removeExtraCells(e,0)}}_clearCells(){let e=this.hostElement,t=this._g.cellFactory;for(let i=e.childElementCount-1;i>=0;i--){let l=e.children[i];for(let e=l.childElementCount-1;e>=0;e--){delete l.children[e][GridPanel._INDEX_KEY];t.disposeCell(l.children[e])}wijmo_1.removeChild(l)}e.innerHTML=""}_reorderCells(e,t){if(!(this._g._reorderCells&&t.isValid&&e.isValid&&e.intersects(t)))return;const relocateForScrollToBeginning=(e,t,i,l,s,o)=>{wijmo_1.assert(i<0,"Scroll delta must be a negative number");let n,r,a=-i,h=t+(l-s+1),d=e.childElementCount-h;if(d<a&&d>0){n=d;r=a-d}else{n=a;r=0}if(n>0){let i=this._createRange(e,h,h+n);i&&e.insertBefore(i.extractContents(),e.children[t])}if(r>0){let i=e.children[t];for(let t=0;t<r;t++){let t=document.createElement("div");t.className=o;e.insertBefore(t,i)}}};if(e.row!=t.row){let i=this._e,l=e.row-t.row;if(0!=l){let s=this._ct==CellType.Cell?1:0,o=i.childElementCount;this.rows._frozenInternal>0&&(s+=this.rows._frozenInternal);if(l>0){let e=s,t=Math.min(s+l,o),n=this._createRange(i,e,t);n&&i.appendChild(n.extractContents())}else relocateForScrollToBeginning(i,s,l,e.row2,t.row,exports.FlexGridClsNames.row)}}if(e.col!=t.col){let i=this._e,l=e.col-t.col;if(0!=l){let s=this._ct==CellType.Cell&&this._g.rowHeaderPath?1:0;this.columns._frozenInternal>=0&&(s+=this.columns._frozenInternal);for(let o=0;o<i.children.length;o++){let n=i.children[o],r=n.children.length;this.columns._frozenInternal<0&&(r+=this.columns._frozenInternal);if(wijmo_1.hasClass(n,exports.FlexGridClsNames.row))if(l>0){let e=s,t=Math.min(s+l,r),i=this._createRange(n,e,t);i&&n.appendChild(i.extractContents())}else relocateForScrollToBeginning(n,s,l,e.col2,t.col,exports.FlexGridClsNames.cell)}}}}_createRange(e,t,i){if(i>t&&i<=e.children.length&&t>-1){this._docRange||(this._docRange=document.createRange());let l=this._docRange;l.setStart(e,t);l.setEnd(e,i);return l}return null}_renderRowHdrCell(e,t,i){let l=e.children[0];l||(l=wijmo_1.createElement(GridPanel._HTML_CELL,e));l.setAttribute("role",t<0?"columnheader":"rowheader");l.textContent=i?i.toString():"";wijmo_1.setCss(l,{position:"fixed",left:-32e3,top:-32e3,width:.1,height:.1,overflow:"hidden",opacity:"0"});l[GridPanel._INDEX_KEY]={row:t,col:-1,panel:this};return 1}_renderRow(e,t,i,l,s){let o=this._g,n=this.rows[e];if(n.renderSize<=0)return l;let r=this._e.children[l];r||(r=wijmo_1.createElement(`<div class="${exports.FlexGridClsNames.row}"></div>`,this._e));const a=this._g.columnHeaders&&this._g.columnHeaders.rows&&this._g.columnHeaders.rows.length||0,h=this._g.headersVisibility&HeadersVisibility.Column?a:0,makeId=(e,t,i)=>`${o._ariaId}-${e}-${t}-${i}`,setAriaOwns=(t,i)=>{const l=[];for(let s=0;s<i;s++)l.push(makeId(t,e,s));return l.join(" ")};switch(this._ct){case CellType.ColumnHeader:if(o.headersVisibility&HeadersVisibility.Row&&o.headersVisibility&HeadersVisibility.Column){const e=[],t=setAriaOwns("tl",o.topLeftCells.columns.length);t&&e.push(t);const i=setAriaOwns("ch",this.columns.length);i&&e.push(i);const l=e.join(" ");l&&wijmo_1.setAttribute(r,"aria-owns",l)}wijmo_1.setAttribute(r,"aria-rowindex",e+1);break;case CellType.TopLeft:wijmo_1.setAttribute(r,"aria-rowindex",e+1);break;case CellType.Cell:if(o.headersVisibility&HeadersVisibility.Row){const e=[],t=setAriaOwns("rh",o.rowHeaders.columns.length);t&&e.push(t);const i=setAriaOwns("cell",o.cells.columns.length);i&&e.push(i);const l=e.join(" ");this._allowSetAriaOwns(l,r)?wijmo_1.setAttribute(r,"aria-owns",l):wijmo_1.setAttribute(r,"aria-owns")}wijmo_1.setAttribute(r,"aria-rowindex",e+1+h);break;case CellType.RowHeader:wijmo_1.setAttribute(r,"aria-rowindex",e+1+h);break;case CellType.BottomLeft:case CellType.ColumnFooter:{if(o.headersVisibility&HeadersVisibility.Row){const e=[],t=setAriaOwns("bl",o.bottomLeftCells.columns.length);t&&e.push(t);const i=setAriaOwns("cf",o.columnFooters.columns.length);i&&e.push(i);const l=e.join(" ");l&&wijmo_1.setAttribute(r,"aria-owns",l)}const t=a+o.rows.length+e+1;wijmo_1.setAttribute(r,"aria-rowindex",t);break}}if(this._ct==CellType.Cell){r.setAttribute("role","row");let t=SelectionMode,i=n.isSelected;switch(o.selectionMode){case t.Row:case t.RowRange:i=i||this._g._selHdl.selection.containsRow(e)}wijmo_1.setAttribute(r,"aria-selected",!!i||null);wijmo_1.setAttribute(r,"aria-level",n instanceof GroupRow?n.level+1:null);wijmo_1.setAttribute(r,"aria-expanded",n instanceof GroupRow?!n.isCollapsed:null);this.rows.ariaLabel&&wijmo_1.setAttribute(r,"aria-label",this.rows.ariaLabel)}this._ct!==CellType.TopLeft&&this._ct!==CellType.ColumnFooter&&this._ct!==CellType.BottomLeft||r.setAttribute("role","row");let d=0;if(this._ct==CellType.Cell||this._ct==CellType.ColumnHeader){const t=this._g._getRowHeaderPath();if(t){let[i,l]=this._ct==CellType.Cell?[t.getValue(n.dataItem),e]:[t.path,-1];d=this._renderRowHdrCell(r,l,i)}}let _=t.clone();_.col=this.columns._frozenInternal>=0?0:this.columns.length+this.columns._frozenInternal;_.col2=this.columns._frozenInternal>=0?this.columns._frozenInternal-1:this.columns.length-1;if(this.columns._frozenInternal>=0)for(let t=0;t<this.columns._frozenInternal&&t<this.columns.length;t++)d=this._renderCell(r,e,t,_,i,d,s);else for(let t=Math.max(0,this.columns.length+this.columns._frozenInternal);t<this.columns.length;t++)d=this._renderCell(r,e,t,_,i,d,s);if(t.leftCol>-1){let l=o.getMergedRange(this,e,t.leftCol,!1),n=-1;if(l){n=l.leftCol;for(;!this.columns[n].isVisible&&n<l.rightCol;)n++}l&&n<t.leftCol&&(d=this._renderCell(r,e,n,t,i,d,s))}for(let l=t.leftCol;l<=t.rightCol&&l>-1;l++)d=this._renderCell(r,e,l,t,i,d,s);this._removeExtraCells(r,d);return l+1}_allowSetAriaOwns(e,t){return!!e&&!wijmo_1.hasClass(t,"wj-detail-row")}_renderCell(e,t,i,l,s,o,n){let r=this._g,a=this._ct==CellType.Cell||r.rows.length<=r._vtRows||r.columns.length<=r._vtCols?r.getMergedRange(this,t,i,!1):r.getMergedRange(this,t,i);if(a){for(let e=Math.max(l.row,a.row);e<t;e++)if(this.rows[e].renderSize)return o;for(let e=Math.max(l.col,a.col);e<i;e++)if(this.columns[e].renderSize)return o;if(t>=a.row&&t<=a.row2&&i>a.col&&i<=a.col2&&this._ct===CellType.Cell&&a.isSingleCell)return o;var h=this.columns._frozenInternal;if(h&&a.col<h&&a.col2>=h&&i>a.col)return o;if(!this.columns[i].isVisible&&"DetailRow"!==this._rows[t].constructor.name)return o;if(a.leftCol!=i)for(let e=a.leftCol;e<i;e++)if(this.columns[e].isVisible)return o}let d=this.columns[i];if((!d||d.renderSize<=0)&&(!a||a.getRenderSize(this).width<=0))return o;let _=e.children[o];if(_&&!s&&this._recycle&&r._lazyRender&&!r.activeEditor){let e=_[GridPanel._INDEX_KEY];e&&e.row==t&&e.col==i&&e.rng==a&&(this.rows.isFrozen(t)||this.columns.isFrozen(i)||(s=!0))}let c=SelectedState,u=this.getSelectedState(t,i,a),g=u==c.Cursor||u==c.Active,m=!1;switch(this.cellType){case CellType.RowHeader:case CellType.ColumnHeader:case CellType.TopLeft:case CellType.BottomLeft:case CellType.ColumnFooter:m=!0}if(_&&s){wijmo_1.toggleClass(_,wijmo_1.ControlStateClsNames.active,g);wijmo_1.toggleClass(_,m?exports.FlexGridClsNames.focusHeaderCell:wijmo_1.ControlStateClsNames.selected,u==c.Cursor);wijmo_1.toggleClass(_,wijmo_1.ControlStateClsNames.multiSelected,u==c.Selected);const e=_.querySelector(".wj-column-selector");e?g||u!=c.None?wijmo_1.setAttribute(_,"aria-selected",!!e.checked):wijmo_1.setAttribute(_,"aria-selected",null):wijmo_1.setAttribute(_,"aria-selected",!(!g&&u==c.None)||null);g&&(this._activeCell=_);return o+1}_||(_=wijmo_1.createElement(GridPanel._HTML_CELL,e));let w=n?i+1+n:i+1;wijmo_1.setAttribute(_,"aria-colindex",w);g&&(this._activeCell=_);if(this._ct==CellType.Cell){wijmo_1.setAttribute(_,"role","gridcell");wijmo_1.setAttribute(_,"aria-selected",!(u==c.None&&!g)||null);let e=!r.canEditCell(t,i)||null;wijmo_1.setAttribute(_,"aria-readonly",e);wijmo_1.setAttribute(_,"aria-required",e?null:d.getIsRequired())}this._ct!==CellType.ColumnFooter&&this._ct!==CellType.BottomLeft||wijmo_1.setAttribute(_,"role","gridcell");r.cellFactory.updateCell(this,t,i,_,a);_[GridPanel._INDEX_KEY]={row:t,col:i,rng:a,panel:this};return o+1}_removeExtraCells(e,t){let i=this._g.cellFactory;this.cellType===CellType.RowHeader&&0===t&&wijmo_1.setAttribute(e,"aria-hidden","true");for(;e.childElementCount>t;){let t=e.lastElementChild;delete t[GridPanel._INDEX_KEY];wijmo_1.removeChild(t);i.disposeCell(t)}}_getViewRange(){let e=this._g,t=e._ptScrl,i=e._szClientSB,l=this._rows,s=this._cols,o=new CellRange(0,0,l.length-1,s.length-1);if(this._ct==CellType.Cell||this._ct==CellType.RowHeader){let s=-t.y+this._offsetY,n=i.height,r=Math.min(Math.abs(l._frozenInternal),l.length-1);if(r>0)if(l._frozenInternal>=0){let e=l[r-1].pos;s+=e;n-=e}else{n+=l[l.length-r]._antipos}if(l._frozenInternal>=0)if(r>0&&l[r].pos>i.height)o.row=o.row2=-1;else{o.row=Math.min(l.length-1,Math.max(r,l.getItemAt(s)));o.row2=Math.max(o.row,l.getItemAt(s+n))}else if(r>0&&l[l.length-r]._antipos+i.height<0)o.row=o.row2=-1;else{o.row=Math.min(l.length+l._frozenInternal-1,l.getItemAt(s));o.row2=Math.max(o.row,l.getItemAt(s+n));e.columnFooters.rows.length>0&&(o.row2-=e.columnFooters.rows.length)}let a=e.hostElement;if(e._clipToScreen&&a){let t=a.getBoundingClientRect(),i=-t.top-e.cells._e.offsetTop;t.top<0&&(o.row=Math.max(o.row,l.getItemAt(i)-1));t.bottom>innerHeight&&(o.row2=Math.min(o.row2,l.getItemAt(i+innerHeight)+1))}}if(this._ct==CellType.Cell||this._ct==CellType.ColumnHeader){let e=-t.x,l=i.width,n=Math.min(Math.abs(s._frozenInternal),s.length-1);if(n>0&&s._frozenInternal>0){let t=s[n-1].pos;e+=t;l-=t}else if(n>0&&s._frozenInternal<0){e+=s[0].pos}if(s._frozenInternal>=0?n>0&&s[n].pos>i.width:n>0&&Math.abs(s[s.length-n]._antipos)>i.width)o.col=o.col2=-1;else if(s._frozenInternal>=0){o.col=Math.min(s.length-1,Math.max(n,s.getItemAt(e)));o.col2=Math.max(o.col,s.getItemAt(e+l))}else{o.col=Math.min(s.length-1,Math.max(0,s.getItemAt(e)));o.col2=Math.max(o.col,s.getItemAt(e+l-s._frozenColAreaWidth))}}l.length<=Math.abs(l._frozenInternal)&&(o.row=o.row2=-1);s.length<=Math.abs(s._frozenInternal)&&(o.col=o.col2=-1);return o}_getFrozenPos(){let e=this._rows._frozenInternal,t=this._cols._frozenInternal,i=null,l=null,s=0,o=0;e>0?s=(i=e>0?this._rows[e-1]:null)?i.pos+i.renderSize:0:e<0&&this._rows.lastFrozen&&(s=Math.min(this._rows.lastFrozen.pos,this._g._szClient.height+this._rows.lastFrozen._antipos));t>0?o=(l=t>0?this._cols[t-1]:null)?l.pos+l.renderSize:0:t<0&&this._cols.lastFrozen&&(o=Math.min(this._cols.lastFrozen.pos,this._g._szClient.width+this._cols.lastFrozen._antipos));return new wijmo_1.Point(o,s)}dispose(){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>`;exports.GridPanel=GridPanel;class CellRangeEventArgs extends wijmo_1.CancelEventArgs{constructor(e,t,i){super();this._p=wijmo_1.asType(e,GridPanel,!0);this._rng=wijmo_1.asType(t,CellRange,!0);this._data=i}get panel(){return this._p}get range(){return this._rng.clone()}get row(){return this._rng.row}get col(){return this._rng.col}get data(){return this._data}set data(e){this._data=e}getRow(){return this._p&&this.row>-1?this._p.rows[this.row]:null}getColumn(e){let t=this._p,i=t&&this.col>-1?t.columns[this.col]:null;if(i&&e){let e=t.grid;i=t.cellType===CellType.ColumnHeader&&e._hasColumnGroups()?e._getColumnGroup(this.row,this.col):t.grid._getBindingColumn(t,this.row,i)}return i}}exports.CellRangeEventArgs=CellRangeEventArgs;class FormatItemEventArgs extends CellRangeEventArgs{constructor(e,t,i,l=!0){super(e,t);this._updateContent=!0;this._cell=wijmo_1.asType(i,HTMLElement)}get cell(){return this._cell}get updateContent(){return this._updateContent}}exports.FormatItemEventArgs=FormatItemEventArgs;class CellEditEndingEventArgs extends CellRangeEventArgs{constructor(){super(...arguments);this._stayInEditMode=!1;this._refresh=!0}get stayInEditMode(){return this._stayInEditMode}set stayInEditMode(e){this._stayInEditMode=wijmo_1.asBoolean(e)}get refresh(){return this._refresh}set refresh(e){this._refresh=wijmo_1.asBoolean(e)}get previousData(){return null!=this._previousData?this._previousData:this._data}set previousData(e){this._previousData=e}}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={}));class _SelectionHandler{constructor(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=()=>{e.invalidate()};this._xSel.collectionChanged.addHandler(this._collectionChangedHandler)}get selectionMode(){return this._mode}set selectionMode(e){e!=this._mode&&this._setSelectionMode(e)}get selection(){return this._sel}set selection(e){this.select(e)}get extendedSelection(){return this._xSel}get cellRangeEventArgs(){return this._e}select(e,t=!0,i=!1,l){l||(l=this._g._gpCells);let s=this._g,o=this._e.range,n=this._sel,r=o,a=!1,h=SelectionMode,d=s.activePanelType,_=l.cellType==CellType.RowHeader||l.cellType==CellType.ColumnHeader,c=l.cellType==CellType.BottomLeft||l.cellType==CellType.ColumnFooter,u=!_&&!c;s._mouseHdl._eMouse&&(s._mouseHdl._eMouse.ctrlKey||s._mouseHdl._eMouse.metaKey);if(wijmo_1.isNumber(e)&&wijmo_1.isString(t)){let i=l.columns.indexOf(t);if(i<0)throw"Invalid column name or binding.";o.setRange(e,i);t=!0}else if(wijmo_1.isNumber(e)&&wijmo_1.isNumber(t)){o.setRange(e,t);t=!0}else e instanceof CellRange?o.copy(e):wijmo_1.assert(!1,"CellRange expected");s.activePanel=l;switch(s.selectionMode){case h.Cell:r.row2=r.row;r.col2=r.col;break;case h.Row:r.row2=r.row;break;case h.ListBox:a=!0}if(_||c){r.row2=r.row;r.col2=r.col}let g=r.equals(n)&&d==l.cellType;if(g&&a&&u)for(let e=0;e<s.rows.length;e++)if(s.rows[e].isSelected!==r.containsRow(e)){g=!1;break}if(g){t&&l.isRangeValid(r)&&this._showSelection();return!0}let m=wijmo_1.Control.getControl(wijmo_1.closest(wijmo_1.getActiveElement(),`.${exports.FlexGridClsNames.hostElement}`));if(m&&m==s&&m.activeEditor&&!m.finishEditing())return!1;let w=this._e;w._rng=r;w.cancel=!1;if(!s.onSelectionChanging(w)&&!i)return!1;u&&a&&s.rows.forEach((e,t)=>{e._setFlag(RowColFlags.Selected,r.containsRow(t),!0)});r.row=Math.min(r.row,l.rows.length-1);r.row2=Math.min(r.row2,l.rows.length-1);this._sel.copy(r);s.refreshCells(!1,!0,!0);t&&this._showSelection();let p=s.collectionView;if(p&&u){let e=s._getCvIndex(r.row);p.moveCurrentToPosition(e)}const f=wijmo_1.getActiveElement();this._g.errorTip&&(f.classList.contains(wijmo_1.ControlStateClsNames.invalid)?this._g.errorTip._showAutoTip(void 0,f):this._g.errorTip.hide());s.onSelectionChanged(w);return!0}moveSelectionWithinSelectedPanel(e,t){let i=this._g,l=this._sel.clone(),s=i.activePanel,o=i.getMergedRange(s,l.row,l.col,!1);o||(o=new CellRange(l.row,l.col));if(e>0){let t=s.getNextVisibleRow(o.bottomRow+e);t>=0&&(l.row=l.row2=t);if(!s.columns[l.col].isVisible){let e=s.getNextVisibleColumn(o.leftCol);e>=0&&(l.col=l.col2=e)}}else if(e<0){let t=s.getLastVisibleRow(o.topRow+e);t>=0&&(l.row=l.row2=t)}if(t>0){let e=s.getNextVisibleColumn(o.rightCol+t);e>=0&&(l.col=l.col2=e)}else if(t<0){let e=s.getLastVisibleColumn(o.leftCol+t);e>=0&&(l.col=l.col2=e)}l.equals(this._sel)||i.select(l,!0,s)}moveSelection(e,t,i){let l=this._g,s=this._sel,o=i&&l.anchorCursor?new CellRange(s.row2,s.col2):new CellRange(s.row,s.col),n=o.row,r=o.col,a=l.columns,h=Math.max(0,l._szClient.height-l.columnHeaders.height),d=SelMove,_=-1;var c=l.getMergedRange(l.cells,n,r);let u=0;if(c){t==d.Next||t==d.NextCell||t==d.NextEditableCell?r=c.rightCol:t!=d.Prev&&t!=d.PrevCell&&t!=d.PrevEditableCell||(r=c.leftCol);if(e==d.Next||e==d.NextCell||e==d.NextEditableCell){n=c.bottomRow;if(softMultirow()&&l instanceof softMultirow().MultiRow){u=o.row-c.topRow;if(c.bottomRow===l.rows.length-1)return}}else if(e==d.Prev||e==d.PrevCell||e==d.PrevEditableCell){n=c.topRow;if(softMultirow()&&l instanceof softMultirow().MultiRow){u=o.row-c.bottomRow;if(0===c.topRow)return}}}switch(t){case d.NextCell:case d.NextEditableCell:_=r;(r=this._getNextColumnCell(n,_,t))!=_&&(c=l.getMergedRange(l.cells,n,r))&&r<c.col2&&(r=c.col2);if(r==_)for(;;){if(n==l.rows.length-1){r=o.col;n=o.row;break}let e=!1;if((n=this._getNextRowCell(n,r,t))>o.row){_=-1;for(;_<a.length;){if((r=this._getNextColumnCell(n,_,t))==_){e=!0;break}(c=l.getMergedRange(l.cells,n,r))&&r<c.col2&&(r=c.col2);break}if(e)continue}break}l.select(n,r);break;case d.PrevCell:case d.PrevEditableCell:_=r;(r=this._getNextColumnCell(n,_,t))!=_&&(c=l.getMergedRange(l.cells,n,r))&&r>c.col&&(r=c.col);if(r==_)for(;;){if(0==n){r=o.col;n=o.row;break}let e=!1;if((n=this._getNextRowCell(n,r,t))<o.row){_=a.length;for(;_>-1;){(r=this._getNextColumnCell(n,_,t))!=_?(c=l.getMergedRange(l.cells,n,r))&&r>c.col&&(r=c.col):e=!0;break}if(e)continue}break}l.select(n,r);break;default:n=this._getNextRowCell(n,r,e,h);n+=u;r=this._getNextColumnCell(n,r,t,h);i?l.selection=l.anchorCursor?new CellRange(s.row,s.col,n,r):new CellRange(n,r,s.row2,s.col2):l.select(n,r)}}_getNextColumnCell(e,t,i,l=0){return this._g.columns.getNextCell(t,i,l)}_getNextRowCell(e,t,i,l=0){return this._g.rows.getNextCell(e,i,l)}_setSelectionMode(e){let t=this._g,i=t.rows;this._mode=e;this._xSel.clear();if(i.length){this._adjustSelection(this._sel,e,!0);t.invalidate()}}_adjustSelection(e,t,i=!1){const l=this._g.rows,s=SelectionMode;let o=void 0;if(this._g.hostElement){o=this._g.hostElement.querySelector("input.wj-column-selector")instanceof HTMLInputElement}if(!o)for(let e=0;e<l.length;e++)l[e]._setFlag(RowColFlags.Selected,!1,!0);let n=e.clone();switch(t){case s.None:n=new CellRange;break;case s.Cell:n=new CellRange(e.row,e.col);break;case s.ListBox:if(o)return;for(let e=0;e<l.length;e++)l[e]._setFlag(RowColFlags.Selected,n.containsRow(e),!0)}this.select(n,!1,i)}_expandSelection(){let e=this._g,t=e.selectionMode;if(e.expandSelectionOnCopyPaste&&t){let i=this.selection,l=SelectionMode;switch(t){case l.Cell:case l.Row:break;case l.ListBox:this._expandSelectedRows();break;case l.RowRange:i=new CellRange(i.topRow,0,i.bottomRow,e.columns.length-1);default:let t=this._expandSelectionRange(i);t&&this.select(t,!1)}}}_deselectRange(e){let t=this.selection,i=this.extendedSelection;if(t.contains(e)){let e=i.length;this._sel=e?i[e-1]:new CellRange;e&&i.removeAt(e-1);return!0}for(let t=0;t<i.length;t++)if(i[t].contains(e)){i.removeAt(t);return!0}return!1}_expandSelectedRows(){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"ListBox mode expected");let e=this._g,t=e.selectedRows.map(e=>e.index),i=[];for(let l=0;l<t.length;l++){let s=new CellRange(t[l],0,t[l],e.columns.length-1),o=this._expandSelectionRange(s)||s;for(let e=o.topRow;e<=o.bottomRow;e++)-1===i.indexOf(e)&&i.push(e)}i.sort();this._selectRows(i)}_expandSelectionRange(e){let t=this._g,i=t.cells,l=t.getMergedRange(i,e.topRow,e.leftCol,!1),s=t.getMergedRange(i,e.bottomRow,e.leftCol,!1),o=t.getMergedRange(i,e.topRow,e.rightCol,!1),n=t.getMergedRange(i,e.bottomRow,e.rightCol,!1);if(l||s||o||n){l=l||new CellRange(e.topRow,e.leftCol);s=s||new CellRange(e.bottomRow,e.leftCol);o=o||new CellRange(e.topRow,e.rightCol);n=n||new CellRange(e.bottomRow,e.rightCol);return new CellRange(Math.min(l.topRow,s.topRow,o.topRow,n.topRow),Math.min(l.leftCol,s.leftCol,o.leftCol,n.leftCol),Math.max(l.bottomRow,s.bottomRow,o.bottomRow,n.bottomRow),Math.max(l.rightCol,s.rightCol,o.rightCol,n.rightCol))}return null}_selectRows(e){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"ListBox mode expected");let t=this._g;for(let i=0,l=!0;i<t.rows.length;i++){let s=t.rows[i],o=e&&e.indexOf(s.index)>-1;if(o&&l){l=!1;this.select(i,this.selection.col)}s.isSelected=o}}_showSelection(){let 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()}_showHeaderSelection(){const e=this._g.activePanel.activeCell;if(e){const t=e.getBoundingClientRect();let i=0,l=0;const s=document.documentElement.clientWidth,o=document.documentElement.clientHeight;t.y<0?i=t.y:t.y>o-2&&(i=t.y-o+t.height);t.x<0?l=t.x:t.x>s-2&&(l=t.x-s+t.width);0==i&&0==l||window.scrollBy(l,i)}}_adjustReferenceCell(e,t,i){let l=this._g,s=l.getMergedRange(l.cells,e.row,e.col);if(s&&!s.isSingleCell){let l=SelMove;switch(t){case l.Next:case l.NextCell:case l.NextEditableCell:e.row=s.bottomRow;break;case l.Prev:case l.PrevCell:case l.PrevEditableCell:e.row=s.topRow}switch(i){case l.Next:case l.NextCell:case l.NextEditableCell:e.col=s.rightCol;break;case l.Prev:case l.PrevCell:case l.PrevEditableCell:e.col=s.leftCol}}}dispose(){if(this._xSel&&this._collectionChangedHandler){this._xSel.collectionChanged.removeHandler(this._collectionChangedHandler);this._collectionChangedHandler=null}this._g=null;this._e=null;this._xSel=null}}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={}));class RowCol{constructor(){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._antipos=0;this._idx=-1;this._idxVis=-1;this._idxData=-1;this.gridChanged=new wijmo_1.Event}get binding(){return this._binding?this._binding.path:null}set binding(e){if(e!=this.binding){let t=wijmo_1.asString(e);this._binding=t?new wijmo_1.Binding(t):null;if(!this._type&&this.grid&&this._binding){let e=this.grid.collectionView;if(e&&e.sourceCollection&&e.sourceCollection.length){let t=e.sourceCollection[0];this._type=wijmo_1.getType(this._binding.getValue(t))}}this.onPropertyChanged()}}get sortMemberPath(){return this._bindingSort?this._bindingSort.path:null}set sortMemberPath(e){if(e!=this.sortMemberPath){let t=wijmo_1.asString(e);this._bindingSort=t?new wijmo_1.Binding(t):null;this.onPropertyChanged()}}get dataType(){return this._type}set dataType(e){e=wijmo_1.asEnum(e,wijmo_1.DataType,!0);if(this._type!=e){this._type=e;this.grid&&this.grid.invalidate()}}get inputType(){return this._inpType}set inputType(e){this._inpType=wijmo_1.asString(e,!0)}get mask(){return this._mask}set mask(e){this._mask=wijmo_1.asString(e,!0)}get maxLength(){return this._maxLen}set maxLength(e){this._maxLen=wijmo_1.asNumber(e,!0,!0)}get align(){return this._align}set align(e){if(this._align!=e){this._align=e;this.onPropertyChanged()}}get format(){return this._fmt}set format(e){if(this._fmt!=e){this._fmt=e;this.onPropertyChanged()}}get dataMap(){return this._map}set dataMap(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()}}get dataMapEditor(){return null!=this._mapEditor?this._mapEditor:DataMapEditor.DropDownList}set dataMapEditor(e){if(e!=this._mapEditor){this._mapEditor=wijmo_1.asEnum(e,DataMapEditor);this.grid&&this.grid.invalidate()}}get showDropDown(){return this.dataMapEditor==DataMapEditor.DropDownList}set showDropDown(e){wijmo_1._deprecated("showDropDown","dataMapEditor");this.dataMapEditor=e?DataMapEditor.DropDownList:DataMapEditor.AutoComplete}get dropDownCssClass(){return this._ddCssClass}set dropDownCssClass(e){this._ddCssClass=wijmo_1.asString(e)}get visible(){return this._getFlag(RowColFlags.Visible)}set visible(e){this._setFlag(RowColFlags.Visible,e)}get isVisible(){return!!this._getFlag(RowColFlags.Visible)&&(!this._getFlag(RowColFlags.ParentCollapsed)||this instanceof _NewRowTemplate)}get pos(){this._list&&this._list._dirty&&this._list._update();return this._pos}get index(){this._list&&this._list._dirty&&this._list._update();return this._idx}get visibleIndex(){this._list&&this._list._dirty&&this._list._update();return this.isVisible?this._idxVis:-1}get size(){return this._sz}set size(e){if(e!=this._sz){this._sz=wijmo_1.asNumber(e,!0);this.onPropertyChanged()}}get renderSize(){let 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}get allowResizing(){return this._getFlag(RowColFlags.AllowResizing)}set allowResizing(e){this._setFlag(RowColFlags.AllowResizing,e)}get allowDragging(){return this._getFlag(RowColFlags.AllowDragging)}set allowDragging(e){this._setFlag(RowColFlags.AllowDragging,e)}get allowMerging(){return this._getFlag(RowColFlags.AllowMerging)}set allowMerging(e){this._setFlag(RowColFlags.AllowMerging,e)}get isSelected(){return this._getFlag(RowColFlags.Selected)}set isSelected(e){if(!!e!=this.isSelected){let t=this.grid;if(t){const i=this instanceof Row?new CellRange(this.index,0,this.index,t.columns.length-1):new CellRange(0,this.index,t.rows.length-1,this.index);let l=new CellRangeEventArgs(t?t.cells:null,i);if(t.onSelectionChanging(l)&&this._setFlag(RowColFlags.Selected,e,!0)){t.refreshCells(!1,!0,!0);t.onSelectionChanged(l)}}else this._setFlag(RowColFlags.Selected,e)}}get isReadOnly(){return this._getFlag(RowColFlags.ReadOnly)}set isReadOnly(e){this._setFlag(RowColFlags.ReadOnly,e)}get isRequired(){return this._required}set isRequired(e){this._required=wijmo_1.asBoolean(e,!0)}get isContentHtml(){return this._getFlag(RowColFlags.HtmlContent)}set isContentHtml(e){if(this.isContentHtml!=e){this._setFlag(RowColFlags.HtmlContent,e);this.grid&&this.grid.invalidate()}}get wordWrap(){return this._getFlag(RowColFlags.WordWrap)}set wordWrap(e){this._setFlag(RowColFlags.WordWrap,e)}get multiLine(){return this._getFlag(RowColFlags.MultiLine)}set multiLine(e){this._setFlag(RowColFlags.MultiLine,e)}get cssClass(){return this._cssClass}set cssClass(e){if(e!=this._cssClass){this._cssClass=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}}get cssClassAll(){return this._cssClassAll}set cssClassAll(e){if(e!=this._cssClassAll){this._cssClassAll=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}}get grid(){return this._list?this._list._g:null}get collectionView(){return this.grid?this.grid.collectionView:null}onPropertyChanged(){if(this._list){this._list._dirty=!0;this.grid.invalidate()}}onGridChanged(e){this.gridChanged.raise(this,e)}_setList(e){if(e!=this._list){this._list=e;this.onGridChanged()}}_getFlag(e){return 0!=(this._f&e)}_setFlag(e,t,i){if(!!t!=this._getFlag(e)){this._f=t?this._f|e:this._f&~e;i||this.onPropertyChanged();return!0}return!1}}exports.RowCol=RowCol;class Column extends RowCol{constructor(e){super();this._hdr=null;this._plholder=null;this._name=null;this._agg=null;this._quickSize=null;this._descById=null;this._sortOrder=null;this._tpl=null;this._f=RowColFlags.ColumnDefault;this._hash=Column._ctr.toString(36);Column._ctr++;wijmo_1.copy(this,e);this._uid=wijmo_1.uidGenerator()}get name(){return this._name}set name(e){this._name=e}get width(){return null!=this._szStar?this._szStar:this.size}set width(e){if(null!=Column._parseStarSize(e)){this._szStar=e;this.onPropertyChanged()}else{this._szStar=null;this.size