@progress/kendo-react-grid 5.10.0-dev.202301031638 → 5.10.0-dev.202301051045

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/Grid.d.ts CHANGED
@@ -106,6 +106,7 @@ export declare class Grid extends React.Component<GridProps, {}> {
106
106
  protected dragLogic: CommonDragLogic;
107
107
  private _columns;
108
108
  private _columnsMap;
109
+ private _columnsMutations;
109
110
  private contextStateRef;
110
111
  private navigationStateRef;
111
112
  private _data;
@@ -221,7 +222,11 @@ export declare class Grid extends React.Component<GridProps, {}> {
221
222
  private columnToGroup;
222
223
  private resetTableWidth;
223
224
  private onResize;
225
+ private childrenToArray;
226
+ private readColumns;
227
+ private mapColumns;
224
228
  private initColumns;
229
+ private getHeaderRow;
225
230
  private resolveTitle;
226
231
  private getDataState;
227
232
  private getArguments;
package/dist/es/Grid.js CHANGED
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
35
35
  };
36
36
  import * as React from 'react';
37
37
  import * as PropTypes from 'prop-types';
38
- import { dispatchEvent, classNames, getter, guid, setScrollbarWidth, canUseDOM } from '@progress/kendo-react-common';
38
+ import { dispatchEvent, classNames, getter, guid, setScrollbarWidth, canUseDOM, memoizeOne } from '@progress/kendo-react-common';
39
39
  import { tableColumnsVirtualization, Pager, mapColumns, isRtl, tableKeyboardNavigation, TableKeyboardNavigationContext, tableKeyboardNavigationScopeAttributes, tableKeyboardNavigationTools as navigationTools, tableKeyboardNavigationBodyAttributes, getSelectionOptions, TableSelection, DropClue, DragClue } from '@progress/kendo-react-data-tools';
40
40
  import { GridSelectionCell } from './cells/GridSelectionCell';
41
41
  import { GridHierarchyCell } from './cells/GridHierarchyCell';
@@ -48,7 +48,7 @@ import { Footer } from './footer/Footer';
48
48
  import { VirtualScroll } from './VirtualScroll';
49
49
  import { ColumnResize } from './drag/ColumnResize';
50
50
  import { CommonDragLogic } from './drag/CommonDragLogic';
51
- import { getNestedValue, flatData, readColumns, autoGenerateColumns, sanitizeColumns } from './utils/index';
51
+ import { getNestedValue, flatData, readColumns, autoGenerateColumns, firefox, firefoxMaxHeight, sanitizeColumns } from './utils/index';
52
52
  import { GridCell } from './cells/GridCell';
53
53
  import { GridGroupCell } from './cells/GridGroupCell';
54
54
  import { GridRow } from './rows/GridRow';
@@ -99,6 +99,7 @@ var Grid = /** @class */ (function (_super) {
99
99
  var _this = _super.call(this, props) || this;
100
100
  _this._columns = [];
101
101
  _this._columnsMap = [[]];
102
+ _this._columnsMutations = 0;
102
103
  _this.contextStateRef = { current: undefined };
103
104
  _this.navigationStateRef = { current: undefined };
104
105
  _this._data = [];
@@ -158,7 +159,7 @@ var Grid = /** @class */ (function (_super) {
158
159
  if (_this._footer) {
159
160
  _this._footer.setScrollLeft(scrollLeft);
160
161
  }
161
- if (_this.vs) {
162
+ if (_this.vs && scrollTop !== _this.wrapperScrollTop) {
162
163
  _this.vs.scrollHandler(event);
163
164
  }
164
165
  dispatchEvent(_this.props.onScroll, event, _this, undefined);
@@ -247,6 +248,7 @@ var Grid = /** @class */ (function (_super) {
247
248
  };
248
249
  _this.onResize = function (index, newWidth, oldWidth, nativeEvent, end, targetId) {
249
250
  _this.resetTableWidth();
251
+ _this._columnsMutations++;
250
252
  if (_this.props.onColumnResize) {
251
253
  _this.props.onColumnResize.call(undefined, {
252
254
  columns: _this.columns,
@@ -260,6 +262,19 @@ var Grid = /** @class */ (function (_super) {
260
262
  });
261
263
  }
262
264
  };
265
+ _this.childrenToArray = memoizeOne(function (children) {
266
+ return React.Children.toArray(children);
267
+ });
268
+ _this.readColumns = memoizeOne(function (children, idPrefix, _mutationsCount) {
269
+ var columnElements = children.filter(function (child) { return child && child.type && child.type.displayName === 'KendoReactGridColumn'; });
270
+ return readColumns(columnElements, _this.columns, { prevId: 0, idPrefix: idPrefix });
271
+ });
272
+ _this.mapColumns = memoizeOne(function (columns) {
273
+ return mapColumns(columns);
274
+ });
275
+ _this.getHeaderRow = memoizeOne(function (sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, columns, columnsMap) {
276
+ return (React.createElement(HeaderRow, { sort: sort, sortable: sortable, sortChange: _this.sortChange, group: group || [], groupable: groupable, groupChange: _this.groupChange, filter: filter, filterable: filterable, filterOperators: filterOperators, filterChange: _this.filterChange, columnMenu: columnMenu, selectionChange: _this.onHeaderSelectionChange, columns: columns, columnResize: _this.columnResize, pressHandler: _this.dragLogic.pressHandler, dragHandler: _this.dragLogic.dragHandler, releaseHandler: _this.dragLogic.releaseHandler, columnsMap: columnsMap, cellRender: headerCellRender, isRtl: _this.isRtl, dragClue: _this.dragLogic.dragClueRef, headerRef: _this.headerElementRef, containerRef: _this.vs.containerRef }));
277
+ });
263
278
  _this.resolveTitle = function (field) {
264
279
  var column = _this._columns.find(function (c) { return c.field === field; });
265
280
  var title = column && (column.title || column.field);
@@ -424,7 +439,7 @@ var Grid = /** @class */ (function (_super) {
424
439
  this.dragLogic.reorderable = this.props.reorderable || false;
425
440
  this.dragLogic.groupable = groupable;
426
441
  var tableUserSelect = this.props.selectable && this.props.selectable.drag ? 'none' : undefined;
427
- if (total !== this.vs.total) {
442
+ if (total !== this.vs.total || (this.props.scrollable === 'virtual') !== this.vs.scrollableVirtual) {
428
443
  this.vs.reset();
429
444
  this.vs = new VirtualScroll(groupable || this.props.rowHeight === undefined || this.props.rowHeight === 0);
430
445
  this.vs.table = this.tableElement;
@@ -438,7 +453,8 @@ var Grid = /** @class */ (function (_super) {
438
453
  this.vs.propsSkip = (this.props.skip || 0) + (this.props.scrollable === 'virtual' ?
439
454
  this.vs.topCacheCount + (this.vs.attendedSkip - (this.props.skip || 0)) : 0);
440
455
  if (this.props.rowHeight !== undefined && this.props.rowHeight > 0 && !groupable) {
441
- this.vs.containerHeight = Math.min(1533915, this.props.rowHeight * (total || 0));
456
+ var containerHeight = this.props.rowHeight * total;
457
+ this.vs.containerHeight = firefox ? Math.min(firefoxMaxHeight, containerHeight) : containerHeight;
442
458
  }
443
459
  else {
444
460
  this.vs.containerHeight = 1533915;
@@ -446,25 +462,25 @@ var Grid = /** @class */ (function (_super) {
446
462
  var groupingFooter = (typeof this.props.groupable === 'object') && this.props.groupable.footer || 'none';
447
463
  this._data = [];
448
464
  var resolvedGroupsCount = flatData(this._data, propsData, groupingFooter, { index: this.props.skip || 0 }, this.props.group !== undefined, this.props.expandField);
449
- var children = React.Children.toArray(this.props.children);
450
- this.initColumns(children.filter(function (child) { return child && child.type &&
451
- child.type.displayName === 'KendoReactGridColumn'; }), resolvedGroupsCount);
465
+ var children = this.childrenToArray(this.props.children);
466
+ this.initColumns(children, resolvedGroupsCount);
452
467
  var toolbar = children.filter(function (child) { return child && child.type &&
453
468
  child.type.displayName === 'KendoReactGridToolbar'; });
454
469
  var noRecords = children.filter(function (child) { return child && child.type &&
455
470
  child.type.displayName === 'KendoReactGridNoRecords'; });
456
471
  var leafColumns = this._columns.filter(function (c) { return c.children.length === 0; });
457
472
  var groupingPanel = groupable && (React.createElement(GroupPanel, { group: this.props.group || [], groupChange: this.groupChange, pressHandler: this.dragLogic.pressHandler, dragHandler: this.dragLogic.dragHandler, releaseHandler: this.dragLogic.releaseHandler, refCallback: this.dragLogic.refGroupPanelDiv, resolveTitle: this.resolveTitle }));
458
- var header = (React.createElement(Header, { columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', scrollableDataElement: function () { return _this.vs.container; }, draggable: this.props.reorderable || groupable, ref: this.headerRef, elemRef: this.headerElementRef, headerRow: React.createElement(HeaderRow, { sort: this.props.sort, sortable: this.props.sortable, sortChange: this.sortChange, group: this.props.group || [], groupable: groupable, groupChange: this.groupChange, filter: this.props.filter, filterable: this.props.filterable, filterOperators: this.props.filterOperators || operators, filterChange: this.filterChange, columnMenu: this.props.columnMenu, selectionChange: this.onHeaderSelectionChange, columns: this._columns, columnResize: this.columnResize, pressHandler: this.dragLogic.pressHandler, dragHandler: this.dragLogic.dragHandler, releaseHandler: this.dragLogic.releaseHandler, columnsMap: this._columnsMap, cellRender: this.props.headerCellRender, isRtl: this.isRtl, dragClue: this.dragLogic.dragClueRef, headerRef: this.headerElementRef, containerRef: this.vs.containerRef }), filterRow: this.props.filterable && React.createElement(FilterRow, { columns: this._columns, filter: this.props.filter, filterOperators: this.props.filterOperators || operators, filterChange: this.filterChange, sort: this.props.sort, cellRender: this.props.filterCellRender, isRtl: this.isRtl, ariaRowIndex: this._columnsMap.length + 1 }) || undefined, cols: leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), width: column.width !== undefined ?
473
+ var _a = this.props, sort = _a.sort, sortable = _a.sortable, group = _a.group, filter = _a.filter, filterable = _a.filterable, _b = _a.filterOperators, filterOperators = _b === void 0 ? operators : _b, headerCellRender = _a.headerCellRender, columnMenu = _a.columnMenu;
474
+ var header = (React.createElement(Header, { columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', scrollableDataElement: function () { return _this.vs.container; }, draggable: this.props.reorderable || groupable, ref: this.headerRef, elemRef: this.headerElementRef, headerRow: this.getHeaderRow(sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, this._columns, this._columnsMap), filterRow: this.props.filterable && React.createElement(FilterRow, { columns: this._columns, filter: this.props.filter, filterOperators: this.props.filterOperators || operators, filterChange: this.filterChange, sort: this.props.sort, cellRender: this.props.filterCellRender, isRtl: this.isRtl, ariaRowIndex: this._columnsMap.length + 1 }) || undefined, cols: leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), width: column.width !== undefined ?
459
475
  Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); }) }));
460
476
  var scrollLeft = this.vs && this.vs.container && this.vs.container.scrollLeft || 0;
461
477
  var tableWidth = parseFloat(((this.props.style || {}).width || '').toString());
462
- var _a = tableColumnsVirtualization({
478
+ var _c = tableColumnsVirtualization({
463
479
  enabled: this.props.columnVirtualization,
464
480
  columns: leafColumns,
465
481
  tableViewPortWidth: tableWidth,
466
482
  scrollLeft: scrollLeft
467
- }), colSpans = _a.colSpans, isColHidden = _a.hiddenColumns;
483
+ }), colSpans = _c.colSpans, isColHidden = _c.hiddenColumns;
468
484
  var dataRow = function (item, rowId, rowDataIndex) {
469
485
  var isInEdit = false;
470
486
  var selectedValue = _this.props.selectedField ? getNestedValue(_this.props.selectedField, item.dataItem) : undefined;
@@ -481,29 +497,6 @@ var Grid = /** @class */ (function (_super) {
481
497
  ? { left: column.left, right: column.right }
482
498
  : { left: column.right, right: column.left }
483
499
  : {};
484
- var cellProps = {
485
- id: navigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix),
486
- colSpan: colSpans[columnIndex],
487
- dataItem: item.dataItem,
488
- field: column.field,
489
- editor: column.editor,
490
- format: column.format,
491
- className: className,
492
- render: _this.props.cellRender,
493
- onChange: _this.itemChange,
494
- selectionChange: (_this.props.onSelectionChange) ?
495
- (function (e) { _this.selectionChange({ event: e, dataItem: item.dataItem, dataIndex: rowDataIndex, columnIndex: columnIndex }); }) :
496
- undefined,
497
- columnIndex: columnIndex,
498
- columnsCount: leafColumns.length,
499
- rowType: item.rowType,
500
- level: item.level,
501
- expanded: item.expanded,
502
- dataIndex: item.dataIndex,
503
- style: style,
504
- ariaColumnIndex: column.ariaColumnIndex,
505
- isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(columnIndex) > -1
506
- };
507
500
  var currentColumnIsInEdit = false;
508
501
  if (column.editable && _this.props.editField) {
509
502
  var inEdit = getNestedValue(_this.props.editField, item.dataItem);
@@ -512,12 +505,10 @@ var Grid = /** @class */ (function (_super) {
512
505
  currentColumnIsInEdit = true;
513
506
  }
514
507
  }
515
- if (column.cell) {
516
- return React.createElement(column.cell, __assign({ key: columnKey }, cellProps, { locked: _this.props.lockGroups }));
517
- }
518
- return currentColumnIsInEdit
519
- ? React.createElement(GridEditCell, __assign({ key: columnKey }, cellProps))
520
- : React.createElement(GridCell, __assign({ key: columnKey }, cellProps));
508
+ var Cell = column.cell || (currentColumnIsInEdit && GridEditCell) || GridCell;
509
+ return (React.createElement(Cell, { key: columnKey, locked: _this.props.lockGroups, id: navigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix), colSpan: colSpans[columnIndex], dataItem: item.dataItem, field: column.field, editor: column.editor, format: column.format, className: className, render: _this.props.cellRender, onChange: _this.itemChange, selectionChange: (_this.props.onSelectionChange) ?
510
+ (function (e) { _this.selectionChange({ event: e, dataItem: item.dataItem, dataIndex: rowDataIndex, columnIndex: columnIndex }); }) :
511
+ undefined, columnIndex: columnIndex, columnsCount: leafColumns.length, rowType: item.rowType, level: item.level, expanded: item.expanded, dataIndex: item.dataIndex, style: style, ariaColumnIndex: column.ariaColumnIndex, isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(columnIndex) > -1 }));
521
512
  }),
522
513
  isInEdit: isInEdit,
523
514
  isSelected: typeof selectedValue === 'boolean' && selectedValue
@@ -569,8 +560,8 @@ var Grid = /** @class */ (function (_super) {
569
560
  detailRowCount_1++;
570
561
  currentAriaRowIndex = absoluteIndex + rowIndexStart + detailRowCount_1;
571
562
  body.push((React.createElement("tr", { key: detailRowId, className: isAlt ? 'k-detail-row k-alt' : 'k-detail-row', style: { visibility: hidden(rowIndex) ? 'hidden' : '' }, role: "row", "aria-rowindex": currentAriaRowIndex },
572
- _this.props.group && _this.props.group.map(function (group, idx) {
573
- return (React.createElement(GridGroupCell, { id: '', dataIndex: item.dataIndex, field: group.field, dataItem: item.dataItem, key: idx, style: {}, ariaColumnIndex: 1 + idx, isSelected: false, locked: _this.props.lockGroups }));
563
+ _this.props.group && _this.props.group.map(function (gr, idx) {
564
+ return (React.createElement(GridGroupCell, { id: '', dataIndex: item.dataIndex, field: gr.field, dataItem: item.dataItem, key: idx, style: {}, ariaColumnIndex: 1 + idx, isSelected: false, locked: _this.props.lockGroups }));
574
565
  }),
575
566
  _this.props.expandField &&
576
567
  React.createElement(GridDetailHierarchyCell, { id: navigationTools.generateNavigatableId("".concat(detailRowId, "-dhcell"), idPrefix) }),
@@ -634,7 +625,7 @@ var Grid = /** @class */ (function (_super) {
634
625
  header,
635
626
  React.createElement("div", { className: "k-grid-container", role: "presentation" },
636
627
  React.createElement("div", { ref: this.vs.containerRef, className: "k-grid-content k-virtual-content", onScroll: this.scrollHandler, role: "presentation" },
637
- React.createElement("div", { style: { 'position': 'relative' }, role: "presentation" },
628
+ React.createElement("div", { className: 'k-grid-table-wrap', role: "presentation" },
638
629
  React.createElement(TableSelection, { selectable: this.props.selectable, onRelease: this.selectionRelease, childRef: function (table) {
639
630
  _this.vs.table = table;
640
631
  _this.tableElement = table;
@@ -684,6 +675,7 @@ var Grid = /** @class */ (function (_super) {
684
675
  var spliced = this._columns.splice(prev, end(prev) - prev);
685
676
  (_a = this._columns).splice.apply(_a, __spreadArray([prev < next ? end(next - spliced.length) : next, 0], spliced, false));
686
677
  this._columns.filter(function (q) { return q.declarationIndex >= 0; }).forEach(function (c, i) { return c.orderIndex = i; });
678
+ this._columnsMutations++;
687
679
  var eventColumnProps = this.columns;
688
680
  this.forceUpdate();
689
681
  if (this.props.onColumnReorder) {
@@ -735,10 +727,10 @@ var Grid = /** @class */ (function (_super) {
735
727
  this.vs.table.style.width = totalWidth + 'px';
736
728
  }
737
729
  };
738
- Grid.prototype.initColumns = function (columnElements, groupCount) {
730
+ Grid.prototype.initColumns = function (children, groupCount) {
739
731
  var _this = this;
740
732
  var idPrefix = navigationTools.getIdPrefix(this.navigationStateRef);
741
- this._columns = readColumns(columnElements, this.columns, { prevId: 0, idPrefix: idPrefix });
733
+ this._columns = this.readColumns(children, idPrefix, this._columnsMutations);
742
734
  if (this._columns.length === 0) {
743
735
  this._columns = autoGenerateColumns(this.props.data, this.props.group, this.props.expandField, { prevId: 0, idPrefix: idPrefix });
744
736
  }
@@ -778,7 +770,7 @@ var Grid = /** @class */ (function (_super) {
778
770
  columnIndexOffset++;
779
771
  }
780
772
  this._columns.slice(columnIndexOffset).forEach(function (c) { return c.parentIndex >= 0 && (c.parentIndex += columnIndexOffset); });
781
- this._columnsMap = mapColumns(this._columns);
773
+ this._columnsMap = this.mapColumns(this._columns);
782
774
  this.columnResize.columns = this._columns;
783
775
  this.dragLogic.columns = this._columns;
784
776
  };
@@ -21,7 +21,6 @@ export declare class VirtualScroll {
21
21
  containerRef: React.RefObject<HTMLDivElement>;
22
22
  get container(): HTMLDivElement | null;
23
23
  private prevScrollPos;
24
- private syncTimeout;
25
24
  private tableTranslate;
26
25
  private scrollSyncing;
27
26
  constructor(cached: boolean);
@@ -34,10 +33,11 @@ export declare class VirtualScroll {
34
33
  }>;
35
34
  changePage(skip: number, e: React.SyntheticEvent<HTMLDivElement>): void;
36
35
  translate(dY: number): void;
37
- syncScroll(): void;
38
36
  reset(): void;
39
37
  localScrollUp(e: React.SyntheticEvent<HTMLDivElement>): void;
40
38
  localScrollDown(e: React.SyntheticEvent<HTMLDivElement>): void;
41
39
  scrollNonStrict(e: React.SyntheticEvent<HTMLDivElement>): void;
42
40
  scrollHandler(e: React.SyntheticEvent<HTMLDivElement>): void;
41
+ private topItems;
42
+ private horizontalScrollbarHeight;
43
43
  }
@@ -4,6 +4,7 @@ import * as React from 'react';
4
4
  */
5
5
  var VirtualScroll = /** @class */ (function () {
6
6
  function VirtualScroll(cached) {
7
+ var _this = this;
7
8
  this.table = null;
8
9
  this.containerHeight = 0;
9
10
  this.topCacheCount = 0; // 4;
@@ -22,6 +23,25 @@ var VirtualScroll = /** @class */ (function () {
22
23
  this.prevScrollPos = 0;
23
24
  this.tableTranslate = 0;
24
25
  this.scrollSyncing = false;
26
+ this.topItems = function (heights, skipTopBuffer) {
27
+ if (!_this.container || skipTopBuffer) {
28
+ return { topItemsCount: 0, topItemsHeight: 0 };
29
+ }
30
+ var screenHeight = _this.container.clientHeight;
31
+ var itemsOnScreen = Math.ceil(screenHeight / heights[0].line);
32
+ var topItemsCount = Math.ceil((heights.length - itemsOnScreen) / 2);
33
+ var topItemsHeight = 0;
34
+ for (var i = 0; i < topItemsCount; i++) {
35
+ topItemsHeight += heights[i].line + heights[i].acc;
36
+ }
37
+ return { topItemsCount: topItemsCount, topItemsHeight: topItemsHeight };
38
+ };
39
+ this.horizontalScrollbarHeight = function () {
40
+ if (!_this.container) {
41
+ return 0;
42
+ }
43
+ return _this.container.offsetHeight - _this.container.clientHeight;
44
+ };
25
45
  if (cached) {
26
46
  this.topCacheCount = 4;
27
47
  this.attendedSkip = -this.topCacheCount;
@@ -79,22 +99,6 @@ var VirtualScroll = /** @class */ (function () {
79
99
  this.table.style.transform = 'translateY(' + dY + 'px)';
80
100
  }
81
101
  };
82
- VirtualScroll.prototype.syncScroll = function () {
83
- if (!this.scrollableVirtual || !this.container) {
84
- return;
85
- }
86
- this.syncTimeout = null;
87
- var scrollTop = this.container.scrollTop;
88
- var containerHeight = this.containerHeight; // = this.container.scrollHeight;
89
- var rowHeights = this.rowHeights;
90
- var percentage = (scrollTop - this.tableTranslate) / rowHeights[0].line;
91
- var targetFloorScrollPosition = Math.floor((containerHeight) * (this.propsSkip + percentage) / this.total);
92
- if (this.container.scrollTop !== (this.prevScrollPos = targetFloorScrollPosition)) {
93
- this.scrollSyncing = true;
94
- this.container.scrollTop = (this.prevScrollPos = targetFloorScrollPosition);
95
- }
96
- this.translate(this.tableTranslate + targetFloorScrollPosition - scrollTop);
97
- };
98
102
  VirtualScroll.prototype.reset = function () {
99
103
  this.scrollSyncing = true;
100
104
  if (this.fixedScroll) {
@@ -113,11 +117,12 @@ var VirtualScroll = /** @class */ (function () {
113
117
  var scrollTop = this.container.scrollTop;
114
118
  var targetTranslate = this.tableTranslate;
115
119
  var rowsCount = 0;
120
+ var _a = this.topItems(heights, Boolean(this.topCacheCount)), topItemsCount = _a.topItemsCount, topItemsHeight = _a.topItemsHeight;
116
121
  var additionalOnTop = scrollTop - targetTranslate;
117
- if (additionalOnTop > 0) {
122
+ if (additionalOnTop > topItemsHeight) {
118
123
  return;
119
124
  }
120
- while ((rowsCount < this.topCacheCount + this.attendedSkip - this.realSkip)
125
+ while ((rowsCount < this.topCacheCount + this.attendedSkip - this.realSkip + topItemsCount)
121
126
  && this.propsSkip - rowsCount > 0 &&
122
127
  !(targetTranslate + (heights[heights.length - 1 - rowsCount].line + heights[heights.length - 1 - rowsCount].acc) + additionalOnTop <= scrollTop)) {
123
128
  targetTranslate -= heights[heights.length - 1 - rowsCount].line +
@@ -143,8 +148,9 @@ var VirtualScroll = /** @class */ (function () {
143
148
  // floor the translate to beginning of the item in absolute value
144
149
  }
145
150
  if (targetTranslate !== this.tableTranslate) {
146
- this.translate(targetTranslate);
147
- this.changePage(this.propsSkip - rowsCount, e);
151
+ this.translate(Math.max(0, targetTranslate - topItemsHeight));
152
+ var nextSkip = Math.max(0, this.propsSkip - rowsCount - topItemsCount);
153
+ this.changePage(nextSkip, e);
148
154
  }
149
155
  };
150
156
  VirtualScroll.prototype.localScrollDown = function (e) {
@@ -155,18 +161,22 @@ var VirtualScroll = /** @class */ (function () {
155
161
  var scrollTop = this.container.scrollTop;
156
162
  var targetTranslate = this.tableTranslate;
157
163
  var rowsCount = 0;
164
+ var _a = this.topItems(heights, Boolean(this.topCacheCount)), topItemsCount = _a.topItemsCount, topItemsHeight = _a.topItemsHeight;
158
165
  while (rowsCount < heights.length - this.topCacheCount &&
159
166
  !(targetTranslate + heights[rowsCount].line + heights[rowsCount].acc > scrollTop)) {
160
167
  targetTranslate += heights[rowsCount].line + heights[rowsCount].acc;
161
168
  rowsCount++;
162
169
  }
170
+ if (topItemsCount > this.propsSkip + rowsCount) {
171
+ return;
172
+ }
163
173
  if (rowsCount >= heights.length - this.topCacheCount && this.propsSkip + rowsCount >= this.total) {
164
- this.translate(targetTranslate);
165
- this.changePage(this.total - 1, e);
174
+ this.translate(targetTranslate - topItemsHeight);
175
+ this.changePage(this.total - 1 - topItemsCount, e);
166
176
  }
167
- else if (targetTranslate !== this.tableTranslate) {
168
- this.translate(targetTranslate);
169
- this.changePage(this.propsSkip + rowsCount, e);
177
+ else if (targetTranslate !== this.tableTranslate && this.propsSkip + rowsCount - topItemsCount !== this.propsSkip) {
178
+ this.translate(targetTranslate - topItemsHeight);
179
+ this.changePage(this.propsSkip + rowsCount - topItemsCount, e);
170
180
  }
171
181
  };
172
182
  VirtualScroll.prototype.scrollNonStrict = function (e) {
@@ -185,8 +195,9 @@ var VirtualScroll = /** @class */ (function () {
185
195
  else if (rowIndexOffset === -1) {
186
196
  microAdjust = -((heights[heights.length - 1].line + heights[heights.length - 1].acc) * rowpercentage);
187
197
  }
188
- this.translate(microAdjust + this.containerHeight * floatRowIndex / this.total);
189
- this.changePage(rowIndex, e);
198
+ var _a = this.topItems(heights, Boolean(this.topCacheCount)), topItemsCount = _a.topItemsCount, topItemsHeight = _a.topItemsHeight;
199
+ this.translate(Math.max(0, microAdjust - topItemsHeight - this.horizontalScrollbarHeight() + this.containerHeight * floatRowIndex / this.total));
200
+ this.changePage(rowIndex - topItemsCount, e);
190
201
  };
191
202
  VirtualScroll.prototype.scrollHandler = function (e) {
192
203
  if (!this.scrollableVirtual) {
@@ -196,9 +207,6 @@ var VirtualScroll = /** @class */ (function () {
196
207
  this.scrollSyncing = false;
197
208
  return;
198
209
  }
199
- var grid = this;
200
- clearTimeout(this.syncTimeout);
201
- this.syncTimeout = window.setTimeout(function () { grid.syncScroll(); }, 200);
202
210
  var scrollTop = this.container.scrollTop;
203
211
  var prev = this.prevScrollPos;
204
212
  this.prevScrollPos = scrollTop;
@@ -93,36 +93,27 @@ var HeaderRow = /** @class */ (function (_super) {
93
93
  } : {
94
94
  'role': 'presentation'
95
95
  };
96
- var columnMenuWrapperProps = {
97
- column: {
98
- field: column.field,
99
- filter: column.filter
100
- },
101
- sortable: sortable && _this.props.sortable,
102
- sort: _this.props.sort,
103
- onSortChange: _this.props.sortChange,
104
- filter: _this.props.filter,
105
- filterable: _this.props.filterable && column.filterable,
106
- filterOperators: _this.props.filterOperators,
107
- onFilterChange: _this.props.filterChange,
108
- group: _this.props.group,
109
- groupable: _this.props.groupable,
110
- onGroupChange: _this.props.groupChange,
111
- columnMenu: columnMenu
112
- };
113
- var headerCellProps = {
114
- field: column.field,
115
- onClick: sortable && (function (e) { return _this.cellClick(e, column); }) || undefined,
116
- selectionChange: _this.props.selectionChange,
117
- title: column.title,
118
- selectionValue: column.headerSelectionValue,
119
- render: _this.props.cellRender,
120
- children: _this.sortIcon(sortIndex),
121
- columnMenuWrapperProps: columnMenuWrapperProps
122
- };
123
96
  var key = (column.declarationIndex >= 0) ? ++_this.index : --_this.serviceIndex;
97
+ var HeaderCell = column.headerCell ? column.headerCell : GridHeaderCell;
98
+ var headerCell = (React.createElement(HeaderCell, { field: column.field, onClick: sortable && (function (e) { return _this.cellClick(e, column); }) || undefined, selectionChange: _this.props.selectionChange, title: column.title, selectionValue: column.headerSelectionValue, render: _this.props.cellRender, children: _this.sortIcon(sortIndex), columnMenuWrapperProps: {
99
+ column: {
100
+ field: column.field,
101
+ filter: column.filter
102
+ },
103
+ sortable: sortable && _this.props.sortable,
104
+ sort: _this.props.sort,
105
+ onSortChange: _this.props.sortChange,
106
+ filter: _this.props.filter,
107
+ filterable: _this.props.filterable && column.filterable,
108
+ filterOperators: _this.props.filterOperators,
109
+ onFilterChange: _this.props.filterChange,
110
+ group: _this.props.group,
111
+ groupable: _this.props.groupable,
112
+ onGroupChange: _this.props.groupChange,
113
+ columnMenu: columnMenu
114
+ } }));
124
115
  return (React.createElement(HeaderThElement, __assign({}, ariaAttrs, { key: key, colSpan: column.colSpan, rowSpan: column.rowSpan, className: className, style: style, columnId: column.id, navigatable: column.navigatable, onKeyDown: sortable && (function (e) { return _this.cellKeyDown(e, column); }) || undefined, role: "columnheader" }),
125
- column.headerCell ? React.createElement(column.headerCell, __assign({}, headerCellProps)) : React.createElement(GridHeaderCell, __assign({}, headerCellProps)),
116
+ headerCell,
126
117
  _this.props.columnResize && _this.props.columnResize.resizable && column.resizable &&
127
118
  React.createElement(ColumnResizer, { key: 2, resize: function (e, element, end) {
128
119
  return _this.props.columnResize &&
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-grid',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1672762751,
8
+ publishDate: 1672914787,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -50,3 +50,11 @@ export declare const footerColumns: (columns: ExtendedColumnProps[]) => Extended
50
50
  * @hidden
51
51
  */
52
52
  export declare const sanitizeColumns: (columns: ExtendedColumnProps[]) => GridColumnProps[];
53
+ /**
54
+ * @hidden
55
+ */
56
+ export declare const firefox: boolean;
57
+ /**
58
+ * @hidden
59
+ */
60
+ export declare const firefoxMaxHeight = 17895697;
@@ -227,3 +227,12 @@ export var sanitizeColumns = function (columns) {
227
227
  return children.length ? __assign({ children: sanitizeColumns(children) }, props) : props;
228
228
  });
229
229
  };
230
+ /**
231
+ * @hidden
232
+ */
233
+ export var firefox = typeof window !== 'undefined' &&
234
+ /Firefox/.test(window.navigator.userAgent);
235
+ /**
236
+ * @hidden
237
+ */
238
+ export var firefoxMaxHeight = 17895697;
@@ -106,6 +106,7 @@ export declare class Grid extends React.Component<GridProps, {}> {
106
106
  protected dragLogic: CommonDragLogic;
107
107
  private _columns;
108
108
  private _columnsMap;
109
+ private _columnsMutations;
109
110
  private contextStateRef;
110
111
  private navigationStateRef;
111
112
  private _data;
@@ -221,7 +222,11 @@ export declare class Grid extends React.Component<GridProps, {}> {
221
222
  private columnToGroup;
222
223
  private resetTableWidth;
223
224
  private onResize;
225
+ private childrenToArray;
226
+ private readColumns;
227
+ private mapColumns;
224
228
  private initColumns;
229
+ private getHeaderRow;
225
230
  private resolveTitle;
226
231
  private getDataState;
227
232
  private getArguments;