@progress/kendo-vue-grid 3.0.4 → 3.0.5-dev.202202071439
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 +1 -0
- package/dist/es/Grid.js +75 -18
- package/dist/es/VirtualScroll.d.ts +1 -1
- package/dist/es/VirtualScroll.js +2 -2
- package/dist/es/interfaces/GridProps.d.ts +12 -0
- package/dist/es/interfaces/events.d.ts +4 -0
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/index.d.ts +4 -0
- package/dist/es/utils/index.js +34 -0
- package/dist/npm/Grid.d.ts +1 -0
- package/dist/npm/Grid.js +74 -17
- package/dist/npm/VirtualScroll.d.ts +1 -1
- package/dist/npm/VirtualScroll.js +2 -2
- package/dist/npm/interfaces/GridProps.d.ts +12 -0
- package/dist/npm/interfaces/events.d.ts +4 -0
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +11 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/index.d.ts +4 -0
- package/dist/npm/utils/index.js +36 -1
- package/package.json +13 -13
package/dist/es/Grid.d.ts
CHANGED
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 } 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,12 @@ import { pagerMessagesMap } from './messages';
|
|
|
84
84
|
var GridVue2 = {
|
|
85
85
|
name: 'KendoGrid',
|
|
86
86
|
props: {
|
|
87
|
+
topCacheCount: {
|
|
88
|
+
type: Number,
|
|
89
|
+
default: 4
|
|
90
|
+
},
|
|
91
|
+
totalGroupedHeight: Number,
|
|
92
|
+
allGroupedItems: Object,
|
|
87
93
|
alternatePerGroup: Boolean,
|
|
88
94
|
columns: Array,
|
|
89
95
|
columnVirtualization: Boolean,
|
|
@@ -154,8 +160,8 @@ var GridVue2 = {
|
|
|
154
160
|
validatePackage(packageMetadata);
|
|
155
161
|
this.initialHeight = null;
|
|
156
162
|
this._columns = [];
|
|
157
|
-
var groupable = this
|
|
158
|
-
this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
|
|
163
|
+
var groupable = this.currentGroupable;
|
|
164
|
+
this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
|
|
159
165
|
this.dragLogic = new CommonDragLogic(this.columnReorder.bind(this), this.groupReorder.bind(this), this.columnToGroup.bind(this));
|
|
160
166
|
this.columnResize = new ColumnResize(this.onResize.bind(this));
|
|
161
167
|
this._columnsMap = [[]];
|
|
@@ -192,6 +198,9 @@ var GridVue2 = {
|
|
|
192
198
|
return null;
|
|
193
199
|
}
|
|
194
200
|
}
|
|
201
|
+
},
|
|
202
|
+
currentGroupable: function currentGroupable() {
|
|
203
|
+
return this.$props.groupable === true && this.$props.group && this.$props.group.length || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
|
|
195
204
|
}
|
|
196
205
|
},
|
|
197
206
|
methods: {
|
|
@@ -285,16 +294,16 @@ var GridVue2 = {
|
|
|
285
294
|
}
|
|
286
295
|
},
|
|
287
296
|
onTotalChanged: function onTotalChanged(_value, _oldValue) {
|
|
288
|
-
var groupable = this
|
|
297
|
+
var groupable = this.currentGroupable;
|
|
289
298
|
this.vs.reset();
|
|
290
|
-
this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
|
|
299
|
+
this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
|
|
291
300
|
this.resetVirtual();
|
|
292
301
|
this.setRefs();
|
|
293
302
|
},
|
|
294
303
|
onRowHeightChanged: function onRowHeightChanged(_value, _oldValue) {
|
|
295
|
-
var groupable = this
|
|
304
|
+
var groupable = this.currentGroupable;
|
|
296
305
|
this.vs.reset();
|
|
297
|
-
this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
|
|
306
|
+
this.vs = new VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
|
|
298
307
|
this.resetVirtual();
|
|
299
308
|
this.setRefs();
|
|
300
309
|
},
|
|
@@ -337,6 +346,32 @@ var GridVue2 = {
|
|
|
337
346
|
}, this.getArguments(e)));
|
|
338
347
|
}
|
|
339
348
|
},
|
|
349
|
+
updateGroupCollapsed: function updateGroupCollapsed(event) {
|
|
350
|
+
var groupToUpdate = this.$props.group.find(function (g) {
|
|
351
|
+
return g.field === event.dataItem.field;
|
|
352
|
+
});
|
|
353
|
+
var collapsed = groupToUpdate.collapsed ? __spreadArrays(groupToUpdate.collapsed) : [];
|
|
354
|
+
|
|
355
|
+
if (event.value) {
|
|
356
|
+
if (collapsed.length) {
|
|
357
|
+
var expandedIndex = collapsed.indexOf(event.dataItem.value);
|
|
358
|
+
|
|
359
|
+
if (expandedIndex > -1) {
|
|
360
|
+
collapsed.splice(expandedIndex, 1);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
if (collapsed) {
|
|
365
|
+
if (!collapsed.includes(event.dataItem.value)) {
|
|
366
|
+
collapsed.push(event.dataItem.value);
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
collapsed = [event.dataItem.value];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return collapsed;
|
|
374
|
+
},
|
|
340
375
|
itemChange: function itemChange(event) {
|
|
341
376
|
var itemChange = hasListener.call(this, 'itemchange');
|
|
342
377
|
|
|
@@ -344,7 +379,9 @@ var GridVue2 = {
|
|
|
344
379
|
var expandChange = hasListener.call(this, 'expandchange');
|
|
345
380
|
|
|
346
381
|
if (expandChange) {
|
|
382
|
+
var collapsed = this.updateGroupCollapsed(event);
|
|
347
383
|
this.$emit('expandchange', __assign(__assign({}, this.getArguments(event.event)), {
|
|
384
|
+
collapsed: collapsed,
|
|
348
385
|
dataItem: event.dataItem,
|
|
349
386
|
value: event.value
|
|
350
387
|
}));
|
|
@@ -711,6 +748,10 @@ var GridVue2 = {
|
|
|
711
748
|
if (item.expanded !== false && item.items) {
|
|
712
749
|
allRowsCount = _this.addSubItems(item.items, allRowsCount);
|
|
713
750
|
}
|
|
751
|
+
|
|
752
|
+
if (_this.$props.groupable.footer === 'always' || item.expanded !== false && _this.$props.groupable.footer === 'visible') {
|
|
753
|
+
allRowsCount++;
|
|
754
|
+
}
|
|
714
755
|
});
|
|
715
756
|
return allRowsCount;
|
|
716
757
|
}
|
|
@@ -757,7 +798,7 @@ var GridVue2 = {
|
|
|
757
798
|
if (Array.isArray(this.$props.dataItems)) {
|
|
758
799
|
gridData = this.$props.dataItems;
|
|
759
800
|
} else if (this.$props.dataItems) {
|
|
760
|
-
gridData = this.$props.dataItems.data;
|
|
801
|
+
gridData = applyExpandedState(this.$props.dataItems, this.$props.group).data;
|
|
761
802
|
total = total || this.$props.dataItems.total;
|
|
762
803
|
}
|
|
763
804
|
|
|
@@ -768,10 +809,17 @@ var GridVue2 = {
|
|
|
768
809
|
this.resetVirtual();
|
|
769
810
|
this.vs.total = total;
|
|
770
811
|
|
|
771
|
-
if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !
|
|
812
|
+
if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !this.currentGroupable) {
|
|
772
813
|
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * (total || 0));
|
|
773
814
|
} else {
|
|
774
|
-
|
|
815
|
+
if (this.$props.totalGroupedHeight) {
|
|
816
|
+
this.vs.containerHeight = Math.min(1533915, this.$props.totalGroupedHeight);
|
|
817
|
+
} else if (this.$props.allGroupedItems) {
|
|
818
|
+
var allGroupedItems = this.totalGroupedRows(applyExpandedState(this.$props.allGroupedItems, this.$props.group).data);
|
|
819
|
+
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * allGroupedItems);
|
|
820
|
+
} else {
|
|
821
|
+
this.vs.containerHeight = 1533915;
|
|
822
|
+
}
|
|
775
823
|
}
|
|
776
824
|
|
|
777
825
|
var children = defaultSlot || [];
|
|
@@ -1170,6 +1218,13 @@ var GridVue2 = {
|
|
|
1170
1218
|
columnCellRenderFunction = templateRendering.call(this, column.cell, getListeners.call(this));
|
|
1171
1219
|
}
|
|
1172
1220
|
|
|
1221
|
+
var isCollapsed = this.group && this.group.some(function (gr) {
|
|
1222
|
+
return gr.field === column.field && gr.collapsed && gr.collapsed.some(function (c) {
|
|
1223
|
+
return c === item.dataItem[column.field || ''];
|
|
1224
|
+
});
|
|
1225
|
+
});
|
|
1226
|
+
var isExpanded = isCollapsed ? !isCollapsed : item.expanded;
|
|
1227
|
+
|
|
1173
1228
|
if (column.internalCell) {
|
|
1174
1229
|
return h(column.internalCell, {
|
|
1175
1230
|
key: index,
|
|
@@ -1190,7 +1245,7 @@ var GridVue2 = {
|
|
|
1190
1245
|
}).length,
|
|
1191
1246
|
rowType: item.rowType,
|
|
1192
1247
|
level: item.level,
|
|
1193
|
-
expanded:
|
|
1248
|
+
expanded: isExpanded,
|
|
1194
1249
|
dataIndex: item.dataIndex,
|
|
1195
1250
|
ariaColumnIndex: column.ariaColumnIndex,
|
|
1196
1251
|
isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(index) > -1
|
|
@@ -1229,7 +1284,7 @@ var GridVue2 = {
|
|
|
1229
1284
|
}).length,
|
|
1230
1285
|
rowType: item.rowType,
|
|
1231
1286
|
level: item.level,
|
|
1232
|
-
expanded:
|
|
1287
|
+
expanded: isExpanded,
|
|
1233
1288
|
dataIndex: item.dataIndex,
|
|
1234
1289
|
style: style,
|
|
1235
1290
|
ariaColumnIndex: column.ariaColumnIndex,
|
|
@@ -1258,7 +1313,7 @@ var GridVue2 = {
|
|
|
1258
1313
|
}).length,
|
|
1259
1314
|
rowType: item.rowType,
|
|
1260
1315
|
level: item.level,
|
|
1261
|
-
expanded:
|
|
1316
|
+
expanded: isExpanded,
|
|
1262
1317
|
dataIndex: item.dataIndex
|
|
1263
1318
|
},
|
|
1264
1319
|
key: index,
|
|
@@ -1288,7 +1343,7 @@ var GridVue2 = {
|
|
|
1288
1343
|
}).length,
|
|
1289
1344
|
rowType: item.rowType,
|
|
1290
1345
|
level: item.level,
|
|
1291
|
-
expanded:
|
|
1346
|
+
expanded: isExpanded,
|
|
1292
1347
|
dataIndex: item.dataIndex,
|
|
1293
1348
|
style: style
|
|
1294
1349
|
});
|
|
@@ -1315,7 +1370,7 @@ var GridVue2 = {
|
|
|
1315
1370
|
}).length,
|
|
1316
1371
|
rowType: item.rowType,
|
|
1317
1372
|
level: item.level,
|
|
1318
|
-
expanded:
|
|
1373
|
+
expanded: isExpanded,
|
|
1319
1374
|
dataIndex: item.dataIndex
|
|
1320
1375
|
},
|
|
1321
1376
|
colSpan: colSpans[index],
|
|
@@ -1364,7 +1419,7 @@ var GridVue2 = {
|
|
|
1364
1419
|
}).length,
|
|
1365
1420
|
rowType: item.rowType,
|
|
1366
1421
|
level: item.level,
|
|
1367
|
-
expanded:
|
|
1422
|
+
expanded: isExpanded,
|
|
1368
1423
|
dataIndex: item.dataIndex,
|
|
1369
1424
|
style: style
|
|
1370
1425
|
});
|
|
@@ -1377,8 +1432,10 @@ var GridVue2 = {
|
|
|
1377
1432
|
|
|
1378
1433
|
var hiddenRows = 0;
|
|
1379
1434
|
|
|
1380
|
-
if (this.$props.scrollable === 'virtual') {
|
|
1381
|
-
|
|
1435
|
+
if (this.$props.scrollable === 'virtual' && this.totalGroupedRows(this.currentData) > this.$props.take) {
|
|
1436
|
+
var topIndex = this.vs.topCacheCount + this.vs.attendedSkip - (this.$props.skip || 0);
|
|
1437
|
+
|
|
1438
|
+
for (var i = 0; i < topIndex; i++) {
|
|
1382
1439
|
var item = this.currentData.shift();
|
|
1383
1440
|
|
|
1384
1441
|
if (item) {
|
package/dist/es/VirtualScroll.js
CHANGED
|
@@ -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 =
|
|
21
|
+
this.topCacheCount = topCacheCount;
|
|
22
22
|
this.attendedSkip = -this.topCacheCount;
|
|
23
23
|
}
|
|
24
24
|
this.scrollHandler = this.scrollHandler.bind(this);
|
|
@@ -276,6 +276,18 @@ 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[];
|
|
279
291
|
/**
|
|
280
292
|
* Fires when Grid keyboard navigation position is changed.
|
|
281
293
|
*/
|
|
@@ -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:
|
|
8
|
+
publishDate: 1644244547,
|
|
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/index.d.ts
CHANGED
package/dist/es/utils/index.js
CHANGED
|
@@ -353,3 +353,37 @@ export var parsers = {
|
|
|
353
353
|
return value;
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
|
+
/**
|
|
357
|
+
* @hidden
|
|
358
|
+
*/
|
|
359
|
+
function updateItemsExpanded(items, field, collapsed) {
|
|
360
|
+
items.forEach(function (di) {
|
|
361
|
+
if (di.field === field) {
|
|
362
|
+
di.expanded = !collapsed.includes(di.value);
|
|
363
|
+
}
|
|
364
|
+
else if (di.items && di.items.length) {
|
|
365
|
+
di.items = updateItemsExpanded(di.items, field, collapsed);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
return items;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* @hidden
|
|
372
|
+
*/
|
|
373
|
+
export function applyExpandedState(sdata, group) {
|
|
374
|
+
if (group) {
|
|
375
|
+
group.forEach(function (gr) {
|
|
376
|
+
if (gr.collapsed && gr.collapsed.length) {
|
|
377
|
+
sdata.data.forEach(function (di) {
|
|
378
|
+
if (di.field === gr.field) {
|
|
379
|
+
di.expanded = !gr.collapsed.includes(di.value);
|
|
380
|
+
}
|
|
381
|
+
else if (di.items && di.items.length) {
|
|
382
|
+
di.items = updateItemsExpanded(di.items, gr.field, gr.collapsed);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
return sdata;
|
|
389
|
+
}
|
package/dist/npm/Grid.d.ts
CHANGED
package/dist/npm/Grid.js
CHANGED
|
@@ -120,6 +120,12 @@ var messages_1 = require("./messages");
|
|
|
120
120
|
var GridVue2 = {
|
|
121
121
|
name: 'KendoGrid',
|
|
122
122
|
props: {
|
|
123
|
+
topCacheCount: {
|
|
124
|
+
type: Number,
|
|
125
|
+
default: 4
|
|
126
|
+
},
|
|
127
|
+
totalGroupedHeight: Number,
|
|
128
|
+
allGroupedItems: Object,
|
|
123
129
|
alternatePerGroup: Boolean,
|
|
124
130
|
columns: Array,
|
|
125
131
|
columnVirtualization: Boolean,
|
|
@@ -190,8 +196,8 @@ var GridVue2 = {
|
|
|
190
196
|
kendo_vue_common_1.validatePackage(package_metadata_1.packageMetadata);
|
|
191
197
|
this.initialHeight = null;
|
|
192
198
|
this._columns = [];
|
|
193
|
-
var groupable = this
|
|
194
|
-
this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
|
|
199
|
+
var groupable = this.currentGroupable;
|
|
200
|
+
this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
|
|
195
201
|
this.dragLogic = new CommonDragLogic_1.CommonDragLogic(this.columnReorder.bind(this), this.groupReorder.bind(this), this.columnToGroup.bind(this));
|
|
196
202
|
this.columnResize = new ColumnResize_1.ColumnResize(this.onResize.bind(this));
|
|
197
203
|
this._columnsMap = [[]];
|
|
@@ -228,6 +234,9 @@ var GridVue2 = {
|
|
|
228
234
|
return null;
|
|
229
235
|
}
|
|
230
236
|
}
|
|
237
|
+
},
|
|
238
|
+
currentGroupable: function currentGroupable() {
|
|
239
|
+
return this.$props.groupable === true && this.$props.group && this.$props.group.length || _typeof(this.$props.groupable) === 'object' && this.$props.groupable.enabled !== false;
|
|
231
240
|
}
|
|
232
241
|
},
|
|
233
242
|
methods: {
|
|
@@ -321,16 +330,16 @@ var GridVue2 = {
|
|
|
321
330
|
}
|
|
322
331
|
},
|
|
323
332
|
onTotalChanged: function onTotalChanged(_value, _oldValue) {
|
|
324
|
-
var groupable = this
|
|
333
|
+
var groupable = this.currentGroupable;
|
|
325
334
|
this.vs.reset();
|
|
326
|
-
this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
|
|
335
|
+
this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
|
|
327
336
|
this.resetVirtual();
|
|
328
337
|
this.setRefs();
|
|
329
338
|
},
|
|
330
339
|
onRowHeightChanged: function onRowHeightChanged(_value, _oldValue) {
|
|
331
|
-
var groupable = this
|
|
340
|
+
var groupable = this.currentGroupable;
|
|
332
341
|
this.vs.reset();
|
|
333
|
-
this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0);
|
|
342
|
+
this.vs = new VirtualScroll_1.VirtualScroll(groupable || this.$props.rowHeight === undefined || this.$props.rowHeight === 0, this.$props.topCacheCount);
|
|
334
343
|
this.resetVirtual();
|
|
335
344
|
this.setRefs();
|
|
336
345
|
},
|
|
@@ -373,6 +382,32 @@ var GridVue2 = {
|
|
|
373
382
|
}, this.getArguments(e)));
|
|
374
383
|
}
|
|
375
384
|
},
|
|
385
|
+
updateGroupCollapsed: function updateGroupCollapsed(event) {
|
|
386
|
+
var groupToUpdate = this.$props.group.find(function (g) {
|
|
387
|
+
return g.field === event.dataItem.field;
|
|
388
|
+
});
|
|
389
|
+
var collapsed = groupToUpdate.collapsed ? __spreadArrays(groupToUpdate.collapsed) : [];
|
|
390
|
+
|
|
391
|
+
if (event.value) {
|
|
392
|
+
if (collapsed.length) {
|
|
393
|
+
var expandedIndex = collapsed.indexOf(event.dataItem.value);
|
|
394
|
+
|
|
395
|
+
if (expandedIndex > -1) {
|
|
396
|
+
collapsed.splice(expandedIndex, 1);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
if (collapsed) {
|
|
401
|
+
if (!collapsed.includes(event.dataItem.value)) {
|
|
402
|
+
collapsed.push(event.dataItem.value);
|
|
403
|
+
}
|
|
404
|
+
} else {
|
|
405
|
+
collapsed = [event.dataItem.value];
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return collapsed;
|
|
410
|
+
},
|
|
376
411
|
itemChange: function itemChange(event) {
|
|
377
412
|
var itemChange = kendo_vue_common_1.hasListener.call(this, 'itemchange');
|
|
378
413
|
|
|
@@ -380,7 +415,9 @@ var GridVue2 = {
|
|
|
380
415
|
var expandChange = kendo_vue_common_1.hasListener.call(this, 'expandchange');
|
|
381
416
|
|
|
382
417
|
if (expandChange) {
|
|
418
|
+
var collapsed = this.updateGroupCollapsed(event);
|
|
383
419
|
this.$emit('expandchange', __assign(__assign({}, this.getArguments(event.event)), {
|
|
420
|
+
collapsed: collapsed,
|
|
384
421
|
dataItem: event.dataItem,
|
|
385
422
|
value: event.value
|
|
386
423
|
}));
|
|
@@ -747,6 +784,10 @@ var GridVue2 = {
|
|
|
747
784
|
if (item.expanded !== false && item.items) {
|
|
748
785
|
allRowsCount = _this.addSubItems(item.items, allRowsCount);
|
|
749
786
|
}
|
|
787
|
+
|
|
788
|
+
if (_this.$props.groupable.footer === 'always' || item.expanded !== false && _this.$props.groupable.footer === 'visible') {
|
|
789
|
+
allRowsCount++;
|
|
790
|
+
}
|
|
750
791
|
});
|
|
751
792
|
return allRowsCount;
|
|
752
793
|
}
|
|
@@ -793,7 +834,7 @@ var GridVue2 = {
|
|
|
793
834
|
if (Array.isArray(this.$props.dataItems)) {
|
|
794
835
|
gridData = this.$props.dataItems;
|
|
795
836
|
} else if (this.$props.dataItems) {
|
|
796
|
-
gridData = this.$props.dataItems.data;
|
|
837
|
+
gridData = index_1.applyExpandedState(this.$props.dataItems, this.$props.group).data;
|
|
797
838
|
total = total || this.$props.dataItems.total;
|
|
798
839
|
}
|
|
799
840
|
|
|
@@ -804,10 +845,17 @@ var GridVue2 = {
|
|
|
804
845
|
this.resetVirtual();
|
|
805
846
|
this.vs.total = total;
|
|
806
847
|
|
|
807
|
-
if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !
|
|
848
|
+
if (this.$props.rowHeight !== undefined && this.$props.rowHeight > 0 && !this.currentGroupable) {
|
|
808
849
|
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * (total || 0));
|
|
809
850
|
} else {
|
|
810
|
-
|
|
851
|
+
if (this.$props.totalGroupedHeight) {
|
|
852
|
+
this.vs.containerHeight = Math.min(1533915, this.$props.totalGroupedHeight);
|
|
853
|
+
} else if (this.$props.allGroupedItems) {
|
|
854
|
+
var allGroupedItems = this.totalGroupedRows(index_1.applyExpandedState(this.$props.allGroupedItems, this.$props.group).data);
|
|
855
|
+
this.vs.containerHeight = Math.min(1533915, this.$props.rowHeight * allGroupedItems);
|
|
856
|
+
} else {
|
|
857
|
+
this.vs.containerHeight = 1533915;
|
|
858
|
+
}
|
|
811
859
|
}
|
|
812
860
|
|
|
813
861
|
var children = defaultSlot || [];
|
|
@@ -1206,6 +1254,13 @@ var GridVue2 = {
|
|
|
1206
1254
|
columnCellRenderFunction = kendo_vue_common_1.templateRendering.call(this, column.cell, kendo_vue_common_1.getListeners.call(this));
|
|
1207
1255
|
}
|
|
1208
1256
|
|
|
1257
|
+
var isCollapsed = this.group && this.group.some(function (gr) {
|
|
1258
|
+
return gr.field === column.field && gr.collapsed && gr.collapsed.some(function (c) {
|
|
1259
|
+
return c === item.dataItem[column.field || ''];
|
|
1260
|
+
});
|
|
1261
|
+
});
|
|
1262
|
+
var isExpanded = isCollapsed ? !isCollapsed : item.expanded;
|
|
1263
|
+
|
|
1209
1264
|
if (column.internalCell) {
|
|
1210
1265
|
return h(column.internalCell, {
|
|
1211
1266
|
key: index,
|
|
@@ -1226,7 +1281,7 @@ var GridVue2 = {
|
|
|
1226
1281
|
}).length,
|
|
1227
1282
|
rowType: item.rowType,
|
|
1228
1283
|
level: item.level,
|
|
1229
|
-
expanded:
|
|
1284
|
+
expanded: isExpanded,
|
|
1230
1285
|
dataIndex: item.dataIndex,
|
|
1231
1286
|
ariaColumnIndex: column.ariaColumnIndex,
|
|
1232
1287
|
isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(index) > -1
|
|
@@ -1265,7 +1320,7 @@ var GridVue2 = {
|
|
|
1265
1320
|
}).length,
|
|
1266
1321
|
rowType: item.rowType,
|
|
1267
1322
|
level: item.level,
|
|
1268
|
-
expanded:
|
|
1323
|
+
expanded: isExpanded,
|
|
1269
1324
|
dataIndex: item.dataIndex,
|
|
1270
1325
|
style: style,
|
|
1271
1326
|
ariaColumnIndex: column.ariaColumnIndex,
|
|
@@ -1294,7 +1349,7 @@ var GridVue2 = {
|
|
|
1294
1349
|
}).length,
|
|
1295
1350
|
rowType: item.rowType,
|
|
1296
1351
|
level: item.level,
|
|
1297
|
-
expanded:
|
|
1352
|
+
expanded: isExpanded,
|
|
1298
1353
|
dataIndex: item.dataIndex
|
|
1299
1354
|
},
|
|
1300
1355
|
key: index,
|
|
@@ -1324,7 +1379,7 @@ var GridVue2 = {
|
|
|
1324
1379
|
}).length,
|
|
1325
1380
|
rowType: item.rowType,
|
|
1326
1381
|
level: item.level,
|
|
1327
|
-
expanded:
|
|
1382
|
+
expanded: isExpanded,
|
|
1328
1383
|
dataIndex: item.dataIndex,
|
|
1329
1384
|
style: style
|
|
1330
1385
|
});
|
|
@@ -1351,7 +1406,7 @@ var GridVue2 = {
|
|
|
1351
1406
|
}).length,
|
|
1352
1407
|
rowType: item.rowType,
|
|
1353
1408
|
level: item.level,
|
|
1354
|
-
expanded:
|
|
1409
|
+
expanded: isExpanded,
|
|
1355
1410
|
dataIndex: item.dataIndex
|
|
1356
1411
|
},
|
|
1357
1412
|
colSpan: colSpans[index],
|
|
@@ -1400,7 +1455,7 @@ var GridVue2 = {
|
|
|
1400
1455
|
}).length,
|
|
1401
1456
|
rowType: item.rowType,
|
|
1402
1457
|
level: item.level,
|
|
1403
|
-
expanded:
|
|
1458
|
+
expanded: isExpanded,
|
|
1404
1459
|
dataIndex: item.dataIndex,
|
|
1405
1460
|
style: style
|
|
1406
1461
|
});
|
|
@@ -1413,8 +1468,10 @@ var GridVue2 = {
|
|
|
1413
1468
|
|
|
1414
1469
|
var hiddenRows = 0;
|
|
1415
1470
|
|
|
1416
|
-
if (this.$props.scrollable === 'virtual') {
|
|
1417
|
-
|
|
1471
|
+
if (this.$props.scrollable === 'virtual' && this.totalGroupedRows(this.currentData) > this.$props.take) {
|
|
1472
|
+
var topIndex = this.vs.topCacheCount + this.vs.attendedSkip - (this.$props.skip || 0);
|
|
1473
|
+
|
|
1474
|
+
for (var i = 0; i < topIndex; i++) {
|
|
1418
1475
|
var item = this.currentData.shift();
|
|
1419
1476
|
|
|
1420
1477
|
if (item) {
|
|
@@ -5,7 +5,7 @@ exports.VirtualScroll = void 0;
|
|
|
5
5
|
* @hidden
|
|
6
6
|
*/
|
|
7
7
|
var VirtualScroll = /** @class */ (function () {
|
|
8
|
-
function VirtualScroll(cached) {
|
|
8
|
+
function VirtualScroll(cached, topCacheCount) {
|
|
9
9
|
this.containerHeight = 0;
|
|
10
10
|
this.topCacheCount = 0; // 4;
|
|
11
11
|
this.attendedSkip = 0; // -4;
|
|
@@ -21,7 +21,7 @@ var VirtualScroll = /** @class */ (function () {
|
|
|
21
21
|
this.tableTranslate = 0;
|
|
22
22
|
this.scrollSyncing = false;
|
|
23
23
|
if (cached) {
|
|
24
|
-
this.topCacheCount =
|
|
24
|
+
this.topCacheCount = topCacheCount;
|
|
25
25
|
this.attendedSkip = -this.topCacheCount;
|
|
26
26
|
}
|
|
27
27
|
this.scrollHandler = this.scrollHandler.bind(this);
|
|
@@ -276,6 +276,18 @@ 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[];
|
|
279
291
|
/**
|
|
280
292
|
* Fires when Grid keyboard navigation position is changed.
|
|
281
293
|
*/
|
|
@@ -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/npm/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 };
|