@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/cdn/js/kendo-react-grid.js +1 -1
- package/dist/es/Grid.d.ts +5 -0
- package/dist/es/Grid.js +38 -46
- package/dist/es/VirtualScroll.d.ts +2 -2
- package/dist/es/VirtualScroll.js +38 -30
- package/dist/es/header/HeaderRow.js +19 -28
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/index.d.ts +8 -0
- package/dist/es/utils/index.js +9 -0
- package/dist/npm/Grid.d.ts +5 -0
- package/dist/npm/Grid.js +36 -44
- package/dist/npm/VirtualScroll.d.ts +2 -2
- package/dist/npm/VirtualScroll.js +38 -30
- package/dist/npm/header/HeaderRow.js +19 -28
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/index.d.ts +8 -0
- package/dist/npm/utils/index.js +10 -1
- package/dist/systemjs/kendo-react-grid.js +1 -1
- package/package.json +18 -18
package/dist/npm/Grid.js
CHANGED
|
@@ -102,6 +102,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
102
102
|
var _this = _super.call(this, props) || this;
|
|
103
103
|
_this._columns = [];
|
|
104
104
|
_this._columnsMap = [[]];
|
|
105
|
+
_this._columnsMutations = 0;
|
|
105
106
|
_this.contextStateRef = { current: undefined };
|
|
106
107
|
_this.navigationStateRef = { current: undefined };
|
|
107
108
|
_this._data = [];
|
|
@@ -161,7 +162,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
161
162
|
if (_this._footer) {
|
|
162
163
|
_this._footer.setScrollLeft(scrollLeft);
|
|
163
164
|
}
|
|
164
|
-
if (_this.vs) {
|
|
165
|
+
if (_this.vs && scrollTop !== _this.wrapperScrollTop) {
|
|
165
166
|
_this.vs.scrollHandler(event);
|
|
166
167
|
}
|
|
167
168
|
(0, kendo_react_common_1.dispatchEvent)(_this.props.onScroll, event, _this, undefined);
|
|
@@ -250,6 +251,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
250
251
|
};
|
|
251
252
|
_this.onResize = function (index, newWidth, oldWidth, nativeEvent, end, targetId) {
|
|
252
253
|
_this.resetTableWidth();
|
|
254
|
+
_this._columnsMutations++;
|
|
253
255
|
if (_this.props.onColumnResize) {
|
|
254
256
|
_this.props.onColumnResize.call(undefined, {
|
|
255
257
|
columns: _this.columns,
|
|
@@ -263,6 +265,19 @@ var Grid = /** @class */ (function (_super) {
|
|
|
263
265
|
});
|
|
264
266
|
}
|
|
265
267
|
};
|
|
268
|
+
_this.childrenToArray = (0, kendo_react_common_1.memoizeOne)(function (children) {
|
|
269
|
+
return React.Children.toArray(children);
|
|
270
|
+
});
|
|
271
|
+
_this.readColumns = (0, kendo_react_common_1.memoizeOne)(function (children, idPrefix, _mutationsCount) {
|
|
272
|
+
var columnElements = children.filter(function (child) { return child && child.type && child.type.displayName === 'KendoReactGridColumn'; });
|
|
273
|
+
return (0, index_1.readColumns)(columnElements, _this.columns, { prevId: 0, idPrefix: idPrefix });
|
|
274
|
+
});
|
|
275
|
+
_this.mapColumns = (0, kendo_react_common_1.memoizeOne)(function (columns) {
|
|
276
|
+
return (0, kendo_react_data_tools_1.mapColumns)(columns);
|
|
277
|
+
});
|
|
278
|
+
_this.getHeaderRow = (0, kendo_react_common_1.memoizeOne)(function (sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, columns, columnsMap) {
|
|
279
|
+
return (React.createElement(HeaderRow_1.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 }));
|
|
280
|
+
});
|
|
266
281
|
_this.resolveTitle = function (field) {
|
|
267
282
|
var column = _this._columns.find(function (c) { return c.field === field; });
|
|
268
283
|
var title = column && (column.title || column.field);
|
|
@@ -427,7 +442,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
427
442
|
this.dragLogic.reorderable = this.props.reorderable || false;
|
|
428
443
|
this.dragLogic.groupable = groupable;
|
|
429
444
|
var tableUserSelect = this.props.selectable && this.props.selectable.drag ? 'none' : undefined;
|
|
430
|
-
if (total !== this.vs.total) {
|
|
445
|
+
if (total !== this.vs.total || (this.props.scrollable === 'virtual') !== this.vs.scrollableVirtual) {
|
|
431
446
|
this.vs.reset();
|
|
432
447
|
this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.props.rowHeight === undefined || this.props.rowHeight === 0);
|
|
433
448
|
this.vs.table = this.tableElement;
|
|
@@ -441,7 +456,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
441
456
|
this.vs.propsSkip = (this.props.skip || 0) + (this.props.scrollable === 'virtual' ?
|
|
442
457
|
this.vs.topCacheCount + (this.vs.attendedSkip - (this.props.skip || 0)) : 0);
|
|
443
458
|
if (this.props.rowHeight !== undefined && this.props.rowHeight > 0 && !groupable) {
|
|
444
|
-
|
|
459
|
+
var containerHeight = this.props.rowHeight * total;
|
|
460
|
+
this.vs.containerHeight = index_1.firefox ? Math.min(index_1.firefoxMaxHeight, containerHeight) : containerHeight;
|
|
445
461
|
}
|
|
446
462
|
else {
|
|
447
463
|
this.vs.containerHeight = 1533915;
|
|
@@ -449,25 +465,25 @@ var Grid = /** @class */ (function (_super) {
|
|
|
449
465
|
var groupingFooter = (typeof this.props.groupable === 'object') && this.props.groupable.footer || 'none';
|
|
450
466
|
this._data = [];
|
|
451
467
|
var resolvedGroupsCount = (0, index_1.flatData)(this._data, propsData, groupingFooter, { index: this.props.skip || 0 }, this.props.group !== undefined, this.props.expandField);
|
|
452
|
-
var children =
|
|
453
|
-
this.initColumns(children
|
|
454
|
-
child.type.displayName === 'KendoReactGridColumn'; }), resolvedGroupsCount);
|
|
468
|
+
var children = this.childrenToArray(this.props.children);
|
|
469
|
+
this.initColumns(children, resolvedGroupsCount);
|
|
455
470
|
var toolbar = children.filter(function (child) { return child && child.type &&
|
|
456
471
|
child.type.displayName === 'KendoReactGridToolbar'; });
|
|
457
472
|
var noRecords = children.filter(function (child) { return child && child.type &&
|
|
458
473
|
child.type.displayName === 'KendoReactGridNoRecords'; });
|
|
459
474
|
var leafColumns = this._columns.filter(function (c) { return c.children.length === 0; });
|
|
460
475
|
var groupingPanel = groupable && (React.createElement(GroupPanel_1.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 }));
|
|
461
|
-
var
|
|
476
|
+
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 ? filterCommon_1.operators : _b, headerCellRender = _a.headerCellRender, columnMenu = _a.columnMenu;
|
|
477
|
+
var header = (React.createElement(Header_1.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_1.FilterRow, { columns: this._columns, filter: this.props.filter, filterOperators: this.props.filterOperators || filterCommon_1.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 ?
|
|
462
478
|
Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); }) }));
|
|
463
479
|
var scrollLeft = this.vs && this.vs.container && this.vs.container.scrollLeft || 0;
|
|
464
480
|
var tableWidth = parseFloat(((this.props.style || {}).width || '').toString());
|
|
465
|
-
var
|
|
481
|
+
var _c = (0, kendo_react_data_tools_1.tableColumnsVirtualization)({
|
|
466
482
|
enabled: this.props.columnVirtualization,
|
|
467
483
|
columns: leafColumns,
|
|
468
484
|
tableViewPortWidth: tableWidth,
|
|
469
485
|
scrollLeft: scrollLeft
|
|
470
|
-
}), colSpans =
|
|
486
|
+
}), colSpans = _c.colSpans, isColHidden = _c.hiddenColumns;
|
|
471
487
|
var dataRow = function (item, rowId, rowDataIndex) {
|
|
472
488
|
var isInEdit = false;
|
|
473
489
|
var selectedValue = _this.props.selectedField ? (0, index_1.getNestedValue)(_this.props.selectedField, item.dataItem) : undefined;
|
|
@@ -484,29 +500,6 @@ var Grid = /** @class */ (function (_super) {
|
|
|
484
500
|
? { left: column.left, right: column.right }
|
|
485
501
|
: { left: column.right, right: column.left }
|
|
486
502
|
: {};
|
|
487
|
-
var cellProps = {
|
|
488
|
-
id: kendo_react_data_tools_1.tableKeyboardNavigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix),
|
|
489
|
-
colSpan: colSpans[columnIndex],
|
|
490
|
-
dataItem: item.dataItem,
|
|
491
|
-
field: column.field,
|
|
492
|
-
editor: column.editor,
|
|
493
|
-
format: column.format,
|
|
494
|
-
className: className,
|
|
495
|
-
render: _this.props.cellRender,
|
|
496
|
-
onChange: _this.itemChange,
|
|
497
|
-
selectionChange: (_this.props.onSelectionChange) ?
|
|
498
|
-
(function (e) { _this.selectionChange({ event: e, dataItem: item.dataItem, dataIndex: rowDataIndex, columnIndex: columnIndex }); }) :
|
|
499
|
-
undefined,
|
|
500
|
-
columnIndex: columnIndex,
|
|
501
|
-
columnsCount: leafColumns.length,
|
|
502
|
-
rowType: item.rowType,
|
|
503
|
-
level: item.level,
|
|
504
|
-
expanded: item.expanded,
|
|
505
|
-
dataIndex: item.dataIndex,
|
|
506
|
-
style: style,
|
|
507
|
-
ariaColumnIndex: column.ariaColumnIndex,
|
|
508
|
-
isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(columnIndex) > -1
|
|
509
|
-
};
|
|
510
503
|
var currentColumnIsInEdit = false;
|
|
511
504
|
if (column.editable && _this.props.editField) {
|
|
512
505
|
var inEdit = (0, index_1.getNestedValue)(_this.props.editField, item.dataItem);
|
|
@@ -515,12 +508,10 @@ var Grid = /** @class */ (function (_super) {
|
|
|
515
508
|
currentColumnIsInEdit = true;
|
|
516
509
|
}
|
|
517
510
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
? React.createElement(GridEditCell_1.GridEditCell, __assign({ key: columnKey }, cellProps))
|
|
523
|
-
: React.createElement(GridCell_1.GridCell, __assign({ key: columnKey }, cellProps));
|
|
511
|
+
var Cell = column.cell || (currentColumnIsInEdit && GridEditCell_1.GridEditCell) || GridCell_1.GridCell;
|
|
512
|
+
return (React.createElement(Cell, { key: columnKey, locked: _this.props.lockGroups, id: kendo_react_data_tools_1.tableKeyboardNavigationTools.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) ?
|
|
513
|
+
(function (e) { _this.selectionChange({ event: e, dataItem: item.dataItem, dataIndex: rowDataIndex, columnIndex: columnIndex }); }) :
|
|
514
|
+
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 }));
|
|
524
515
|
}),
|
|
525
516
|
isInEdit: isInEdit,
|
|
526
517
|
isSelected: typeof selectedValue === 'boolean' && selectedValue
|
|
@@ -572,8 +563,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
572
563
|
detailRowCount_1++;
|
|
573
564
|
currentAriaRowIndex = absoluteIndex + rowIndexStart + detailRowCount_1;
|
|
574
565
|
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 },
|
|
575
|
-
_this.props.group && _this.props.group.map(function (
|
|
576
|
-
return (React.createElement(GridGroupCell_1.GridGroupCell, { id: '', dataIndex: item.dataIndex, field:
|
|
566
|
+
_this.props.group && _this.props.group.map(function (gr, idx) {
|
|
567
|
+
return (React.createElement(GridGroupCell_1.GridGroupCell, { id: '', dataIndex: item.dataIndex, field: gr.field, dataItem: item.dataItem, key: idx, style: {}, ariaColumnIndex: 1 + idx, isSelected: false, locked: _this.props.lockGroups }));
|
|
577
568
|
}),
|
|
578
569
|
_this.props.expandField &&
|
|
579
570
|
React.createElement(GridDetailHierarchyCell_1.GridDetailHierarchyCell, { id: kendo_react_data_tools_1.tableKeyboardNavigationTools.generateNavigatableId("".concat(detailRowId, "-dhcell"), idPrefix) }),
|
|
@@ -637,7 +628,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
637
628
|
header,
|
|
638
629
|
React.createElement("div", { className: "k-grid-container", role: "presentation" },
|
|
639
630
|
React.createElement("div", { ref: this.vs.containerRef, className: "k-grid-content k-virtual-content", onScroll: this.scrollHandler, role: "presentation" },
|
|
640
|
-
React.createElement("div", {
|
|
631
|
+
React.createElement("div", { className: 'k-grid-table-wrap', role: "presentation" },
|
|
641
632
|
React.createElement(kendo_react_data_tools_1.TableSelection, { selectable: this.props.selectable, onRelease: this.selectionRelease, childRef: function (table) {
|
|
642
633
|
_this.vs.table = table;
|
|
643
634
|
_this.tableElement = table;
|
|
@@ -687,6 +678,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
687
678
|
var spliced = this._columns.splice(prev, end(prev) - prev);
|
|
688
679
|
(_a = this._columns).splice.apply(_a, __spreadArray([prev < next ? end(next - spliced.length) : next, 0], spliced, false));
|
|
689
680
|
this._columns.filter(function (q) { return q.declarationIndex >= 0; }).forEach(function (c, i) { return c.orderIndex = i; });
|
|
681
|
+
this._columnsMutations++;
|
|
690
682
|
var eventColumnProps = this.columns;
|
|
691
683
|
this.forceUpdate();
|
|
692
684
|
if (this.props.onColumnReorder) {
|
|
@@ -738,10 +730,10 @@ var Grid = /** @class */ (function (_super) {
|
|
|
738
730
|
this.vs.table.style.width = totalWidth + 'px';
|
|
739
731
|
}
|
|
740
732
|
};
|
|
741
|
-
Grid.prototype.initColumns = function (
|
|
733
|
+
Grid.prototype.initColumns = function (children, groupCount) {
|
|
742
734
|
var _this = this;
|
|
743
735
|
var idPrefix = kendo_react_data_tools_1.tableKeyboardNavigationTools.getIdPrefix(this.navigationStateRef);
|
|
744
|
-
this._columns =
|
|
736
|
+
this._columns = this.readColumns(children, idPrefix, this._columnsMutations);
|
|
745
737
|
if (this._columns.length === 0) {
|
|
746
738
|
this._columns = (0, index_1.autoGenerateColumns)(this.props.data, this.props.group, this.props.expandField, { prevId: 0, idPrefix: idPrefix });
|
|
747
739
|
}
|
|
@@ -781,7 +773,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
781
773
|
columnIndexOffset++;
|
|
782
774
|
}
|
|
783
775
|
this._columns.slice(columnIndexOffset).forEach(function (c) { return c.parentIndex >= 0 && (c.parentIndex += columnIndexOffset); });
|
|
784
|
-
this._columnsMap =
|
|
776
|
+
this._columnsMap = this.mapColumns(this._columns);
|
|
785
777
|
this.columnResize.columns = this._columns;
|
|
786
778
|
this.dragLogic.columns = this._columns;
|
|
787
779
|
};
|
|
@@ -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
|
}
|
|
@@ -7,6 +7,7 @@ var React = require("react");
|
|
|
7
7
|
*/
|
|
8
8
|
var VirtualScroll = /** @class */ (function () {
|
|
9
9
|
function VirtualScroll(cached) {
|
|
10
|
+
var _this = this;
|
|
10
11
|
this.table = null;
|
|
11
12
|
this.containerHeight = 0;
|
|
12
13
|
this.topCacheCount = 0; // 4;
|
|
@@ -25,6 +26,25 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
25
26
|
this.prevScrollPos = 0;
|
|
26
27
|
this.tableTranslate = 0;
|
|
27
28
|
this.scrollSyncing = false;
|
|
29
|
+
this.topItems = function (heights, skipTopBuffer) {
|
|
30
|
+
if (!_this.container || skipTopBuffer) {
|
|
31
|
+
return { topItemsCount: 0, topItemsHeight: 0 };
|
|
32
|
+
}
|
|
33
|
+
var screenHeight = _this.container.clientHeight;
|
|
34
|
+
var itemsOnScreen = Math.ceil(screenHeight / heights[0].line);
|
|
35
|
+
var topItemsCount = Math.ceil((heights.length - itemsOnScreen) / 2);
|
|
36
|
+
var topItemsHeight = 0;
|
|
37
|
+
for (var i = 0; i < topItemsCount; i++) {
|
|
38
|
+
topItemsHeight += heights[i].line + heights[i].acc;
|
|
39
|
+
}
|
|
40
|
+
return { topItemsCount: topItemsCount, topItemsHeight: topItemsHeight };
|
|
41
|
+
};
|
|
42
|
+
this.horizontalScrollbarHeight = function () {
|
|
43
|
+
if (!_this.container) {
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
return _this.container.offsetHeight - _this.container.clientHeight;
|
|
47
|
+
};
|
|
28
48
|
if (cached) {
|
|
29
49
|
this.topCacheCount = 4;
|
|
30
50
|
this.attendedSkip = -this.topCacheCount;
|
|
@@ -82,22 +102,6 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
82
102
|
this.table.style.transform = 'translateY(' + dY + 'px)';
|
|
83
103
|
}
|
|
84
104
|
};
|
|
85
|
-
VirtualScroll.prototype.syncScroll = function () {
|
|
86
|
-
if (!this.scrollableVirtual || !this.container) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.syncTimeout = null;
|
|
90
|
-
var scrollTop = this.container.scrollTop;
|
|
91
|
-
var containerHeight = this.containerHeight; // = this.container.scrollHeight;
|
|
92
|
-
var rowHeights = this.rowHeights;
|
|
93
|
-
var percentage = (scrollTop - this.tableTranslate) / rowHeights[0].line;
|
|
94
|
-
var targetFloorScrollPosition = Math.floor((containerHeight) * (this.propsSkip + percentage) / this.total);
|
|
95
|
-
if (this.container.scrollTop !== (this.prevScrollPos = targetFloorScrollPosition)) {
|
|
96
|
-
this.scrollSyncing = true;
|
|
97
|
-
this.container.scrollTop = (this.prevScrollPos = targetFloorScrollPosition);
|
|
98
|
-
}
|
|
99
|
-
this.translate(this.tableTranslate + targetFloorScrollPosition - scrollTop);
|
|
100
|
-
};
|
|
101
105
|
VirtualScroll.prototype.reset = function () {
|
|
102
106
|
this.scrollSyncing = true;
|
|
103
107
|
if (this.fixedScroll) {
|
|
@@ -116,11 +120,12 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
116
120
|
var scrollTop = this.container.scrollTop;
|
|
117
121
|
var targetTranslate = this.tableTranslate;
|
|
118
122
|
var rowsCount = 0;
|
|
123
|
+
var _a = this.topItems(heights, Boolean(this.topCacheCount)), topItemsCount = _a.topItemsCount, topItemsHeight = _a.topItemsHeight;
|
|
119
124
|
var additionalOnTop = scrollTop - targetTranslate;
|
|
120
|
-
if (additionalOnTop >
|
|
125
|
+
if (additionalOnTop > topItemsHeight) {
|
|
121
126
|
return;
|
|
122
127
|
}
|
|
123
|
-
while ((rowsCount < this.topCacheCount + this.attendedSkip - this.realSkip)
|
|
128
|
+
while ((rowsCount < this.topCacheCount + this.attendedSkip - this.realSkip + topItemsCount)
|
|
124
129
|
&& this.propsSkip - rowsCount > 0 &&
|
|
125
130
|
!(targetTranslate + (heights[heights.length - 1 - rowsCount].line + heights[heights.length - 1 - rowsCount].acc) + additionalOnTop <= scrollTop)) {
|
|
126
131
|
targetTranslate -= heights[heights.length - 1 - rowsCount].line +
|
|
@@ -146,8 +151,9 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
146
151
|
// floor the translate to beginning of the item in absolute value
|
|
147
152
|
}
|
|
148
153
|
if (targetTranslate !== this.tableTranslate) {
|
|
149
|
-
this.translate(targetTranslate);
|
|
150
|
-
|
|
154
|
+
this.translate(Math.max(0, targetTranslate - topItemsHeight));
|
|
155
|
+
var nextSkip = Math.max(0, this.propsSkip - rowsCount - topItemsCount);
|
|
156
|
+
this.changePage(nextSkip, e);
|
|
151
157
|
}
|
|
152
158
|
};
|
|
153
159
|
VirtualScroll.prototype.localScrollDown = function (e) {
|
|
@@ -158,18 +164,22 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
158
164
|
var scrollTop = this.container.scrollTop;
|
|
159
165
|
var targetTranslate = this.tableTranslate;
|
|
160
166
|
var rowsCount = 0;
|
|
167
|
+
var _a = this.topItems(heights, Boolean(this.topCacheCount)), topItemsCount = _a.topItemsCount, topItemsHeight = _a.topItemsHeight;
|
|
161
168
|
while (rowsCount < heights.length - this.topCacheCount &&
|
|
162
169
|
!(targetTranslate + heights[rowsCount].line + heights[rowsCount].acc > scrollTop)) {
|
|
163
170
|
targetTranslate += heights[rowsCount].line + heights[rowsCount].acc;
|
|
164
171
|
rowsCount++;
|
|
165
172
|
}
|
|
173
|
+
if (topItemsCount > this.propsSkip + rowsCount) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
166
176
|
if (rowsCount >= heights.length - this.topCacheCount && this.propsSkip + rowsCount >= this.total) {
|
|
167
|
-
this.translate(targetTranslate);
|
|
168
|
-
this.changePage(this.total - 1, e);
|
|
177
|
+
this.translate(targetTranslate - topItemsHeight);
|
|
178
|
+
this.changePage(this.total - 1 - topItemsCount, e);
|
|
169
179
|
}
|
|
170
|
-
else if (targetTranslate !== this.tableTranslate) {
|
|
171
|
-
this.translate(targetTranslate);
|
|
172
|
-
this.changePage(this.propsSkip + rowsCount, e);
|
|
180
|
+
else if (targetTranslate !== this.tableTranslate && this.propsSkip + rowsCount - topItemsCount !== this.propsSkip) {
|
|
181
|
+
this.translate(targetTranslate - topItemsHeight);
|
|
182
|
+
this.changePage(this.propsSkip + rowsCount - topItemsCount, e);
|
|
173
183
|
}
|
|
174
184
|
};
|
|
175
185
|
VirtualScroll.prototype.scrollNonStrict = function (e) {
|
|
@@ -188,8 +198,9 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
188
198
|
else if (rowIndexOffset === -1) {
|
|
189
199
|
microAdjust = -((heights[heights.length - 1].line + heights[heights.length - 1].acc) * rowpercentage);
|
|
190
200
|
}
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
201
|
+
var _a = this.topItems(heights, Boolean(this.topCacheCount)), topItemsCount = _a.topItemsCount, topItemsHeight = _a.topItemsHeight;
|
|
202
|
+
this.translate(Math.max(0, microAdjust - topItemsHeight - this.horizontalScrollbarHeight() + this.containerHeight * floatRowIndex / this.total));
|
|
203
|
+
this.changePage(rowIndex - topItemsCount, e);
|
|
193
204
|
};
|
|
194
205
|
VirtualScroll.prototype.scrollHandler = function (e) {
|
|
195
206
|
if (!this.scrollableVirtual) {
|
|
@@ -199,9 +210,6 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
199
210
|
this.scrollSyncing = false;
|
|
200
211
|
return;
|
|
201
212
|
}
|
|
202
|
-
var grid = this;
|
|
203
|
-
clearTimeout(this.syncTimeout);
|
|
204
|
-
this.syncTimeout = window.setTimeout(function () { grid.syncScroll(); }, 200);
|
|
205
213
|
var scrollTop = this.container.scrollTop;
|
|
206
214
|
var prev = this.prevScrollPos;
|
|
207
215
|
this.prevScrollPos = scrollTop;
|
|
@@ -96,36 +96,27 @@ var HeaderRow = /** @class */ (function (_super) {
|
|
|
96
96
|
} : {
|
|
97
97
|
'role': 'presentation'
|
|
98
98
|
};
|
|
99
|
-
var columnMenuWrapperProps = {
|
|
100
|
-
column: {
|
|
101
|
-
field: column.field,
|
|
102
|
-
filter: column.filter
|
|
103
|
-
},
|
|
104
|
-
sortable: sortable && _this.props.sortable,
|
|
105
|
-
sort: _this.props.sort,
|
|
106
|
-
onSortChange: _this.props.sortChange,
|
|
107
|
-
filter: _this.props.filter,
|
|
108
|
-
filterable: _this.props.filterable && column.filterable,
|
|
109
|
-
filterOperators: _this.props.filterOperators,
|
|
110
|
-
onFilterChange: _this.props.filterChange,
|
|
111
|
-
group: _this.props.group,
|
|
112
|
-
groupable: _this.props.groupable,
|
|
113
|
-
onGroupChange: _this.props.groupChange,
|
|
114
|
-
columnMenu: columnMenu
|
|
115
|
-
};
|
|
116
|
-
var headerCellProps = {
|
|
117
|
-
field: column.field,
|
|
118
|
-
onClick: sortable && (function (e) { return _this.cellClick(e, column); }) || undefined,
|
|
119
|
-
selectionChange: _this.props.selectionChange,
|
|
120
|
-
title: column.title,
|
|
121
|
-
selectionValue: column.headerSelectionValue,
|
|
122
|
-
render: _this.props.cellRender,
|
|
123
|
-
children: _this.sortIcon(sortIndex),
|
|
124
|
-
columnMenuWrapperProps: columnMenuWrapperProps
|
|
125
|
-
};
|
|
126
99
|
var key = (column.declarationIndex >= 0) ? ++_this.index : --_this.serviceIndex;
|
|
100
|
+
var HeaderCell = column.headerCell ? column.headerCell : GridHeaderCell_1.GridHeaderCell;
|
|
101
|
+
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: {
|
|
102
|
+
column: {
|
|
103
|
+
field: column.field,
|
|
104
|
+
filter: column.filter
|
|
105
|
+
},
|
|
106
|
+
sortable: sortable && _this.props.sortable,
|
|
107
|
+
sort: _this.props.sort,
|
|
108
|
+
onSortChange: _this.props.sortChange,
|
|
109
|
+
filter: _this.props.filter,
|
|
110
|
+
filterable: _this.props.filterable && column.filterable,
|
|
111
|
+
filterOperators: _this.props.filterOperators,
|
|
112
|
+
onFilterChange: _this.props.filterChange,
|
|
113
|
+
group: _this.props.group,
|
|
114
|
+
groupable: _this.props.groupable,
|
|
115
|
+
onGroupChange: _this.props.groupChange,
|
|
116
|
+
columnMenu: columnMenu
|
|
117
|
+
} }));
|
|
127
118
|
return (React.createElement(kendo_react_data_tools_1.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" }),
|
|
128
|
-
|
|
119
|
+
headerCell,
|
|
129
120
|
_this.props.columnResize && _this.props.columnResize.resizable && column.resizable &&
|
|
130
121
|
React.createElement(ColumnResizer_1.ColumnResizer, { key: 2, resize: function (e, element, end) {
|
|
131
122
|
return _this.props.columnResize &&
|
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-grid',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1672914787,
|
|
12
12
|
version: '',
|
|
13
13
|
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'
|
|
14
14
|
};
|
|
@@ -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;
|
package/dist/npm/utils/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.sanitizeColumns = exports.footerColumns = exports.autoGenerateColumns = exports.readColumns = exports.checkPropCompatibility = exports.flatData = exports.getNestedValue = void 0;
|
|
25
|
+
exports.firefoxMaxHeight = exports.firefox = exports.sanitizeColumns = exports.footerColumns = exports.autoGenerateColumns = exports.readColumns = exports.checkPropCompatibility = exports.flatData = exports.getNestedValue = void 0;
|
|
26
26
|
/**
|
|
27
27
|
* @hidden
|
|
28
28
|
*/
|
|
@@ -237,3 +237,12 @@ var sanitizeColumns = function (columns) {
|
|
|
237
237
|
});
|
|
238
238
|
};
|
|
239
239
|
exports.sanitizeColumns = sanitizeColumns;
|
|
240
|
+
/**
|
|
241
|
+
* @hidden
|
|
242
|
+
*/
|
|
243
|
+
exports.firefox = typeof window !== 'undefined' &&
|
|
244
|
+
/Firefox/.test(window.navigator.userAgent);
|
|
245
|
+
/**
|
|
246
|
+
* @hidden
|
|
247
|
+
*/
|
|
248
|
+
exports.firefoxMaxHeight = 17895697;
|