1(function() { 2var GridCellFocusHelper = ASPx.CreateClass(ASPx.CellFocusHelper, { 3 constructor: function(owner) { 4 this.constructor.prototype.constructor.call(this, owner); 5 this.grid = owner; 6 }, 7 ConvertKeyToVisibleIndex: function(key) { return this.grid.ConvertKeyToVisibleIndex(key); }, 8 ConvertVisibleIndexToKey: function(visibleIndex) { return this.grid.ConvertVisibleIndexToKey(visibleIndex); }, 9 IsCommandColumnItem: function(element) { return this.grid.IsCommandColumnItem(element); }, 10 CanFocusOnCommandColumnItemMouseDown: function(source) { 11 var grid = this.grid; 12 var button = grid.FindCommandButtonByChildElement(source); 13 return !!button && !grid.IsNewButton(button) && !grid.IsEditButton(button) && !grid.IsDeleteButton(button) && !grid.IsCancelButton(button); 14 }, 15 IsDeletedItem: function(recordKey) { return this.grid.IsBatchEditDeletedItem(this.ConvertKeyToVisibleIndex(recordKey)); }, 16 GetMainTable: function() { return this.grid.GetMainTable();}, 17 GetChildElement: function(id) { return this.grid.GetChildElement(id); }, 18 GetCssClassNamePrefix: function() { return this.grid.GetCssClassNamePrefix(); }, 19 RaiseFocusedCellChanging: function(cellInfo) { return this.grid.RaiseFocusedCellChanging(cellInfo); }, 20 OnBeforeFocusedCellChanging: function(cellInfo, htmlEvent) { return this.grid.OnBeforeFocusedCellChanging(cellInfo, htmlEvent); }, 21 OnFocusedCellChanged: function(cellInfo) { this.grid.OnFocusedCellChanged(cellInfo); }, 22 GetScrollHelper: function() { return this.grid.GetScrollHelper(); }, 23 GetDataItem: function(recordKey) { return this.grid.GetDataItem(this.ConvertKeyToVisibleIndex(recordKey)); }, 24 GetRecordKeyByChild: function(element) { 25 var item = this.GetGridItemByChild(element); 26 if(!item) return; 27 var visibleIndex = this.grid.getItemIndex(item.id); 28 return this.ConvertVisibleIndexToKey(visibleIndex); 29 }, 30 GetColumnIndexByCell: function(cell) { return this.grid.GetColumnIndexByDataCell(cell); }, 31 TryShowColumn: function(columnIndex) { 32 if(this.grid.GetFixedColumnsHelper && this.grid.GetFixedColumnsHelper()) 33 this.grid.GetFixedColumnsHelper().TryShowColumn(columnIndex, true); 34 }, 35 GetGridItemByChild: function(element) { 36 var regEx = this.GetGridItemVisibleIndexRegExp(); 37 return ASPx.GetParent(element, function(item) { 38 var matches = regEx.exec(item.id); 39 return matches && matches.length == 3; 40 }.aspxBind(this)); 41 }, 42 GetGridItemVisibleIndexRegExp: function() { 43 return this.grid.GetItemVisibleIndexRegExp(); 44 }, 45 IsDataItem: function(item) { 46 if(!item || !item.id) return false; 47 var prefixes = this.GetDataItemIDPrefixes(); 48 for(var i = 0; i < prefixes.length; i++) { 49 if(item.id.indexOf(prefixes[i]) > -1) 50 return true; 51 } 52 return false; 53 }, 54 GetDataItemIDPrefixes: function() { return null; }, 55 IsRecordFocused: function(key) { return this.grid.GetFocusedRowIndex() === this.ConvertKeyToVisibleIndex(key); }, 56 IsRecordSelected: function(key) { return this.grid.IsRowSelectedOnPage(this.ConvertKeyToVisibleIndex(key)); }, 57 GetRowIdentificator: function(key) { return this.ConvertKeyToVisibleIndex(key); } 58}); 59var GridViewCellFocusHelper = ASPx.CreateClass(GridCellFocusHelper, { 60 constructor: function(grid) { 61 this.constructor.prototype.constructor.call(this, grid); 62 this.nextPageLoading = false; 63 }, 64 Update: function() { 65 GridCellFocusHelper.prototype.Update.call(this); 66 this.SetNextPageLoading(false); 67 }, 68 GetAdaptivityHelper: function() { return this.grid.GetAdaptivityHelper(); }, 69 GetDataItemIDPrefixes: function() { return [ASPx.GridViewConsts.DataRowID, ASPx.GridViewConsts.AdaptiveDetailRowID]; }, 70 GetDataItem: function(recordKey) { 71 var visibleIndex = this.ConvertKeyToVisibleIndex(recordKey); 72 if(this.grid.HasBandedDataRows()) 73 return this.grid.GetBandedDataRows(visibleIndex); 74 return GridCellFocusHelper.prototype.GetDataItem.call(this, visibleIndex); 75 }, 76 GetDataCellCore: function(recordKey, columnIndex) { 77 if(columnIndex < 0) return null; 78 var grid = this.grid; 79 var visibleIndex = this.ConvertKeyToVisibleIndex(recordKey); 80 var cell = grid.GetBatchDataCell(visibleIndex, columnIndex); 81 var helper = this.GetAdaptivityHelper(); 82 if(helper && helper.HasAnyAdaptiveElement() && (helper.IsAdaptivityMode() || grid.IsCellAdaptiveHidden(cell))) 83 return grid.GetAdaptiveCell(visibleIndex, columnIndex); 84 return cell; 85 }, 86 GetDataCellByChild: function(element) { 87 var helper = this.grid.GetLayoutHelper(); 88 return helper.GetDataCellByChild(element); 89 }, 90 GetGridItemByChild: function(element) { 91 var row = GridCellFocusHelper.prototype.GetGridItemByChild.call(this, element); 92 if(this.IsGroupRow(row)) { 93 while(row !== null && !this.IsDataItem(row))
94 row = row.nextSibling; 95 } 96 return row; 97 }, 98 GetColumnHelper: function() { return this.grid.GetColumnHelper(); }, 99 GetVisibleColumnIndices: function() { return this.GetColumnHelper().GetVisibleColumnIndices(); }, 100 IsGroupRow: function(row) { return !!row && row.id.indexOf( ASPx.GridViewConsts.GroupRowID) > -1;}, 101 IsKeyDownNavigationLocked: function(src) { 102 var id = this.grid.name + "_" + ASPx.GridViewConsts.DetailRowID; 103 return !!ASPx.GetParentByPartialId(src, id); 104 }, 105 ProcessDownPress: function(e) { 106 if(this.IsNextPageLoading()) 107 return; 108 if(this.RequireVirtScrollToNextPage()) 109 this.ScrollToNextPage(); 110 else 111 GridCellFocusHelper.prototype.ProcessDownPress.call(this, e); 112 }, 113 ProcessUpPress: function(e) { 114 if(this.IsNextPageLoading()) 115 return; 116 if(this.RequireVirtScrollToNextPage(true)) 117 this.ScrollToNextPage(true); 118 else 119 GridCellFocusHelper.prototype.ProcessUpPress.call(this, e); 120 }, 121 RequireVirtScrollToNextPage: function(isUpPressed) { 122 if(!this.GetFocusedCellInfo() || !this.grid.IsVirtualScrolling()) 123 return false; 124 var keys = this.grid.GetRecordKeys(); 125 var focusedItemIndex = keys.indexOf(this.GetFocusedCellInfo().recordKey); 126 if(isUpPressed) 127 return focusedItemIndex === 0; 128 return focusedItemIndex === keys.length - 1; 129 }, 130 ScrollToNextPage: function(prevPage) { 131 var helper = this.grid.GetScrollHelper(); 132 var cell = this.GetCurrentFocusedCell(); 133 if(helper && cell) { 134 var inc = cell.offsetHeight; 135 if(prevPage) inc = -inc; 136 helper.SetVertScrollPosition(helper.GetVertScrollPosition() + inc); 137 this.SetNextPageLoading(true); 138 } 139 }, 140 IsNextPageLoading: function() { return this.nextPageLoading; }, 141 SetNextPageLoading: function(value) { 142 this.nextPageLoading = value; 143 ASPx.Timer.ClearTimer(this.virtScrollLockTimerID); 144 if(value) { 145 this.virtScrollLockTimerID = window.setTimeout(function() { 146 if(!this.grid.InCallback() && this.IsNextPageLoading()) 147 this.SetNextPageLoading(false); 148 }.bind(this), 800); 149 } 150 }, 151 GetUnfocusableTopAreaRows: function() { 152 var layoutHelper = this.grid.GetLayoutHelper(); 153 var rows = [ ].concat( 154 layoutHelper.GetHeaderRows(), 155 layoutHelper.GetFilterRows() 156 ); 157 var mainTable = this.GetMainTable(); 158 return rows.filter(function(row) { return ASPx.GetIsParent(mainTable, row); }); 159 }, 160 GetUnfocusableBottomAreaRows: function() { 161 var layoutHelper = this.grid.GetLayoutHelper(); 162 var mainTable = this.GetMainTable(); 163 return layoutHelper.GetFooterRows().filter(function(row) { return ASPx.GetIsParent(mainTable, row); }); 164 }, 165}); 166var CardViewCellFocusHelper = ASPx.CreateClass(GridCellFocusHelper, { 167 constructor: function(grid) { 168 this.constructor.prototype.constructor.call(this, grid); 169 }, 170 GetDataCellCore: function(recordKey, columnIndex) { return this.grid.GetFormLayoutItemCell(this.ConvertKeyToVisibleIndex(recordKey), columnIndex); }, 171 GetDataCellByChild: function(element) { return this.grid.GetFormLayoutItemCellByChild(element); }, 172 GetVisibleColumnIndices: function() { return this.grid.GetVisibleColumnIndices(); }, 173 GetDataItemIDPrefixes: function() { return [this.grid.CardID]; } 174}); 175var VerticalGridCellFocusHelper = ASPx.CreateClass(GridCellFocusHelper, { 176 constructor: function(grid) { 177 this.constructor.prototype.constructor.call(this, grid); 178 }, 179 AttachEvents: function() { 180 this.AttachTableEvents(this.GetFixedTable()); 181 GridCellFocusHelper.prototype.AttachEvents.call(this); 182 }, 183 PrepareMainTable: function() { 184 GridCellFocusHelper.prototype.PrepareMainTable.call(this); 185 this.PrepareMainTableCore(this.GetFixedTable()); 186 }, 187 IsAnyOfFocusableTables: function(table) { return table === this.GetMainTable() || table === this.GetFixedTable(); }, 188 IsMainTableHasFocus: function() { return this.IsMainTableHasFocusCore(this.GetMainTable()) || this.IsMainTableHasFocusCore(this.GetFixedTable()); }, 189 GetFixedTable: function() { return this.grid.GetFixedTable(); }, 190 GetDataCellCore: function(recordKey, columnIndex) { return this.grid.GetRecordCell(this.ConvertKeyToVisibleIndex(recordKey), columnIndex); }, 191 GetDataCellByChild: function(element) { return this.grid.getRecordCellByChild(element); }, 192 GetRecordKeyByChild: function(element) { 193 var cell = this.GetDataCellByChild(element); 194 if(!cell) return; 195 var visibleIndex = this.grid.GetRecordCellVisibleIndex(cell); 196 return this.ConvertVisibleIndexToKey(visibleIndex); 197 }, 198 GetGridItemByChild: function(element) { return this.grid.getItemByChild(element); }, 199 GetVisibleColumnIndices: function() { return this.grid.GetVisibleColumnIndices(true); }, 200 CanFocusCellCore: function(cellInfo) { 201 return GridCellFocusHelper.prototype.CanFocusCellCore.call(this, cellInfo) || !this.grid.GetColumnStateExpandedHierarchically(cellInfo.columnIndex); 202 }, 203 MakeCellVisible: function(cell) { 204 GridCellFocusHelper.prototype.MakeCellVisible.call(this, cell); 205 var columnIndex = this.GetColumnIndexByCell(cell); 206 if(!this.grid.GetColumnStateExpandedHierarchically(columnIndex)) 207 this.grid.MakeRowVisible(columnIndex); 208 },
209 AddWrapperToDOM: function(wrapper, prev) { 210 var fixedTable = this.GetFixedTable(); 211 if(fixedTable && prev) 212 fixedTable.parentNode.insertBefore(wrapper, fixedTable); 213 else 214 GridCellFocusHelper.prototype.AddWrapperToDOM.call(this, wrapper, prev); 215 }, 216 GetMainTableColumnIndex: function(cellInfo) { return cellInfo && cellInfo.recordKey; } 217}); 218ASPx.GridViewCellFocusHelper = GridViewCellFocusHelper; 219ASPx.CardViewCellFocusHelper = CardViewCellFocusHelper; 220ASPx.VerticalGridCellFocusHelper = VerticalGridCellFocusHelper; 221})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.