@progress/kendo-vue-grid 3.0.4 → 3.0.5

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
@@ -131,6 +131,8 @@ export interface GridState {
131
131
  export interface GridComputed {
132
132
  [key: string]: any;
133
133
  getCorrectHeight: any;
134
+ currentGroupable: boolean;
135
+ computedCollapsed: any[][];
134
136
  }
135
137
  /**
136
138
  * @hidden
package/dist/es/Grid.js CHANGED
@@ -69,7 +69,7 @@ import { ColumnResize } from './drag/ColumnResize';
69
69
  import { CommonDragLogic } from './drag/CommonDragLogic';
70
70
  import { DragClue } from './drag/DragClue';
71
71
  import { DropClue } from './drag/DropClue';
72
- import { getNestedValue, flatData, mapColumns, readColumns, autoGenerateColumns } from './utils/index';
72
+ import { getNestedValue, flatData, mapColumns, readColumns, autoGenerateColumns, applyExpandedState, groupedFirstItemValue } from './utils/index';
73
73
  import { GridCell } from './cells/GridCell';
74
74
  import { GridGroupCell } from './cells/GridGroupCell';
75
75
  import { GridRow } from './rows/GridRow';
@@ -84,6 +84,19 @@ import { pagerMessagesMap } from './messages';
84
84
  var GridVue2 = {
85
85
  name: 'KendoGrid',
86
86
  props: {
87
+ topCacheCount: {
88
+ type: Number,
89
+ default: 0
90
+ },
91
+ collapsedGroups: {
92
+ type: Array,
93
+ default: function _default() {
94
+ return [];
95
+ }
96
+ },
97
+ uniqueField: String,
98
+ totalGroupedHeight: Number,
99
+ allGroupedItems: Object,
87
100
  alternatePerGroup: Boolean,
88
101
  columns: Array,
89
102
  columnVirtualization: Boolean,
@@ -154,8 +167,8 @@ var GridVue2 = {
154
167
  validatePackage(packageMetadata);
155
168
  this.initialHeight = null;
156
169
  this._columns = [];
157
- var groupable = this.$props.groupable === true || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
158
- this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
170
+ var groupable = this.currentGroupable;
171
+ this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
159
172
  this.dragLogic = new CommonDragLogic(this.columnReorder.bind(this), this.groupReorder.bind(this), this.columnToGroup.bind(this));
160
173
  this.columnResize = new ColumnResize(this.onResize.bind(this));
161
174
  this._columnsMap = [[]];
@@ -192,6 +205,24 @@ var GridVue2 = {
192
205
  return null;
193
206
  }
194
207
  }
208
+ },
209
+ currentGroupable: function currentGroupable() {
210
+ return this.$props.groupable === true && this.$props.group && this.$props.group.length || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
211
+ },
212
+ computedCollapsed: function computedCollapsed() {
213
+ var newCollapsed = [];
214
+
215
+ if (this.$props.group) {
216
+ for (var i = 0; i < this.$props.group.length; i++) {
217
+ if (this.$props.collapsedGroups[i]) {
218
+ newCollapsed.push(this.$props.collapsedGroups[i]);
219
+ } else {
220
+ newCollapsed.push([]);
221
+ }
222
+ }
223
+ }
224
+
225
+ return newCollapsed;
195
226
  }
196
227
  },
197
228
  methods: {
@@ -285,16 +316,16 @@ var GridVue2 = {
285
316
  }
286
317
  },
287
318
  onTotalChanged: function onTotalChanged(_value, _oldValue) {
288
- var groupable = this.$props.groupable === true || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
319
+ var groupable = this.currentGroupable;
289
320
  this.vs.reset();
290
- this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
321
+ this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
291
322
  this.resetVirtual();
292
323
  this.setRefs();
293
324
  },
294
325
  onRowHeightChanged: function onRowHeightChanged(_value, _oldValue) {
295
- var groupable = this.$props.groupable === true || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
326
+ var groupable = this.currentGroupable;
296
327
  this.vs.reset();
297
- this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
328
+ this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
298
329
  this.resetVirtual();
299
330
  this.setRefs();
300
331
  },
@@ -337,6 +368,31 @@ var GridVue2 = {
337
368
  }, this.getArguments(e)));
338
369
  }
339
370
  },
371
+ updateGroupCollapsed: function updateGroupCollapsed(event) {
372
+ var collapsed = this.computedCollapsed;
373
+ var collapsedLevel = collapsed[event.level];
374
+ var uniqueItemValue = groupedFirstItemValue(event.dataItem, this.$props.uniqueField);
375
+
376
+ if (event.value) {
377
+ if (collapsedLevel && collapsedLevel.length) {
378
+ var expandedIndex = collapsedLevel.indexOf(uniqueItemValue);
379
+
380
+ if (expandedIndex > -1) {
381
+ collapsedLevel.splice(expandedIndex, 1);
382
+ }
383
+ }
384
+ } else {
385
+ if (collapsedLevel) {
386
+ if (!collapsedLevel.includes(uniqueItemValue)) {
387
+ collapsedLevel.push(uniqueItemValue);
388
+ }
389
+ } else {
390
+ collapsedLevel = [uniqueItemValue];
391
+ }
392
+ }
393
+
394
+ return collapsed;
395
+ },
340
396
  itemChange: function itemChange(event) {
341
397
  var itemChange = hasListener.call(this, 'itemchange');
342
398
 
@@ -345,6 +401,7 @@ var GridVue2 = {
345
401
 
346
402
  if (expandChange) {
347
403
  this.$emit('expandchange', __assign(__assign({}, this.getArguments(event.event)), {
404
+ collapsedGroups: this.updateGroupCollapsed(event),
348
405
  dataItem: event.dataItem,
349
406
  value: event.value
350
407
  }));
@@ -711,6 +768,10 @@ var GridVue2 = {
711
768
  if (item.expanded !== false && item.items) {
712
769
  allRowsCount = _this.addSubItems(item.items, allRowsCount);
713
770
  }
771
+
772
+ if (_this.$props.groupable.footer === 'always' || item.expanded !== false && _this.$props.groupable.footer === 'visible') {
773
+ allRowsCount++;
774
+ }
714
775
  });
715
776
  return allRowsCount;
716
777
  }
@@ -757,7 +818,7 @@ var GridVue2 = {
757
818
  if (Array.isArray(this.$props.dataItems)) {
758
819
  gridData = this.$props.dataItems;
759
820
  } else if (this.$props.dataItems) {
760
- gridData = this.$props.dataItems.data;
821
+ gridData = applyExpandedState(this.$props.dataItems, this.computedCollapsed, this.$props.uniqueField).data;
761
822
  total = total || this.$props.dataItems.total;
762
823
  }
763
824
 
@@ -768,10 +829,17 @@ var GridVue2 = {
768
829
  this.resetVirtual();
769
830
  this.vs.total = total;
770
831
 
771
- if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !groupable) {
832
+ if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !this.currentGroupable) {
772
833
  this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * (total || 0));
773
834
  } else {
774
- this.vs.containerHeight = 1533915; // this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * this.totalGroupedRows(gridData));
835
+ if (this.$props.totalGroupedHeight) {
836
+ this.vs.containerHeight = Math.min(1533915, this.$props.totalGroupedHeight);
837
+ } else if (this.$props.allGroupedItems && this.$props.allGroupedItems.data) {
838
+ var allGroupedTotal = this.totalGroupedRows(applyExpandedState(this.$props.allGroupedItems, this.computedCollapsed, this.$props.uniqueField).data);
839
+ this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * allGroupedTotal);
840
+ } else {
841
+ this.vs.containerHeight = 1533915;
842
+ }
775
843
  }
776
844
 
777
845
  var children = defaultSlot || [];
@@ -1170,6 +1238,11 @@ var GridVue2 = {
1170
1238
  columnCellRenderFunction = templateRendering.call(this, column.cell, getListeners.call(this));
1171
1239
  }
1172
1240
 
1241
+ var isCollapsed = this.computedCollapsed && this.computedCollapsed[item.level] && this.computedCollapsed[item.level].some(function (c) {
1242
+ return c === groupedFirstItemValue(item.dataItem, _this.$props.uniqueField);
1243
+ });
1244
+ var isExpanded = isCollapsed ? !isCollapsed : item.expanded;
1245
+
1173
1246
  if (column.internalCell) {
1174
1247
  return h(column.internalCell, {
1175
1248
  key: index,
@@ -1190,7 +1263,7 @@ var GridVue2 = {
1190
1263
  }).length,
1191
1264
  rowType: item.rowType,
1192
1265
  level: item.level,
1193
- expanded: item.expanded,
1266
+ expanded: isExpanded,
1194
1267
  dataIndex: item.dataIndex,
1195
1268
  ariaColumnIndex: column.ariaColumnIndex,
1196
1269
  isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(index) > -1
@@ -1229,7 +1302,7 @@ var GridVue2 = {
1229
1302
  }).length,
1230
1303
  rowType: item.rowType,
1231
1304
  level: item.level,
1232
- expanded: item.expanded,
1305
+ expanded: isExpanded,
1233
1306
  dataIndex: item.dataIndex,
1234
1307
  style: style,
1235
1308
  ariaColumnIndex: column.ariaColumnIndex,
@@ -1258,7 +1331,7 @@ var GridVue2 = {
1258
1331
  }).length,
1259
1332
  rowType: item.rowType,
1260
1333
  level: item.level,
1261
- expanded: item.expanded,
1334
+ expanded: isExpanded,
1262
1335
  dataIndex: item.dataIndex
1263
1336
  },
1264
1337
  key: index,
@@ -1288,7 +1361,7 @@ var GridVue2 = {
1288
1361
  }).length,
1289
1362
  rowType: item.rowType,
1290
1363
  level: item.level,
1291
- expanded: item.expanded,
1364
+ expanded: isExpanded,
1292
1365
  dataIndex: item.dataIndex,
1293
1366
  style: style
1294
1367
  });
@@ -1315,7 +1388,7 @@ var GridVue2 = {
1315
1388
  }).length,
1316
1389
  rowType: item.rowType,
1317
1390
  level: item.level,
1318
- expanded: item.expanded,
1391
+ expanded: isExpanded,
1319
1392
  dataIndex: item.dataIndex
1320
1393
  },
1321
1394
  colSpan: colSpans[index],
@@ -1364,7 +1437,7 @@ var GridVue2 = {
1364
1437
  }).length,
1365
1438
  rowType: item.rowType,
1366
1439
  level: item.level,
1367
- expanded: item.expanded,
1440
+ expanded: isExpanded,
1368
1441
  dataIndex: item.dataIndex,
1369
1442
  style: style
1370
1443
  });
@@ -1377,8 +1450,10 @@ var GridVue2 = {
1377
1450
 
1378
1451
  var hiddenRows = 0;
1379
1452
 
1380
- if (this.$props.scrollable === 'virtual') {
1381
- for (var i = 0; i < this.vs.topCacheCount + this.vs.attendedSkip - (this.$props.skip || 0); i++) {
1453
+ if (this.$props.scrollable === 'virtual' && this.totalGroupedRows(this.currentData) / 2 > this.$props.take) {
1454
+ var topIndex = this.vs.topCacheCount + this.vs.attendedSkip - (this.$props.skip || 0);
1455
+
1456
+ for (var i = 0; i < topIndex; i++) {
1382
1457
  var item = this.currentData.shift();
1383
1458
 
1384
1459
  if (item) {
@@ -22,7 +22,7 @@ export declare class VirtualScroll {
22
22
  private syncTimeout;
23
23
  private tableTranslate;
24
24
  private scrollSyncing;
25
- constructor(cached: boolean);
25
+ constructor(cached: boolean, topCacheCount: number);
26
26
  /**
27
27
  * @return - The row heights in an array.
28
28
  */
@@ -2,7 +2,7 @@
2
2
  * @hidden
3
3
  */
4
4
  var VirtualScroll = /** @class */ (function () {
5
- function VirtualScroll(cached) {
5
+ function VirtualScroll(cached, topCacheCount) {
6
6
  this.containerHeight = 0;
7
7
  this.topCacheCount = 0; // 4;
8
8
  this.attendedSkip = 0; // -4;
@@ -18,7 +18,7 @@ var VirtualScroll = /** @class */ (function () {
18
18
  this.tableTranslate = 0;
19
19
  this.scrollSyncing = false;
20
20
  if (cached) {
21
- this.topCacheCount = 4;
21
+ this.topCacheCount = topCacheCount;
22
22
  this.attendedSkip = -this.topCacheCount;
23
23
  }
24
24
  this.scrollHandler = this.scrollHandler.bind(this);
@@ -47,6 +47,12 @@ var VirtualScroll = /** @class */ (function () {
47
47
  accumulate = 0;
48
48
  }
49
49
  }
50
+ if (allRows.length && !result.length) {
51
+ result.push({
52
+ line: allRows[0].scrollHeight,
53
+ acc: accumulate
54
+ });
55
+ }
50
56
  return result;
51
57
  },
52
58
  enumerable: false,
@@ -61,6 +61,7 @@ var GridGroupCellVue2 = {
61
61
  dataItem: this.$props.dataItem,
62
62
  dataIndex: this.$props.dataIndex,
63
63
  event: event,
64
+ level: this.$props.level,
64
65
  field: undefined,
65
66
  value: !expanded
66
67
  });
@@ -72,6 +73,7 @@ var GridGroupCellVue2 = {
72
73
  dataItem: dataItem,
73
74
  dataIndex: this.$props.dataIndex,
74
75
  event: e,
76
+ level: this.$props.level,
75
77
  field: undefined,
76
78
  value: !expanded
77
79
  });
@@ -276,6 +276,26 @@ export interface GridProps {
276
276
  * By default, navigation is disabled and the Grid content is accessible in the normal tab sequence.
277
277
  */
278
278
  navigatable?: boolean;
279
+ /**
280
+ * Passes the number of cached top items needed for the grouping virtualization scenario. Defaults to 4.
281
+ */
282
+ topCacheCount?: Number;
283
+ /**
284
+ * Passes the calculated height of all the items in the Grid grouped hierarchy.
285
+ */
286
+ totalGroupedHeight?: Number;
287
+ /**
288
+ * Passes the collection of all grouped items that is needed for the virtualization scenario.
289
+ */
290
+ allGroupedItems?: any[];
291
+ /**
292
+ * Passes the collection of all collapsed groups for every grouped level.
293
+ */
294
+ collapsedGroups?: any[][];
295
+ /**
296
+ * Specifies the name of the field which will provide a unique for every item identifier.
297
+ */
298
+ uniqueField?: string;
279
299
  /**
280
300
  * Fires when Grid keyboard navigation position is changed.
281
301
  */
@@ -62,6 +62,10 @@ export interface GridGroupChangeEvent extends GridEvent {
62
62
  * Represents the object of the `onExpandChange` event.
63
63
  */
64
64
  export interface GridExpandChangeEvent extends GridEvent {
65
+ /**
66
+ * The array with collapsed groups.
67
+ */
68
+ collapsed?: string[];
65
69
  /**
66
70
  * The data item that is expanded or collapsed.
67
71
  */
package/dist/es/main.d.ts CHANGED
@@ -34,4 +34,5 @@ import { GridGroupableSettings } from './interfaces/GridGroupableSettings';
34
34
  import { GridColumnMenuItem, GridColumnMenuItemVue2 } from './columnMenu/GridColumnMenuItem';
35
35
  import { GridColumnMenuItemContent, GridColumnMenuItemContentVue2 } from './columnMenu/GridColumnMenuItemContent';
36
36
  import { GridColumnMenuItemGroup, GridColumnMenuItemGroupVue2 } from './columnMenu/GridColumnMenuItemGroup';
37
+ export * from './utils/index';
37
38
  export { Grid, GridVue2, GridProps, GridColumnProps, GridCellProps, GridCell, GridCellVue2, GridEditCell, GridEditCellVue2, GridGroupCell, GridHierarchyCell, GridGroupCellVue2, GridHierarchyCellVue2, GridDetailRow, GridDetailRowVue2, GridDetailRowProps, GridRow, GridRowVue2, GridRowProps, GridFilterCell, GridFilterCellVue2, GridFilterCellProps, GridHeaderCell, GridHeaderCellVue2, GridHeaderCellProps, Footer, FooterRow, FooterVue2, FooterRowVue2, GridFooterCellProps, GridColumnMenuProps, GridColumnMenuSort, GridColumnMenuSortVue2, sortGroupByField, GridColumnMenuFilter, GridColumnMenuFilterVue2, filterGroupByField, GridColumnMenuItem, GridColumnMenuItemVue2, GridColumnMenuItemContent, GridColumnMenuItemContentVue2, GridColumnMenuItemGroup, GridColumnMenuItemGroupVue2, GridColumnMenuFilterUI, GridColumnMenuFilterUIVue2, GridColumnMenuFilterCell, GridColumnMenuFilterCellVue2, GridColumnMenuCheckboxFilter, GridColumnMenuCheckboxFilterVue2, GridColumnMenuCheckboxFilterProps, GridToolbar, GridToolbarVue2, GridToolbarProps, GridNoRecords, GridNoRecordsVue2, GridNoRecordsProps, GridSortSettings, GridPagerSettings, GridGroupableSettings, GridPageChangeEvent, GridDataStateChangeEvent, GridFilterChangeEvent, GridSortChangeEvent, GridExpandChangeEvent, GridSelectionChangeEvent, GridItemChangeEvent, GridHeaderSelectionChangeEvent, GridRowClickEvent, GridColumnResizeEvent, GridColumnReorderEvent, GridGroupChangeEvent };
package/dist/es/main.js CHANGED
@@ -19,6 +19,7 @@ import { GridNoRecords, GridNoRecordsVue2 } from './GridNoRecords';
19
19
  import { GridColumnMenuItem, GridColumnMenuItemVue2 } from './columnMenu/GridColumnMenuItem';
20
20
  import { GridColumnMenuItemContent, GridColumnMenuItemContentVue2 } from './columnMenu/GridColumnMenuItemContent';
21
21
  import { GridColumnMenuItemGroup, GridColumnMenuItemGroupVue2 } from './columnMenu/GridColumnMenuItemGroup';
22
+ export * from './utils/index';
22
23
  export { Grid, GridVue2, GridCell, GridCellVue2, GridEditCell, GridEditCellVue2, GridGroupCell, GridHierarchyCell, GridGroupCellVue2, GridHierarchyCellVue2, GridDetailRow, GridDetailRowVue2, GridRow, GridRowVue2, GridFilterCell, GridFilterCellVue2, GridHeaderCell, GridHeaderCellVue2, Footer, FooterRow, FooterVue2, FooterRowVue2, GridColumnMenuSort, GridColumnMenuSortVue2, sortGroupByField, GridColumnMenuFilter, GridColumnMenuFilterVue2, filterGroupByField, GridColumnMenuItem, GridColumnMenuItemVue2, GridColumnMenuItemContent, GridColumnMenuItemContentVue2, GridColumnMenuItemGroup, GridColumnMenuItemGroupVue2, GridColumnMenuFilterUI, GridColumnMenuFilterUIVue2, GridColumnMenuFilterCell, GridColumnMenuFilterCellVue2, GridColumnMenuCheckboxFilter, GridColumnMenuCheckboxFilterVue2, GridToolbar, GridToolbarVue2, GridNoRecords, GridNoRecordsVue2 };
23
24
  // Automatic installation if Vue has been added to the global scope.
24
25
  var vue = 'Vue';
@@ -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: 1643723751,
8
+ publishDate: 1644395798,
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
  };
@@ -81,3 +81,11 @@ export declare const parsers: {
81
81
  string: (value: any) => any;
82
82
  default: (value: any) => any;
83
83
  };
84
+ /**
85
+ * @hidden
86
+ */
87
+ export declare function applyExpandedState(sdata: DataResult, collapsed: any[], uniqueField: string): DataResult;
88
+ /**
89
+ * @hidden
90
+ */
91
+ export declare function groupedFirstItemValue(item: any, field: string): any;
@@ -353,3 +353,39 @@ export var parsers = {
353
353
  return value;
354
354
  }
355
355
  };
356
+ /**
357
+ * @hidden
358
+ */
359
+ function updateItemsExpanded(items, collapsed, uniqueField, level) {
360
+ items.forEach(function (di) {
361
+ di.expanded = collapsed[level] && !collapsed[level].includes(groupedFirstItemValue(di, uniqueField));
362
+ if (di.items && di.items.length) {
363
+ di.items = updateItemsExpanded(di.items, collapsed, uniqueField, level + 1);
364
+ }
365
+ });
366
+ return items;
367
+ }
368
+ /**
369
+ * @hidden
370
+ */
371
+ export function applyExpandedState(sdata, collapsed, uniqueField) {
372
+ if (collapsed && collapsed.length) {
373
+ sdata.data.forEach(function (di) {
374
+ di.expanded = collapsed[0] && !collapsed[0].includes(groupedFirstItemValue(di, uniqueField));
375
+ if (di.items && di.items.length) {
376
+ di.items = updateItemsExpanded(di.items, collapsed, uniqueField, 1);
377
+ }
378
+ });
379
+ }
380
+ return sdata;
381
+ }
382
+ /**
383
+ * @hidden
384
+ */
385
+ export function groupedFirstItemValue(item, field) {
386
+ var resultItem = item;
387
+ while (resultItem.items && resultItem.items.length) {
388
+ resultItem = resultItem.items[0];
389
+ }
390
+ return field ? resultItem[field] : item.value;
391
+ }
@@ -131,6 +131,8 @@ export interface GridState {
131
131
  export interface GridComputed {
132
132
  [key: string]: any;
133
133
  getCorrectHeight: any;
134
+ currentGroupable: boolean;
135
+ computedCollapsed: any[][];
134
136
  }
135
137
  /**
136
138
  * @hidden
package/dist/npm/Grid.js CHANGED
@@ -120,6 +120,19 @@ var messages_1 = require("./messages");
120
120
  var GridVue2 = {
121
121
  name: 'KendoGrid',
122
122
  props: {
123
+ topCacheCount: {
124
+ type: Number,
125
+ default: 0
126
+ },
127
+ collapsedGroups: {
128
+ type: Array,
129
+ default: function _default() {
130
+ return [];
131
+ }
132
+ },
133
+ uniqueField: String,
134
+ totalGroupedHeight: Number,
135
+ allGroupedItems: Object,
123
136
  alternatePerGroup: Boolean,
124
137
  columns: Array,
125
138
  columnVirtualization: Boolean,
@@ -190,8 +203,8 @@ var GridVue2 = {
190
203
  kendo_vue_common_1.validatePackage(package_metadata_1.packageMetadata);
191
204
  this.initialHeight = null;
192
205
  this._columns = [];
193
- var groupable = this.$props.groupable === true || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
194
- this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
206
+ var groupable = this.currentGroupable;
207
+ this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
195
208
  this.dragLogic = new CommonDragLogic_1.CommonDragLogic(this.columnReorder.bind(this), this.groupReorder.bind(this), this.columnToGroup.bind(this));
196
209
  this.columnResize = new ColumnResize_1.ColumnResize(this.onResize.bind(this));
197
210
  this._columnsMap = [[]];
@@ -228,6 +241,24 @@ var GridVue2 = {
228
241
  return null;
229
242
  }
230
243
  }
244
+ },
245
+ currentGroupable: function currentGroupable() {
246
+ return this.$props.groupable === true && this.$props.group && this.$props.group.length || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
247
+ },
248
+ computedCollapsed: function computedCollapsed() {
249
+ var newCollapsed = [];
250
+
251
+ if (this.$props.group) {
252
+ for (var i = 0; i < this.$props.group.length; i++) {
253
+ if (this.$props.collapsedGroups[i]) {
254
+ newCollapsed.push(this.$props.collapsedGroups[i]);
255
+ } else {
256
+ newCollapsed.push([]);
257
+ }
258
+ }
259
+ }
260
+
261
+ return newCollapsed;
231
262
  }
232
263
  },
233
264
  methods: {
@@ -321,16 +352,16 @@ var GridVue2 = {
321
352
  }
322
353
  },
323
354
  onTotalChanged: function onTotalChanged(_value, _oldValue) {
324
- var groupable = this.$props.groupable === true || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
355
+ var groupable = this.currentGroupable;
325
356
  this.vs.reset();
326
- this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
357
+ this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
327
358
  this.resetVirtual();
328
359
  this.setRefs();
329
360
  },
330
361
  onRowHeightChanged: function onRowHeightChanged(_value, _oldValue) {
331
- var groupable = this.$props.groupable === true || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
362
+ var groupable = this.currentGroupable;
332
363
  this.vs.reset();
333
- this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
364
+ this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
334
365
  this.resetVirtual();
335
366
  this.setRefs();
336
367
  },
@@ -373,6 +404,31 @@ var GridVue2 = {
373
404
  }, this.getArguments(e)));
374
405
  }
375
406
  },
407
+ updateGroupCollapsed: function updateGroupCollapsed(event) {
408
+ var collapsed = this.computedCollapsed;
409
+ var collapsedLevel = collapsed[event.level];
410
+ var uniqueItemValue = index_1.groupedFirstItemValue(event.dataItem, this.$props.uniqueField);
411
+
412
+ if (event.value) {
413
+ if (collapsedLevel && collapsedLevel.length) {
414
+ var expandedIndex = collapsedLevel.indexOf(uniqueItemValue);
415
+
416
+ if (expandedIndex > -1) {
417
+ collapsedLevel.splice(expandedIndex, 1);
418
+ }
419
+ }
420
+ } else {
421
+ if (collapsedLevel) {
422
+ if (!collapsedLevel.includes(uniqueItemValue)) {
423
+ collapsedLevel.push(uniqueItemValue);
424
+ }
425
+ } else {
426
+ collapsedLevel = [uniqueItemValue];
427
+ }
428
+ }
429
+
430
+ return collapsed;
431
+ },
376
432
  itemChange: function itemChange(event) {
377
433
  var itemChange = kendo_vue_common_1.hasListener.call(this, 'itemchange');
378
434
 
@@ -381,6 +437,7 @@ var GridVue2 = {
381
437
 
382
438
  if (expandChange) {
383
439
  this.$emit('expandchange', __assign(__assign({}, this.getArguments(event.event)), {
440
+ collapsedGroups: this.updateGroupCollapsed(event),
384
441
  dataItem: event.dataItem,
385
442
  value: event.value
386
443
  }));
@@ -747,6 +804,10 @@ var GridVue2 = {
747
804
  if (item.expanded !== false && item.items) {
748
805
  allRowsCount = _this.addSubItems(item.items, allRowsCount);
749
806
  }
807
+
808
+ if (_this.$props.groupable.footer === 'always' || item.expanded !== false && _this.$props.groupable.footer === 'visible') {
809
+ allRowsCount++;
810
+ }
750
811
  });
751
812
  return allRowsCount;
752
813
  }
@@ -793,7 +854,7 @@ var GridVue2 = {
793
854
  if (Array.isArray(this.$props.dataItems)) {
794
855
  gridData = this.$props.dataItems;
795
856
  } else if (this.$props.dataItems) {
796
- gridData = this.$props.dataItems.data;
857
+ gridData = index_1.applyExpandedState(this.$props.dataItems, this.computedCollapsed, this.$props.uniqueField).data;
797
858
  total = total || this.$props.dataItems.total;
798
859
  }
799
860
 
@@ -804,10 +865,17 @@ var GridVue2 = {
804
865
  this.resetVirtual();
805
866
  this.vs.total = total;
806
867
 
807
- if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !groupable) {
868
+ if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !this.currentGroupable) {
808
869
  this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * (total || 0));
809
870
  } else {
810
- this.vs.containerHeight = 1533915; // this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * this.totalGroupedRows(gridData));
871
+ if (this.$props.totalGroupedHeight) {
872
+ this.vs.containerHeight = Math.min(1533915, this.$props.totalGroupedHeight);
873
+ } else if (this.$props.allGroupedItems && this.$props.allGroupedItems.data) {
874
+ var allGroupedTotal = this.totalGroupedRows(index_1.applyExpandedState(this.$props.allGroupedItems, this.computedCollapsed, this.$props.uniqueField).data);
875
+ this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * allGroupedTotal);
876
+ } else {
877
+ this.vs.containerHeight = 1533915;
878
+ }
811
879
  }
812
880
 
813
881
  var children = defaultSlot || [];
@@ -1206,6 +1274,11 @@ var GridVue2 = {
1206
1274
  columnCellRenderFunction = kendo_vue_common_1.templateRendering.call(this, column.cell, kendo_vue_common_1.getListeners.call(this));
1207
1275
  }
1208
1276
 
1277
+ var isCollapsed = this.computedCollapsed && this.computedCollapsed[item.level] && this.computedCollapsed[item.level].some(function (c) {
1278
+ return c === index_1.groupedFirstItemValue(item.dataItem, _this.$props.uniqueField);
1279
+ });
1280
+ var isExpanded = isCollapsed ? !isCollapsed : item.expanded;
1281
+
1209
1282
  if (column.internalCell) {
1210
1283
  return h(column.internalCell, {
1211
1284
  key: index,
@@ -1226,7 +1299,7 @@ var GridVue2 = {
1226
1299
  }).length,
1227
1300
  rowType: item.rowType,
1228
1301
  level: item.level,
1229
- expanded: item.expanded,
1302
+ expanded: isExpanded,
1230
1303
  dataIndex: item.dataIndex,
1231
1304
  ariaColumnIndex: column.ariaColumnIndex,
1232
1305
  isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(index) > -1
@@ -1265,7 +1338,7 @@ var GridVue2 = {
1265
1338
  }).length,
1266
1339
  rowType: item.rowType,
1267
1340
  level: item.level,
1268
- expanded: item.expanded,
1341
+ expanded: isExpanded,
1269
1342
  dataIndex: item.dataIndex,
1270
1343
  style: style,
1271
1344
  ariaColumnIndex: column.ariaColumnIndex,
@@ -1294,7 +1367,7 @@ var GridVue2 = {
1294
1367
  }).length,
1295
1368
  rowType: item.rowType,
1296
1369
  level: item.level,
1297
- expanded: item.expanded,
1370
+ expanded: isExpanded,
1298
1371
  dataIndex: item.dataIndex
1299
1372
  },
1300
1373
  key: index,
@@ -1324,7 +1397,7 @@ var GridVue2 = {
1324
1397
  }).length,
1325
1398
  rowType: item.rowType,
1326
1399
  level: item.level,
1327
- expanded: item.expanded,
1400
+ expanded: isExpanded,
1328
1401
  dataIndex: item.dataIndex,
1329
1402
  style: style
1330
1403
  });
@@ -1351,7 +1424,7 @@ var GridVue2 = {
1351
1424
  }).length,
1352
1425
  rowType: item.rowType,
1353
1426
  level: item.level,
1354
- expanded: item.expanded,
1427
+ expanded: isExpanded,
1355
1428
  dataIndex: item.dataIndex
1356
1429
  },
1357
1430
  colSpan: colSpans[index],
@@ -1400,7 +1473,7 @@ var GridVue2 = {
1400
1473
  }).length,
1401
1474
  rowType: item.rowType,
1402
1475
  level: item.level,
1403
- expanded: item.expanded,
1476
+ expanded: isExpanded,
1404
1477
  dataIndex: item.dataIndex,
1405
1478
  style: style
1406
1479
  });
@@ -1413,8 +1486,10 @@ var GridVue2 = {
1413
1486
 
1414
1487
  var hiddenRows = 0;
1415
1488
 
1416
- if (this.$props.scrollable === 'virtual') {
1417
- for (var i = 0; i < this.vs.topCacheCount + this.vs.attendedSkip - (this.$props.skip || 0); i++) {
1489
+ if (this.$props.scrollable === 'virtual' && this.totalGroupedRows(this.currentData) / 2 > this.$props.take) {
1490
+ var topIndex = this.vs.topCacheCount + this.vs.attendedSkip - (this.$props.skip || 0);
1491
+
1492
+ for (var i = 0; i < topIndex; i++) {
1418
1493
  var item = this.currentData.shift();
1419
1494
 
1420
1495
  if (item) {