@progress/kendo-vue-grid 3.8.4-dev.202302210950 → 3.8.4-dev.202302221749
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-vue-grid.js +1 -1
- package/dist/es/Grid.d.ts +6 -2
- package/dist/es/Grid.js +76 -22
- package/dist/es/VirtualScroll.d.ts +9 -5
- package/dist/es/VirtualScroll.js +13 -4
- package/dist/es/VirtualScrollFixed.d.ts +47 -0
- package/dist/es/VirtualScrollFixed.js +144 -0
- package/dist/es/interfaces/GridProps.d.ts +4 -0
- package/dist/es/interfaces/VirtualScrollInterface.d.ts +26 -0
- package/dist/es/interfaces/VirtualScrollInterface.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/main.d.ts +8 -0
- package/dist/es/utils/main.js +9 -0
- package/dist/esm/Grid.d.ts +6 -2
- package/dist/esm/Grid.js +76 -22
- package/dist/esm/VirtualScroll.d.ts +9 -5
- package/dist/esm/VirtualScroll.js +13 -4
- package/dist/esm/VirtualScrollFixed.d.ts +47 -0
- package/dist/esm/VirtualScrollFixed.js +144 -0
- package/dist/esm/interfaces/GridProps.d.ts +4 -0
- package/dist/esm/interfaces/VirtualScrollInterface.d.ts +26 -0
- package/dist/esm/interfaces/VirtualScrollInterface.js +1 -0
- package/dist/esm/package-metadata.js +1 -1
- package/dist/esm/utils/main.d.ts +8 -0
- package/dist/esm/utils/main.js +9 -0
- package/dist/npm/Grid.d.ts +6 -2
- package/dist/npm/Grid.js +75 -21
- package/dist/npm/VirtualScroll.d.ts +9 -5
- package/dist/npm/VirtualScroll.js +13 -4
- package/dist/npm/VirtualScrollFixed.d.ts +47 -0
- package/dist/npm/VirtualScrollFixed.js +147 -0
- package/dist/npm/interfaces/GridProps.d.ts +4 -0
- package/dist/npm/interfaces/VirtualScrollInterface.d.ts +26 -0
- package/dist/npm/interfaces/VirtualScrollInterface.js +2 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/main.d.ts +8 -0
- package/dist/npm/utils/main.js +10 -1
- package/package.json +14 -14
package/dist/es/Grid.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } fr
|
|
|
6
6
|
import { Page, TableKeyboardNavigationContextType, TableKeyboardNavigationStateType } from '@progress/kendo-vue-data-tools';
|
|
7
7
|
import { ExtendedColumnProps } from './interfaces/ExtendedColumnProps';
|
|
8
8
|
import { SortDescriptor, CompositeFilterDescriptor, GroupDescriptor, State } from '@progress/kendo-data-query';
|
|
9
|
-
import {
|
|
9
|
+
import { VirtualScrollInterface } from './interfaces/VirtualScrollInterface';
|
|
10
10
|
import { ColumnResize } from './drag/ColumnResize';
|
|
11
11
|
import { CommonDragLogic } from './drag/CommonDragLogic';
|
|
12
12
|
import { DataItemWrapper } from './utils/main';
|
|
@@ -120,10 +120,14 @@ export interface GridData {
|
|
|
120
120
|
export interface GridState {
|
|
121
121
|
initialHeight: String | null;
|
|
122
122
|
dragLogic: CommonDragLogic;
|
|
123
|
-
|
|
123
|
+
slicedCurrentData: Array<DataItemWrapper> | undefined;
|
|
124
|
+
containerRef: any;
|
|
125
|
+
tableBodyRef: any;
|
|
126
|
+
vs: VirtualScrollInterface;
|
|
124
127
|
columnResize: ColumnResize;
|
|
125
128
|
_gridId: string;
|
|
126
129
|
v3: boolean;
|
|
130
|
+
_prevTotal: number | undefined;
|
|
127
131
|
}
|
|
128
132
|
/**
|
|
129
133
|
* @hidden
|
package/dist/es/Grid.js
CHANGED
|
@@ -54,11 +54,12 @@ import { FooterRow } from './footer/FooterRow';
|
|
|
54
54
|
import { GridCellValue } from './GridCellValue';
|
|
55
55
|
import { operators } from './filterCommon';
|
|
56
56
|
import { VirtualScroll } from './VirtualScroll';
|
|
57
|
+
import { RowHeightService, VirtualScrollFixed } from './VirtualScrollFixed';
|
|
57
58
|
import { ColumnResize } from './drag/ColumnResize';
|
|
58
59
|
import { CommonDragLogic } from './drag/CommonDragLogic';
|
|
59
60
|
import { DragClue } from './drag/DragClue';
|
|
60
61
|
import { DropClue } from './drag/DropClue';
|
|
61
|
-
import { flatData, mapColumns, readColumns, autoGenerateColumns, applyExpandedState, groupedFirstItemValue } from './utils/main';
|
|
62
|
+
import { flatData, mapColumns, readColumns, firefox, firefoxMaxHeight, autoGenerateColumns, applyExpandedState, groupedFirstItemValue } from './utils/main';
|
|
62
63
|
import { GridCell } from './cells/GridCell';
|
|
63
64
|
import { GridGroupCell } from './cells/GridGroupCell';
|
|
64
65
|
import { GridRow } from './rows/GridRow';
|
|
@@ -126,6 +127,7 @@ var GridVue2 = {
|
|
|
126
127
|
},
|
|
127
128
|
pager: templateDefinition,
|
|
128
129
|
rowHeight: Number,
|
|
130
|
+
detailRowHeight: Number,
|
|
129
131
|
detail: templateDefinition,
|
|
130
132
|
columnMenu: [Boolean, String, Function, Object],
|
|
131
133
|
columnMenuAnimate: {
|
|
@@ -166,7 +168,8 @@ var GridVue2 = {
|
|
|
166
168
|
this.initialHeight = null;
|
|
167
169
|
this._columns = [];
|
|
168
170
|
var groupable = this.currentGroupable;
|
|
169
|
-
|
|
171
|
+
var VS = this.getVirtualScroll();
|
|
172
|
+
this.vs = new VS(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
|
|
170
173
|
this.dragLogic = new CommonDragLogic(this.columnReorder.bind(this), this.groupReorder.bind(this), this.columnToGroup.bind(this));
|
|
171
174
|
this.columnResize = new ColumnResize(this.onResize.bind(this));
|
|
172
175
|
this._columnsMap = [[]];
|
|
@@ -175,11 +178,13 @@ var GridVue2 = {
|
|
|
175
178
|
this.forceUpdateTimeout = undefined;
|
|
176
179
|
this._gridId = guid();
|
|
177
180
|
this._gridRoleElementId = guid(); // Needed for aria-control accessibility attribute
|
|
181
|
+
this.slicedCurrentData = undefined;
|
|
182
|
+
this._prevTotal = undefined;
|
|
178
183
|
},
|
|
179
|
-
|
|
180
184
|
mounted: function mounted() {
|
|
181
185
|
this.setRefs();
|
|
182
186
|
var rtl = isRtl(this._element);
|
|
187
|
+
this._prevTotal = this.$props.total;
|
|
183
188
|
this.isRtl = rtl;
|
|
184
189
|
// @ts-ignore
|
|
185
190
|
this.initialHeight = this._element.style ? this._element.style.height : null;
|
|
@@ -188,6 +193,11 @@ var GridVue2 = {
|
|
|
188
193
|
this.setRefs();
|
|
189
194
|
var rtl = isRtl(this._element);
|
|
190
195
|
this.isRtl = rtl;
|
|
196
|
+
this._prevTotal = this.$props.total;
|
|
197
|
+
if (this.vs.tableTransform && this.vs.table) {
|
|
198
|
+
this.vs.table.style.transform = this.vs.tableTransform;
|
|
199
|
+
this.vs.tableTransform = '';
|
|
200
|
+
}
|
|
191
201
|
},
|
|
192
202
|
destroyed: !!isV3 ? undefined : function () {
|
|
193
203
|
this.gridUnmounted();
|
|
@@ -329,10 +339,10 @@ var GridVue2 = {
|
|
|
329
339
|
this.columnResize.colGroupMain = getRef(this, 'colGroup');
|
|
330
340
|
this._header = getRef(this, 'header');
|
|
331
341
|
this._footer = getRef(this, 'footer');
|
|
332
|
-
this.vs.
|
|
342
|
+
this.vs.containerRef = getRef(this, 'scrollContainer');
|
|
333
343
|
this.vs.table = getRef(this, 'scrollTable');
|
|
334
344
|
this.resetTableWidth();
|
|
335
|
-
this.vs.
|
|
345
|
+
this.vs.tableBodyRef = getRef(this, 'scrollTableBody');
|
|
336
346
|
},
|
|
337
347
|
gridUnmounted: function gridUnmounted() {
|
|
338
348
|
clearTimeout(this.forceUpdateTimeout);
|
|
@@ -352,6 +362,62 @@ var GridVue2 = {
|
|
|
352
362
|
this.vs.scrollableVirtual = this.$props.scrollable === 'virtual';
|
|
353
363
|
this.vs.propsSkip = (this.$props.skip || 0) + (this.$props.scrollable === 'virtual' ? this.vs.topCacheCount + (this.vs.attendedSkip - (this.$props.skip || 0)) : 0);
|
|
354
364
|
},
|
|
365
|
+
getVirtualScroll: function getVirtualScroll() {
|
|
366
|
+
return VirtualScroll;
|
|
367
|
+
},
|
|
368
|
+
isAllData: function isAllData() {
|
|
369
|
+
var _a = this.$props,
|
|
370
|
+
dataItems = _a.dataItems,
|
|
371
|
+
total = _a.total;
|
|
372
|
+
if (Array.isArray(dataItems)) {
|
|
373
|
+
return dataItems.length === total;
|
|
374
|
+
} else if (dataItems) {
|
|
375
|
+
return total === dataItems.total;
|
|
376
|
+
}
|
|
377
|
+
return false;
|
|
378
|
+
},
|
|
379
|
+
initializeVirtualization: function initializeVirtualization(total) {
|
|
380
|
+
if (this.$props.total !== this._prevTotal || this.$props.scrollable === 'virtual' !== this.vs.scrollableVirtual) {
|
|
381
|
+
this.vs.reset();
|
|
382
|
+
}
|
|
383
|
+
this.resetVirtual();
|
|
384
|
+
this.vs.total = total;
|
|
385
|
+
if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !this.currentGroupable) {
|
|
386
|
+
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * (total || 0));
|
|
387
|
+
} else {
|
|
388
|
+
if (this.$props.totalGroupedHeight) {
|
|
389
|
+
this.vs.containerHeight = Math.min(1533915, this.$props.totalGroupedHeight);
|
|
390
|
+
} else if (this.$props.allGroupedItems && this.$props.allGroupedItems.data) {
|
|
391
|
+
var allGroupedTotal = this.totalGroupedRows(applyExpandedState(this.$props.allGroupedItems, this.computedCollapsed, this.$props.uniqueField).data);
|
|
392
|
+
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * allGroupedTotal);
|
|
393
|
+
} else {
|
|
394
|
+
this.vs.containerHeight = 1533915;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
this.vs.containerRef = this.containerRef;
|
|
398
|
+
this.vs.tableBodyRef = this.tableBodyRef;
|
|
399
|
+
this.vs.table = this.tableElement;
|
|
400
|
+
this.slicedCurrentData = undefined;
|
|
401
|
+
if (this.vs instanceof VirtualScrollFixed) {
|
|
402
|
+
var _a = this.$props,
|
|
403
|
+
_b = _a.rowHeight,
|
|
404
|
+
rowHeight = _b === void 0 ? 0 : _b,
|
|
405
|
+
detail = _a.detail,
|
|
406
|
+
expandField = _a.expandField;
|
|
407
|
+
var _c = this.$props.detailRowHeight,
|
|
408
|
+
detailRowHeight = _c === void 0 ? 0 : _c;
|
|
409
|
+
detailRowHeight = Boolean(detail && expandField) ? detailRowHeight : rowHeight;
|
|
410
|
+
if (this.isAllData()) {
|
|
411
|
+
this.vs.total = this.currentData.length;
|
|
412
|
+
this.slicedCurrentData = this.currentData.slice(this.vs.realSkip, this.vs.realSkip + this.vs.pageSize);
|
|
413
|
+
this.vs.rowHeightService = this.rowHeightService(this.vs, this.currentData.length, rowHeight, detailRowHeight, this.currentData);
|
|
414
|
+
} else {
|
|
415
|
+
this.vs.rowHeightService = new RowHeightService(total, rowHeight, detailRowHeight);
|
|
416
|
+
}
|
|
417
|
+
var containerHeight = this.vs.rowHeightService.totalHeight();
|
|
418
|
+
this.vs.containerHeight = firefox ? Math.min(firefoxMaxHeight, containerHeight) : containerHeight;
|
|
419
|
+
}
|
|
420
|
+
},
|
|
355
421
|
onSkipChanged: function onSkipChanged(value, _oldValue) {
|
|
356
422
|
if (Math.max(0, this.vs.attendedSkip) !== value && value !== undefined) {
|
|
357
423
|
this.vs.attendedSkip = value;
|
|
@@ -784,7 +850,7 @@ var GridVue2 = {
|
|
|
784
850
|
if (item.expanded !== false && item.items) {
|
|
785
851
|
allRowsCount = _this.addSubItems(item.items, allRowsCount);
|
|
786
852
|
}
|
|
787
|
-
if (_this.group && _this.group.length && (_this.$props.groupable.footer === 'always' || item.expanded !== false && _this.$props.groupable.footer === 'visible')) {
|
|
853
|
+
if (_this.group && _this.group.length && (_this.$props.groupable.footer === 'always' || item.expanded !== false && item.items && _this.$props.groupable.footer === 'visible')) {
|
|
788
854
|
allRowsCount++;
|
|
789
855
|
}
|
|
790
856
|
});
|
|
@@ -837,26 +903,13 @@ var GridVue2 = {
|
|
|
837
903
|
this.columnResize.resizable = this.$props.resizable || false;
|
|
838
904
|
this.dragLogic.reorderable = this.$props.reorderable || false;
|
|
839
905
|
this.dragLogic.groupable = groupable;
|
|
840
|
-
this.
|
|
841
|
-
this.vs.total = total;
|
|
842
|
-
if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !this.currentGroupable) {
|
|
843
|
-
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * (total || 0));
|
|
844
|
-
} else {
|
|
845
|
-
if (this.$props.totalGroupedHeight) {
|
|
846
|
-
this.vs.containerHeight = Math.min(1533915, this.$props.totalGroupedHeight);
|
|
847
|
-
} else if (this.$props.allGroupedItems && this.$props.allGroupedItems.data) {
|
|
848
|
-
var allGroupedTotal = this.totalGroupedRows(applyExpandedState(this.$props.allGroupedItems, this.computedCollapsed, this.$props.uniqueField).data);
|
|
849
|
-
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * allGroupedTotal);
|
|
850
|
-
} else {
|
|
851
|
-
this.vs.containerHeight = 1533915;
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
var children = defaultSlot || [];
|
|
906
|
+
this.initializeVirtualization(total);
|
|
855
907
|
var groupingFooter = isObject(this.$props.groupable) && this.$props.groupable.footer || 'none';
|
|
856
908
|
this.currentData = [];
|
|
857
909
|
var resolvedGroupsCount = flatData(this.currentData, gridData, groupingFooter, {
|
|
858
910
|
index: this.$props.skip || 0
|
|
859
911
|
}, this.$props.group !== undefined, this.$props.expandField);
|
|
912
|
+
var children = defaultSlot || [];
|
|
860
913
|
var notHiddenColumns = this.$props.columns ? this.$props.columns.filter(function (column) {
|
|
861
914
|
return !column.hidden;
|
|
862
915
|
}) : this.$props.columns;
|
|
@@ -1698,7 +1751,8 @@ var GridVue2 = {
|
|
|
1698
1751
|
key: detailRowId,
|
|
1699
1752
|
"class": isAlt ? 'k-table-row k-table-alt-row k-detail-row k-alt' : 'k-table-row k-detail-row',
|
|
1700
1753
|
style: {
|
|
1701
|
-
visibility: hidden(rowIndex) ? 'hidden' : ''
|
|
1754
|
+
visibility: hidden(rowIndex) ? 'hidden' : '',
|
|
1755
|
+
height: this.$props.detailRowHeight + 'px'
|
|
1702
1756
|
},
|
|
1703
1757
|
role: "row",
|
|
1704
1758
|
attrs: this.v3 ? undefined : {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Page } from '@progress/kendo-vue-data-tools';
|
|
2
|
+
import { VirtualScrollInterface } from './interfaces/VirtualScrollInterface';
|
|
3
|
+
import { RowHeightService } from './VirtualScrollFixed';
|
|
2
4
|
/**
|
|
3
5
|
* @hidden
|
|
4
6
|
*/
|
|
5
|
-
export declare class VirtualScroll {
|
|
6
|
-
|
|
7
|
-
table: any;
|
|
7
|
+
export declare class VirtualScroll implements VirtualScrollInterface {
|
|
8
|
+
table: HTMLTableElement | null;
|
|
8
9
|
containerHeight: number;
|
|
9
10
|
topCacheCount: number;
|
|
10
11
|
attendedSkip: number;
|
|
@@ -14,10 +15,13 @@ export declare class VirtualScroll {
|
|
|
14
15
|
realSkip: number;
|
|
15
16
|
pageSize: number;
|
|
16
17
|
PageChange: (page: Page, event: any) => void;
|
|
17
|
-
|
|
18
|
-
heightContainer: any;
|
|
18
|
+
tableBodyRef: any;
|
|
19
19
|
fixedScroll: boolean;
|
|
20
20
|
askedSkip: number | undefined;
|
|
21
|
+
containerRef: any;
|
|
22
|
+
tableTransform: string;
|
|
23
|
+
rowHeightService?: RowHeightService;
|
|
24
|
+
get container(): HTMLDivElement | null;
|
|
21
25
|
private prevScrollPos;
|
|
22
26
|
private tableTranslate;
|
|
23
27
|
private scrollSyncing;
|
package/dist/es/VirtualScroll.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
var VirtualScroll = /** @class */ (function () {
|
|
5
5
|
function VirtualScroll(cached, topCacheCount) {
|
|
6
6
|
var _this = this;
|
|
7
|
+
this.table = null;
|
|
7
8
|
this.containerHeight = 0;
|
|
8
9
|
this.topCacheCount = 0; // 4;
|
|
9
10
|
this.attendedSkip = 0; // -4;
|
|
@@ -12,9 +13,9 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
12
13
|
this.scrollableVirtual = false;
|
|
13
14
|
this.realSkip = 0;
|
|
14
15
|
this.pageSize = 0;
|
|
15
|
-
this.heightContainer = null;
|
|
16
16
|
this.fixedScroll = false;
|
|
17
17
|
this.askedSkip = undefined;
|
|
18
|
+
this.tableTransform = '';
|
|
18
19
|
this.prevScrollPos = 0;
|
|
19
20
|
this.tableTranslate = 0;
|
|
20
21
|
this.scrollSyncing = false;
|
|
@@ -23,8 +24,9 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
23
24
|
return { topItemsCount: 0, topItemsHeight: 0 };
|
|
24
25
|
}
|
|
25
26
|
var screenHeight = _this.container.clientHeight;
|
|
27
|
+
var footerRowsCount = _this.container.querySelectorAll('.k-group-footer').length;
|
|
26
28
|
var itemsOnScreen = Math.ceil(screenHeight / heights[0].line);
|
|
27
|
-
var topItemsCount = Math.ceil((heights.length - itemsOnScreen) / 2);
|
|
29
|
+
var topItemsCount = Math.max(itemsOnScreen / 2, Math.ceil((heights.length - itemsOnScreen) / 2));
|
|
28
30
|
var topItemsHeight = 0;
|
|
29
31
|
for (var i = 0; i < topItemsCount; i++) {
|
|
30
32
|
topItemsHeight += heights[i].line + heights[i].acc;
|
|
@@ -32,7 +34,7 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
32
34
|
return {
|
|
33
35
|
topItemsCount: topItemsCount,
|
|
34
36
|
topItemsHeight: topItemsHeight,
|
|
35
|
-
itemsNeededOnScreen: itemsOnScreen + itemsOnScreen / 2
|
|
37
|
+
itemsNeededOnScreen: itemsOnScreen + itemsOnScreen / 2 + footerRowsCount
|
|
36
38
|
};
|
|
37
39
|
};
|
|
38
40
|
this.horizontalScrollbarHeight = function () {
|
|
@@ -47,13 +49,20 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
47
49
|
}
|
|
48
50
|
this.scrollHandler = this.scrollHandler.bind(this);
|
|
49
51
|
}
|
|
52
|
+
Object.defineProperty(VirtualScroll.prototype, "container", {
|
|
53
|
+
get: function () {
|
|
54
|
+
return this.containerRef;
|
|
55
|
+
},
|
|
56
|
+
enumerable: false,
|
|
57
|
+
configurable: true
|
|
58
|
+
});
|
|
50
59
|
Object.defineProperty(VirtualScroll.prototype, "rowHeights", {
|
|
51
60
|
/**
|
|
52
61
|
* @return - The row heights in an array.
|
|
53
62
|
*/
|
|
54
63
|
get: function () {
|
|
55
64
|
var result = [];
|
|
56
|
-
var allRows = this.
|
|
65
|
+
var allRows = this.tableBodyRef && this.tableBodyRef.children || [];
|
|
57
66
|
var accumulate = 0;
|
|
58
67
|
for (var i = 0; i < allRows.length; i++) {
|
|
59
68
|
if (allRows[i].className.indexOf('k-grouping-row') > -1) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Page } from '@progress/kendo-vue-data-tools';
|
|
2
|
+
import { VirtualScrollInterface } from './interfaces/VirtualScrollInterface';
|
|
3
|
+
import { DataItemWrapper } from './utils/main';
|
|
4
|
+
/**
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
export declare class RowHeightService {
|
|
8
|
+
private total;
|
|
9
|
+
private offsets;
|
|
10
|
+
private heights;
|
|
11
|
+
constructor(total: number, rowHeight: number, detailRowHeight: number, data?: DataItemWrapper[]);
|
|
12
|
+
height(rowIndex: number): number;
|
|
13
|
+
index(position: number): number | undefined;
|
|
14
|
+
offset(rowIndex: number): number;
|
|
15
|
+
totalHeight(): number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export declare class VirtualScrollFixed implements VirtualScrollInterface {
|
|
21
|
+
table: HTMLTableElement | null;
|
|
22
|
+
containerHeight: number;
|
|
23
|
+
topCacheCount: number;
|
|
24
|
+
attendedSkip: number;
|
|
25
|
+
propsSkip: number;
|
|
26
|
+
total: number;
|
|
27
|
+
scrollableVirtual: boolean;
|
|
28
|
+
realSkip: number;
|
|
29
|
+
pageSize: number;
|
|
30
|
+
PageChange: ((event: Page, evnet: any) => void) | null;
|
|
31
|
+
tableBodyRef: any;
|
|
32
|
+
fixedScroll: boolean;
|
|
33
|
+
askedSkip: number | undefined;
|
|
34
|
+
containerRef: any;
|
|
35
|
+
tableTransform: string;
|
|
36
|
+
rowHeightService?: RowHeightService;
|
|
37
|
+
private scrollSyncing;
|
|
38
|
+
private lastLoaded;
|
|
39
|
+
private firstLoaded;
|
|
40
|
+
private lastScrollTop;
|
|
41
|
+
get container(): HTMLDivElement | null;
|
|
42
|
+
constructor(_cached: boolean);
|
|
43
|
+
translate(dY: number): void;
|
|
44
|
+
changePage(skip: number, e: any): void;
|
|
45
|
+
reset(): void;
|
|
46
|
+
scrollHandler(e: any): void;
|
|
47
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
var RowHeightService = /** @class */ (function () {
|
|
5
|
+
function RowHeightService(total, rowHeight, detailRowHeight, data) {
|
|
6
|
+
if (total === void 0) { total = 0; }
|
|
7
|
+
this.total = total;
|
|
8
|
+
this.offsets = [];
|
|
9
|
+
this.heights = [];
|
|
10
|
+
var agg = 0;
|
|
11
|
+
for (var idx = 0; idx < total; idx++) {
|
|
12
|
+
this.offsets.push(agg);
|
|
13
|
+
var currHeight = (data && data[idx].expanded
|
|
14
|
+
&& data[idx].rowType === 'data') ? detailRowHeight : rowHeight;
|
|
15
|
+
agg += currHeight;
|
|
16
|
+
this.heights.push(currHeight);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
RowHeightService.prototype.height = function (rowIndex) {
|
|
20
|
+
return this.heights[rowIndex];
|
|
21
|
+
};
|
|
22
|
+
RowHeightService.prototype.index = function (position) {
|
|
23
|
+
if (position < 0) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
var result = this.offsets.reduce(function (prev, current, idx) {
|
|
27
|
+
if (prev !== undefined) {
|
|
28
|
+
return prev;
|
|
29
|
+
}
|
|
30
|
+
else if (current === position) {
|
|
31
|
+
return idx;
|
|
32
|
+
}
|
|
33
|
+
else if (current > position) {
|
|
34
|
+
return idx - 1;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}, undefined);
|
|
38
|
+
return result === undefined ? this.total - 1 : result;
|
|
39
|
+
};
|
|
40
|
+
RowHeightService.prototype.offset = function (rowIndex) {
|
|
41
|
+
return this.offsets[rowIndex];
|
|
42
|
+
};
|
|
43
|
+
RowHeightService.prototype.totalHeight = function () {
|
|
44
|
+
var lastOffset = this.offsets[this.offsets.length - 1];
|
|
45
|
+
var lastHeight = this.heights[this.heights.length - 1];
|
|
46
|
+
return lastOffset + lastHeight;
|
|
47
|
+
// return this.heights.reduce((prev, curr) => prev + curr, 0);
|
|
48
|
+
};
|
|
49
|
+
return RowHeightService;
|
|
50
|
+
}());
|
|
51
|
+
export { RowHeightService };
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
var VirtualScrollFixed = /** @class */ (function () {
|
|
56
|
+
function VirtualScrollFixed(_cached) {
|
|
57
|
+
this.table = null;
|
|
58
|
+
this.containerHeight = 0;
|
|
59
|
+
this.topCacheCount = 0;
|
|
60
|
+
this.attendedSkip = 0;
|
|
61
|
+
this.propsSkip = 0;
|
|
62
|
+
this.total = 0;
|
|
63
|
+
this.scrollableVirtual = false;
|
|
64
|
+
this.realSkip = 0;
|
|
65
|
+
this.pageSize = 0;
|
|
66
|
+
this.PageChange = null;
|
|
67
|
+
this.fixedScroll = false;
|
|
68
|
+
this.askedSkip = undefined;
|
|
69
|
+
this.tableTransform = '';
|
|
70
|
+
this.scrollSyncing = false;
|
|
71
|
+
this.lastLoaded = 0;
|
|
72
|
+
this.firstLoaded = 0;
|
|
73
|
+
this.lastScrollTop = 0;
|
|
74
|
+
this.firstLoaded = this.pageSize;
|
|
75
|
+
this.lastLoaded = this.realSkip + this.pageSize;
|
|
76
|
+
this.scrollHandler = this.scrollHandler.bind(this);
|
|
77
|
+
}
|
|
78
|
+
Object.defineProperty(VirtualScrollFixed.prototype, "container", {
|
|
79
|
+
get: function () {
|
|
80
|
+
return this.containerRef;
|
|
81
|
+
},
|
|
82
|
+
enumerable: false,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
VirtualScrollFixed.prototype.translate = function (dY) {
|
|
86
|
+
if (this.scrollableVirtual && this.table) {
|
|
87
|
+
this.table.style.transform = 'translateY(' + dY + 'px)';
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
VirtualScrollFixed.prototype.changePage = function (skip, e) {
|
|
91
|
+
if (this.PageChange) {
|
|
92
|
+
this.PageChange({ skip: Math.max(0, skip), take: this.pageSize }, e);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
VirtualScrollFixed.prototype.reset = function () {
|
|
96
|
+
this.scrollSyncing = true;
|
|
97
|
+
if (this.fixedScroll) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (this.container) {
|
|
101
|
+
this.container.scrollTop = 0;
|
|
102
|
+
}
|
|
103
|
+
this.translate(0);
|
|
104
|
+
};
|
|
105
|
+
VirtualScrollFixed.prototype.scrollHandler = function (e) {
|
|
106
|
+
if (!this.scrollableVirtual || !this.container || !this.table ||
|
|
107
|
+
!this.rowHeightService || !this.containerRef) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (this.scrollSyncing) {
|
|
111
|
+
this.scrollSyncing = false;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var scrollTop = this.container.scrollTop;
|
|
115
|
+
var up = this.lastScrollTop >= scrollTop;
|
|
116
|
+
var down = !up;
|
|
117
|
+
this.lastScrollTop = scrollTop;
|
|
118
|
+
var firstItemIndex = this.rowHeightService.index(scrollTop);
|
|
119
|
+
var firstItemOffset = this.rowHeightService.offset(firstItemIndex);
|
|
120
|
+
var offsetHeight = this.containerRef.offsetHeight;
|
|
121
|
+
var lastItemIndex = this.rowHeightService.index(scrollTop + offsetHeight);
|
|
122
|
+
if (down && lastItemIndex >= this.lastLoaded && this.lastLoaded < this.total) {
|
|
123
|
+
var overflow = (firstItemIndex + this.pageSize) - this.total;
|
|
124
|
+
if (overflow > 0) {
|
|
125
|
+
firstItemIndex = firstItemIndex - overflow;
|
|
126
|
+
firstItemOffset = this.rowHeightService.offset(firstItemIndex);
|
|
127
|
+
}
|
|
128
|
+
this.firstLoaded = firstItemIndex;
|
|
129
|
+
this.translate(firstItemOffset);
|
|
130
|
+
var nextTake = this.firstLoaded + this.pageSize;
|
|
131
|
+
this.lastLoaded = Math.min(nextTake, this.total);
|
|
132
|
+
this.changePage(this.firstLoaded, e);
|
|
133
|
+
}
|
|
134
|
+
else if (up && firstItemIndex < this.firstLoaded) {
|
|
135
|
+
var nonVisibleBuffer = Math.floor(this.pageSize * 0.3);
|
|
136
|
+
this.firstLoaded = Math.max(firstItemIndex - nonVisibleBuffer, 0);
|
|
137
|
+
this.translate(this.rowHeightService.offset(this.firstLoaded));
|
|
138
|
+
this.lastLoaded = Math.min(this.firstLoaded + this.pageSize, this.total);
|
|
139
|
+
this.changePage(this.firstLoaded, e);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return VirtualScrollFixed;
|
|
143
|
+
}());
|
|
144
|
+
export { VirtualScrollFixed };
|
|
@@ -222,6 +222,10 @@ export interface GridProps {
|
|
|
222
222
|
* ([see example]({% slug scrollmmodes_grid %})).
|
|
223
223
|
*/
|
|
224
224
|
rowHeight?: number;
|
|
225
|
+
/**
|
|
226
|
+
* @hidden
|
|
227
|
+
*/
|
|
228
|
+
detailRowHeight?: number;
|
|
225
229
|
/**
|
|
226
230
|
* Specifies a custom rendering that will be cloned and rendered inside the detail rows
|
|
227
231
|
* of the currently expanded items ([see example]({% slug master_detail_grid %}).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Page } from '@progress/kendo-vue-data-tools';
|
|
2
|
+
import { RowHeightService } from '../VirtualScrollFixed';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
export interface VirtualScrollInterface {
|
|
7
|
+
PageChange: ((page: Page, e: any) => void) | null;
|
|
8
|
+
reset: () => void;
|
|
9
|
+
askedSkip: number | undefined;
|
|
10
|
+
total: number;
|
|
11
|
+
table: HTMLTableElement | null;
|
|
12
|
+
tableBodyRef: any;
|
|
13
|
+
fixedScroll: boolean;
|
|
14
|
+
realSkip: number;
|
|
15
|
+
pageSize: number;
|
|
16
|
+
scrollableVirtual: boolean;
|
|
17
|
+
propsSkip: number;
|
|
18
|
+
topCacheCount: number;
|
|
19
|
+
attendedSkip: number;
|
|
20
|
+
containerHeight: number;
|
|
21
|
+
containerRef: any;
|
|
22
|
+
tableTransform: string;
|
|
23
|
+
rowHeightService?: RowHeightService;
|
|
24
|
+
get container(): HTMLDivElement | null;
|
|
25
|
+
scrollHandler(e: any): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-vue-grid',
|
|
6
6
|
productName: 'Kendo UI for Vue',
|
|
7
7
|
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1677087515,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
|
|
11
11
|
};
|
package/dist/es/utils/main.d.ts
CHANGED
|
@@ -89,3 +89,11 @@ export declare function applyExpandedState(sdata: DataResult, collapsed: any[],
|
|
|
89
89
|
* @hidden
|
|
90
90
|
*/
|
|
91
91
|
export declare function groupedFirstItemValue(item: any, field: string): any;
|
|
92
|
+
/**
|
|
93
|
+
* @hidden
|
|
94
|
+
*/
|
|
95
|
+
export declare const firefox: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* @hidden
|
|
98
|
+
*/
|
|
99
|
+
export declare const firefoxMaxHeight = 17895697;
|
package/dist/es/utils/main.js
CHANGED
|
@@ -391,3 +391,12 @@ export function groupedFirstItemValue(item, field) {
|
|
|
391
391
|
}
|
|
392
392
|
return field ? resultItem[field] : item.value;
|
|
393
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* @hidden
|
|
396
|
+
*/
|
|
397
|
+
export var firefox = typeof window !== 'undefined' &&
|
|
398
|
+
/Firefox/.test(window.navigator.userAgent);
|
|
399
|
+
/**
|
|
400
|
+
* @hidden
|
|
401
|
+
*/
|
|
402
|
+
export var firefoxMaxHeight = 17895697;
|
package/dist/esm/Grid.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } fr
|
|
|
6
6
|
import { Page, TableKeyboardNavigationContextType, TableKeyboardNavigationStateType } from '@progress/kendo-vue-data-tools';
|
|
7
7
|
import { ExtendedColumnProps } from './interfaces/ExtendedColumnProps';
|
|
8
8
|
import { SortDescriptor, CompositeFilterDescriptor, GroupDescriptor, State } from '@progress/kendo-data-query';
|
|
9
|
-
import {
|
|
9
|
+
import { VirtualScrollInterface } from './interfaces/VirtualScrollInterface';
|
|
10
10
|
import { ColumnResize } from './drag/ColumnResize';
|
|
11
11
|
import { CommonDragLogic } from './drag/CommonDragLogic';
|
|
12
12
|
import { DataItemWrapper } from './utils/main';
|
|
@@ -120,10 +120,14 @@ export interface GridData {
|
|
|
120
120
|
export interface GridState {
|
|
121
121
|
initialHeight: String | null;
|
|
122
122
|
dragLogic: CommonDragLogic;
|
|
123
|
-
|
|
123
|
+
slicedCurrentData: Array<DataItemWrapper> | undefined;
|
|
124
|
+
containerRef: any;
|
|
125
|
+
tableBodyRef: any;
|
|
126
|
+
vs: VirtualScrollInterface;
|
|
124
127
|
columnResize: ColumnResize;
|
|
125
128
|
_gridId: string;
|
|
126
129
|
v3: boolean;
|
|
130
|
+
_prevTotal: number | undefined;
|
|
127
131
|
}
|
|
128
132
|
/**
|
|
129
133
|
* @hidden
|