@progress/kendo-angular-grid 15.2.0 → 15.3.0-develop.3
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/common/provider.service.d.ts +2 -0
- package/esm2020/common/error-messages.mjs +20 -11
- package/esm2020/grid.component.mjs +27 -20
- package/esm2020/grouping/group-scroll-binding.directive.mjs +80 -16
- package/esm2020/grouping/groups.service.mjs +8 -3
- package/esm2020/navigation/navigation.service.mjs +1 -2
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/rendering/list.component.mjs +25 -8
- package/esm2020/rendering/table-body.component.mjs +0 -2
- package/esm2020/scrolling/row-height.service.mjs +20 -1
- package/esm2020/scrolling/scroll-request.service.mjs +5 -2
- package/fesm2015/progress-kendo-angular-grid.mjs +181 -63
- package/fesm2020/progress-kendo-angular-grid.mjs +181 -63
- package/grid.component.d.ts +6 -10
- package/grouping/group-rows-args.interface.d.ts +3 -3
- package/grouping/group-scroll-binding.directive.d.ts +30 -7
- package/grouping/groups.service.d.ts +3 -2
- package/package.json +17 -17
- package/rendering/list.component.d.ts +1 -0
- package/schematics/ngAdd/index.js +3 -3
- package/scrolling/row-height.service.d.ts +1 -1
- package/scrolling/scroll-request.service.d.ts +20 -2
|
@@ -6,6 +6,7 @@ import { Renderer2 } from '@angular/core';
|
|
|
6
6
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
7
|
import type { GridComponent } from '../grid.component';
|
|
8
8
|
import { GridToolbarNavigationService } from '../rendering/toolbar/toolbar-navigation.service';
|
|
9
|
+
import type { GroupBindingDirective } from '../grouping/group-scroll-binding.directive';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
/**
|
|
11
12
|
* @hidden
|
|
@@ -23,6 +24,7 @@ export declare class ContextService {
|
|
|
23
24
|
topToolbarNavigation: GridToolbarNavigationService;
|
|
24
25
|
bottomToolbarNavigation: GridToolbarNavigationService;
|
|
25
26
|
navigable: boolean;
|
|
27
|
+
groupBindingDirective: GroupBindingDirective;
|
|
26
28
|
constructor(renderer: Renderer2, localization: LocalizationService);
|
|
27
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<ContextService, never>;
|
|
28
30
|
static ɵprov: i0.ɵɵInjectableDeclaration<ContextService>;
|
|
@@ -6,16 +6,21 @@
|
|
|
6
6
|
* @hidden
|
|
7
7
|
*/
|
|
8
8
|
export const ColumnMenuErrorMessages = {
|
|
9
|
-
autoSizeColumn:
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
autoSizeColumn: `The auto size column does not work with enabled virtual columns.
|
|
10
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-autosize-column-item.`,
|
|
11
|
+
autoSizeAllColumns: `The auto size all columns does not work with enabled virtual columns.
|
|
12
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-autosize-all-columns-item.`,
|
|
13
|
+
serviceInput: `The service input of the predefined column menu components is mandatory.
|
|
14
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-customizing-the-content.`
|
|
12
15
|
};
|
|
13
16
|
/**
|
|
14
17
|
* @hidden
|
|
15
18
|
*/
|
|
16
19
|
export const ClipboardErrorMessages = {
|
|
17
|
-
activeCellNavigable:
|
|
18
|
-
|
|
20
|
+
activeCellNavigable: `Grid must be navigable to use "activeCell" as clipboard target type.
|
|
21
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/clipboard/#toc-active-cell.`,
|
|
22
|
+
selectionSelectable: `Grid must be selectable to use "selection" as clipboard target type.
|
|
23
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/clipboard/#toc-current-selection.`
|
|
19
24
|
};
|
|
20
25
|
/**
|
|
21
26
|
* @hidden
|
|
@@ -26,8 +31,10 @@ export const ColumnConfigurationErrorMessages = {
|
|
|
26
31
|
Please use only valid identifier names to ensure error-free operation.`,
|
|
27
32
|
width: (value, parsedValue) => `Expected numeric value for column width, but got a string "${value}". Treating as ${parsedValue}px.`,
|
|
28
33
|
invalidColumn: (column) => `Invalid column ${column}.`,
|
|
29
|
-
requiredWidth: (columnType) => `${columnType} columns feature requires all columns to have set width
|
|
30
|
-
|
|
34
|
+
requiredWidth: (columnType) => `${columnType} columns feature requires all columns to have set width.
|
|
35
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/columns/${columnType.toLowerCase()}.`,
|
|
36
|
+
requiredScroll: (columnType) => `${columnType} columns are only supported when scrolling is enabled.
|
|
37
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/columns/${columnType.toLowerCase()}/`,
|
|
31
38
|
groupColumnContent: 'ColumnGroupComponent should contain ColumnComponent or CommandColumnComponent.',
|
|
32
39
|
lockedParent: 'Locked child columns require their parent columns to be locked.',
|
|
33
40
|
columnNested: 'Columns can be nested only inside ColumnGroupComponent',
|
|
@@ -39,14 +46,16 @@ export const ColumnConfigurationErrorMessages = {
|
|
|
39
46
|
export const GridConfigurationErrorMessages = {
|
|
40
47
|
functionType: (propName, fn) => `${propName} must be a function, but received ${JSON.stringify(fn)}.`,
|
|
41
48
|
incompatibleFeatures: (feat1Name, feat2Name) => `'Having both ${feat1Name} and ${feat2Name} is not supported.'`,
|
|
42
|
-
nonLockedColumnPresent: 'There should be at least one non-locked column',
|
|
43
|
-
rowHeightVirtual:
|
|
44
|
-
|
|
49
|
+
nonLockedColumnPresent: 'There should be at least one non-locked column. See https://www.telerik.com/kendo-angular-ui/components/grid/columns/locked/#toc-known-limitations',
|
|
50
|
+
rowHeightVirtual: `The virtual scrolling functionality requires setting the rowHeight (and detailRowHeight when there are detail rows).
|
|
51
|
+
Row height and detail row height settings should be set only when virtual scrolling mode is enabled.
|
|
52
|
+
See https://www.telerik.com/kendo-angular-ui/components/grid/scroll-modes/virtual/#toc-getting-started.`,
|
|
53
|
+
focusNavigable: 'The Grid should be configured as navigable to control focus. See https://www.telerik.com/kendo-angular-ui/components/grid/keyboard-navigation/.',
|
|
45
54
|
expandCollapseMethods: (expandMethodName, collapseMethodName, directiveName, callbackName) => `The ${expandMethodName} and ${collapseMethodName} methods should not be called
|
|
46
55
|
when using the ${directiveName} directive or the ${callbackName} callback.
|
|
47
56
|
These methods are provided only for backwards compatibility with legacy versions.`,
|
|
48
57
|
requiredEditService: `The default edit service of the editing directives works only when binding to plain array.
|
|
49
|
-
Please provide an editService.`,
|
|
58
|
+
Please provide an editService. See https://www.telerik.com/kendo-angular-ui/components/grid/editing/editing-directives/#toc-custom-editing-service.`,
|
|
50
59
|
requiredModule: (exportedType, moduleName, componentSelector) => `Creating ${exportedType} requires including the ${moduleName} and adding the ${componentSelector} component.`,
|
|
51
60
|
groupBindingDirectives: `Using the "kendoGridGroupBinding" directive in combination with the "kendoGridExpandGroupBy" directive
|
|
52
61
|
or the "isGroupExpanded" callback is not supported. To use grouping with the "kendoGridGroupBinding" directive,
|
|
@@ -131,7 +131,7 @@ const validateColumnsField = (columns) => expandColumns(columns.toArray())
|
|
|
131
131
|
.filter(isColumnComponent)
|
|
132
132
|
.filter(({ field }) => !isValidFieldName(field))
|
|
133
133
|
.forEach(({ field }) => console.warn(ColumnConfigurationErrorMessages.fieldName(field)));
|
|
134
|
-
const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group }) => isPresent(group)))
|
|
134
|
+
const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group, emit }) => emit && isPresent(group)))
|
|
135
135
|
.subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
|
|
136
136
|
const handleExpandCollapseDetailsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ dataItem }) => isPresent(dataItem)))
|
|
137
137
|
.subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
|
|
@@ -965,8 +965,6 @@ export class GridComponent {
|
|
|
965
965
|
* This method is provided only for backwards-compatibility with legacy versions.
|
|
966
966
|
* These versions tracked the expanded group state internally using the hierarchical group index.
|
|
967
967
|
*
|
|
968
|
-
* The `expandGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
|
|
969
|
-
*
|
|
970
968
|
* When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
|
|
971
969
|
*
|
|
972
970
|
* @param {string} index - The underscore separated hierarchical index of the group.
|
|
@@ -981,8 +979,6 @@ export class GridComponent {
|
|
|
981
979
|
* This method is provided only for backwards-compatibility with legacy versions.
|
|
982
980
|
* These versions tracked the expanded group state internally using the hierarchical group index.
|
|
983
981
|
*
|
|
984
|
-
* The `collapseGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
|
|
985
|
-
*
|
|
986
982
|
* When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
|
|
987
983
|
*
|
|
988
984
|
* @param {string} index - The underscore separated hierarchical index of the group.
|
|
@@ -996,12 +992,6 @@ export class GridComponent {
|
|
|
996
992
|
resetGroupsState() {
|
|
997
993
|
this.groupsService.reset();
|
|
998
994
|
}
|
|
999
|
-
/**
|
|
1000
|
-
* @hidden
|
|
1001
|
-
*/
|
|
1002
|
-
expandGroupChildren(groupIndex) {
|
|
1003
|
-
this.groupsService.expandChildren(groupIndex);
|
|
1004
|
-
}
|
|
1005
995
|
/**
|
|
1006
996
|
* @hidden
|
|
1007
997
|
*/
|
|
@@ -1070,7 +1060,6 @@ export class GridComponent {
|
|
|
1070
1060
|
this.attachElementEventHandlers();
|
|
1071
1061
|
this.updateNavigationMetadata();
|
|
1072
1062
|
this.applyAutoSize();
|
|
1073
|
-
// this.sizingService.changes.next(this.size);
|
|
1074
1063
|
}
|
|
1075
1064
|
ngAfterContentChecked() {
|
|
1076
1065
|
this.columnsContainer.refresh();
|
|
@@ -1426,7 +1415,13 @@ export class GridComponent {
|
|
|
1426
1415
|
* Scrolls to the specified row and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
|
|
1427
1416
|
*/
|
|
1428
1417
|
scrollTo(request) {
|
|
1429
|
-
this.scrollRequestService.scrollTo(request);
|
|
1418
|
+
this.scrollRequestService.scrollTo(request, false);
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Scrolls to the specified data item and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
|
|
1422
|
+
*/
|
|
1423
|
+
scrollToItem(request) {
|
|
1424
|
+
this.scrollRequestService.scrollToItem(request);
|
|
1430
1425
|
}
|
|
1431
1426
|
/**
|
|
1432
1427
|
* Changes the position of the specified column.
|
|
@@ -1655,16 +1650,19 @@ export class GridComponent {
|
|
|
1655
1650
|
throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('detail template', 'sticky columns'));
|
|
1656
1651
|
}
|
|
1657
1652
|
if (this.lockedLeafColumns.length && !this.nonLockedLeafColumns.length) {
|
|
1658
|
-
|
|
1653
|
+
console.warn(GridConfigurationErrorMessages.nonLockedColumnPresent);
|
|
1659
1654
|
}
|
|
1660
1655
|
if ((locked || this.virtualColumns) && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
|
|
1661
|
-
|
|
1656
|
+
console.warn(ColumnConfigurationErrorMessages.requiredWidth(locked ? 'Locked' : 'Virtual'));
|
|
1662
1657
|
}
|
|
1663
1658
|
if (locked && !this.isScrollable) {
|
|
1664
|
-
|
|
1659
|
+
console.warn(ColumnConfigurationErrorMessages.requiredScroll('Locked'));
|
|
1665
1660
|
}
|
|
1666
1661
|
if (stickyColumns && !this.isScrollable) {
|
|
1667
|
-
|
|
1662
|
+
console.warn(ColumnConfigurationErrorMessages.requiredScroll('Sticky'));
|
|
1663
|
+
}
|
|
1664
|
+
if (this.virtualColumns && !this.isScrollable) {
|
|
1665
|
+
console.warn(ColumnConfigurationErrorMessages.requiredScroll('Virtual'));
|
|
1668
1666
|
}
|
|
1669
1667
|
if (this.columnList.filter(isColumnGroupComponent).filter((x) => !x.hasChildren).length) {
|
|
1670
1668
|
throw new Error(ColumnConfigurationErrorMessages.groupColumnContent);
|
|
@@ -1673,10 +1671,16 @@ export class GridComponent {
|
|
|
1673
1671
|
throw new Error(ColumnConfigurationErrorMessages.lockedParent);
|
|
1674
1672
|
}
|
|
1675
1673
|
if ((this.rowHeight || this.detailRowHeight) && !this.isVirtual) {
|
|
1676
|
-
|
|
1674
|
+
console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
|
|
1675
|
+
}
|
|
1676
|
+
if (!this.rowHeight && this.isVirtual) {
|
|
1677
|
+
console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
|
|
1678
|
+
}
|
|
1679
|
+
if (!this.detailRowHeight && this.isVirtual && this.detailTemplate) {
|
|
1680
|
+
console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
|
|
1677
1681
|
}
|
|
1678
1682
|
if (stickyColumns && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
|
|
1679
|
-
|
|
1683
|
+
console.warn(ColumnConfigurationErrorMessages.requiredWidth('Sticky'));
|
|
1680
1684
|
}
|
|
1681
1685
|
if (stickyColumns && this.virtualColumns) {
|
|
1682
1686
|
throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('sticky columns', 'column virtualization'));
|
|
@@ -1974,7 +1978,10 @@ export class GridComponent {
|
|
|
1974
1978
|
return;
|
|
1975
1979
|
}
|
|
1976
1980
|
if (this.groupsService.isExpanded({ groupIndex: index }) !== expand) {
|
|
1977
|
-
this.groupsService.toggleRow({ index });
|
|
1981
|
+
this.groupsService.toggleRow({ index }, false);
|
|
1982
|
+
if (this.ctx.groupBindingDirective) {
|
|
1983
|
+
this.ctx.groupBindingDirective[`group${expand ? 'Expand' : 'Collapse'}`]({ groupIndex: index });
|
|
1984
|
+
}
|
|
1978
1985
|
}
|
|
1979
1986
|
}
|
|
1980
1987
|
shouldResetSelection(selectableChanges) {
|
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Directive, Input, ChangeDetectorRef, isDevMode } from '@angular/core';
|
|
6
6
|
import { DataBindingDirective } from "../databinding.directive";
|
|
7
|
-
import { GridComponent } from "../grid.component";
|
|
8
7
|
import { filterBy, process } from "@progress/kendo-data-query";
|
|
9
8
|
import { isPresent, isArray } from "../utils";
|
|
10
9
|
import { diffFilters, cloneFilters } from "../common/filter-descriptor-differ";
|
|
11
10
|
import { LocalDataChangesService } from "../editing/local-data-changes.service";
|
|
12
11
|
import { GridConfigurationErrorMessages } from '../common/error-messages';
|
|
12
|
+
import { ContextService } from '../common/provider.service';
|
|
13
|
+
import { GroupsService } from './groups.service';
|
|
14
|
+
import { Subscription } from 'rxjs';
|
|
13
15
|
import * as i0 from "@angular/core";
|
|
14
|
-
import * as i1 from "../
|
|
15
|
-
import * as i2 from "../
|
|
16
|
+
import * as i1 from "../editing/local-data-changes.service";
|
|
17
|
+
import * as i2 from "../common/provider.service";
|
|
18
|
+
import * as i3 from "./groups.service";
|
|
16
19
|
const hasGroups = (items) => items && items.length && items[0].field && items[0].items;
|
|
17
20
|
const groupDescriptorsPresent = (descriptors) => isPresent(descriptors) && descriptors.length > 0;
|
|
18
21
|
const processGroups = (data, state) => process(data, state).data;
|
|
@@ -54,6 +57,10 @@ export const count = (groups, includeFooters = false) => (groups.reduce((acc, gr
|
|
|
54
57
|
}
|
|
55
58
|
return acc;
|
|
56
59
|
}, 0));
|
|
60
|
+
/**
|
|
61
|
+
* @hidden
|
|
62
|
+
*/
|
|
63
|
+
export const noDescriptors = (descriptors) => !isPresent(descriptors) || !descriptors.length;
|
|
57
64
|
/**
|
|
58
65
|
* @hidden
|
|
59
66
|
*/
|
|
@@ -129,8 +136,11 @@ const skippedHeaders = (groupItem) => {
|
|
|
129
136
|
* A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
|
|
130
137
|
*/
|
|
131
138
|
export class GroupBindingDirective extends DataBindingDirective {
|
|
132
|
-
constructor(
|
|
133
|
-
super(grid, changeDetector, localDataChangesService);
|
|
139
|
+
constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
|
|
140
|
+
super(ctxService.grid, changeDetector, localDataChangesService);
|
|
141
|
+
this.groupsService = groupsService;
|
|
142
|
+
this.gridSubs = new Subscription();
|
|
143
|
+
ctxService.groupBindingDirective = this;
|
|
134
144
|
}
|
|
135
145
|
/**
|
|
136
146
|
* The array of data which will be used to populate the Grid.
|
|
@@ -151,7 +161,9 @@ export class GroupBindingDirective extends DataBindingDirective {
|
|
|
151
161
|
* Defines the descriptors by which the data will be sorted.
|
|
152
162
|
*/
|
|
153
163
|
set sort(value) {
|
|
154
|
-
const
|
|
164
|
+
const noCurrentDescriptors = noDescriptors(this.state.sort);
|
|
165
|
+
const noIncomingDescriptors = noDescriptors(value);
|
|
166
|
+
const clear = this.state.sort !== value && !(noCurrentDescriptors && noIncomingDescriptors);
|
|
155
167
|
this.grid.sort = this.state.sort = value;
|
|
156
168
|
if (clear) {
|
|
157
169
|
this.groups = null;
|
|
@@ -184,22 +196,65 @@ export class GroupBindingDirective extends DataBindingDirective {
|
|
|
184
196
|
this.skip = 0;
|
|
185
197
|
}
|
|
186
198
|
}
|
|
187
|
-
/**
|
|
188
|
-
* @hidden
|
|
189
|
-
*/
|
|
190
199
|
ngOnInit() {
|
|
191
200
|
super.ngOnInit();
|
|
192
|
-
this.grid.groupExpand.subscribe(this.groupExpand.bind(this));
|
|
193
|
-
this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this));
|
|
201
|
+
this.gridSubs.add(this.grid.groupExpand.subscribe(this.groupExpand.bind(this)));
|
|
202
|
+
this.gridSubs.add(this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this)));
|
|
194
203
|
}
|
|
195
204
|
ngAfterContentInit() {
|
|
196
205
|
if (isDevMode() && this.grid.isGroupExpanded) {
|
|
197
206
|
throw new Error(GridConfigurationErrorMessages.groupBindingDirectives);
|
|
198
207
|
}
|
|
199
208
|
}
|
|
209
|
+
ngOnDestroy() {
|
|
210
|
+
this.gridSubs.unsubscribe();
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* @hidden
|
|
214
|
+
*/
|
|
215
|
+
toggleAll(expand) {
|
|
216
|
+
this.skip = 0;
|
|
217
|
+
this.grid.scrollTo({ row: 0, column: 0 });
|
|
218
|
+
this.groups.forEach((gr, idx) => {
|
|
219
|
+
const expanded = this.groupsService.isExpanded({
|
|
220
|
+
group: gr,
|
|
221
|
+
groupIndex: idx.toString(),
|
|
222
|
+
parentGroup: undefined
|
|
223
|
+
});
|
|
224
|
+
const performToggle = (expand && !expanded) || (!expand && expanded);
|
|
225
|
+
if (performToggle) {
|
|
226
|
+
this.grid.groupsService.toggleRow({
|
|
227
|
+
type: 'group',
|
|
228
|
+
data: gr,
|
|
229
|
+
index: idx.toString(),
|
|
230
|
+
level: 0,
|
|
231
|
+
parentGroup: undefined
|
|
232
|
+
});
|
|
233
|
+
this[expand ? 'groupExpand' : 'groupCollapse']({ groupIndex: idx.toString() });
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Collapses all expanded root level groups.
|
|
239
|
+
*/
|
|
240
|
+
collapseAll() {
|
|
241
|
+
this.toggleAll(false);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Expands all expanded root level groups.
|
|
245
|
+
*/
|
|
246
|
+
expandAll() {
|
|
247
|
+
this.toggleAll(true);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* @hidden
|
|
251
|
+
*/
|
|
200
252
|
groupExpand({ groupIndex }) {
|
|
201
|
-
this.grid.expandGroupChildren(groupIndex);
|
|
202
253
|
const { group, parents } = findGroup(groupIndex, this.groups);
|
|
254
|
+
if (!group) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
this.groupsService.expandChildren(groupIndex);
|
|
203
258
|
if (!group.items.length) {
|
|
204
259
|
const descriptors = this.state.group.filter(removeParentDescriptors(parents, group));
|
|
205
260
|
const children = findChildren(this.originalData, parents.concat(group));
|
|
@@ -211,11 +266,17 @@ export class GroupBindingDirective extends DataBindingDirective {
|
|
|
211
266
|
}
|
|
212
267
|
this.grid.data = this.dataResult(this.state.skip, this.state.take);
|
|
213
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* @hidden
|
|
271
|
+
*/
|
|
214
272
|
groupCollapse({ groupIndex }) {
|
|
215
273
|
const { group } = findGroup(groupIndex, this.groups);
|
|
216
274
|
if (group) {
|
|
217
275
|
group.items = [];
|
|
218
276
|
}
|
|
277
|
+
else {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
219
280
|
this.grid.data = this.dataResult(this.state.skip, this.state.take);
|
|
220
281
|
}
|
|
221
282
|
process(state) {
|
|
@@ -255,12 +316,15 @@ export class GroupBindingDirective extends DataBindingDirective {
|
|
|
255
316
|
this.filter = filter;
|
|
256
317
|
}
|
|
257
318
|
}
|
|
258
|
-
GroupBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, deps: [{ token:
|
|
259
|
-
GroupBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GroupBindingDirective, selector: "[kendoGridGroupBinding]", inputs: { kendoGridGroupBinding: "kendoGridGroupBinding", sort: "sort", filter: "filter", group: "group" }, usesInheritance: true, ngImport: i0 });
|
|
319
|
+
GroupBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.LocalDataChangesService }, { token: i2.ContextService }, { token: i3.GroupsService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
320
|
+
GroupBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GroupBindingDirective, selector: "[kendoGridGroupBinding]", inputs: { kendoGridGroupBinding: "kendoGridGroupBinding", sort: "sort", filter: "filter", group: "group" }, exportAs: ["kendoGridGroupBinding"], usesInheritance: true, ngImport: i0 });
|
|
260
321
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, decorators: [{
|
|
261
322
|
type: Directive,
|
|
262
|
-
args: [{
|
|
263
|
-
|
|
323
|
+
args: [{
|
|
324
|
+
selector: '[kendoGridGroupBinding]',
|
|
325
|
+
exportAs: 'kendoGridGroupBinding'
|
|
326
|
+
}]
|
|
327
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.LocalDataChangesService }, { type: i2.ContextService }, { type: i3.GroupsService }]; }, propDecorators: { kendoGridGroupBinding: [{
|
|
264
328
|
type: Input,
|
|
265
329
|
args: ["kendoGridGroupBinding"]
|
|
266
330
|
}], sort: [{
|
|
@@ -6,7 +6,12 @@ import { Injectable } from '@angular/core';
|
|
|
6
6
|
import { Subject } from 'rxjs';
|
|
7
7
|
import { getGroupRowArgs } from './utils';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
|
-
const isChildIndex = (targetIndex, parentIndex) =>
|
|
9
|
+
const isChildIndex = (targetIndex, parentIndex) => {
|
|
10
|
+
const sameIndex = parentIndex === targetIndex;
|
|
11
|
+
const lastSeparatorIndex = targetIndex.lastIndexOf('_');
|
|
12
|
+
const sameSubGroupIndex = targetIndex.substring(0, lastSeparatorIndex) === parentIndex;
|
|
13
|
+
return !sameIndex && sameSubGroupIndex;
|
|
14
|
+
};
|
|
10
15
|
/**
|
|
11
16
|
* @hidden
|
|
12
17
|
*/
|
|
@@ -39,10 +44,10 @@ export class GroupsService {
|
|
|
39
44
|
}
|
|
40
45
|
return expanded;
|
|
41
46
|
}
|
|
42
|
-
toggleRow(groupItem) {
|
|
47
|
+
toggleRow(groupItem, emit = true) {
|
|
43
48
|
const parentGroup = getGroupRowArgs(groupItem.parentGroup);
|
|
44
49
|
const expand = !this.isExpanded({ group: groupItem.data, groupIndex: groupItem.index, parentGroup });
|
|
45
|
-
this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup });
|
|
50
|
+
this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup, emit });
|
|
46
51
|
// if usercallback is given, the rowState should be ignored
|
|
47
52
|
if (this.userCallback) {
|
|
48
53
|
return;
|
|
@@ -152,8 +152,7 @@ export class NavigationService {
|
|
|
152
152
|
this.zone.onStable.pipe(take(1), map(() => args), ...operators);
|
|
153
153
|
const onStable = onStableSubscriber();
|
|
154
154
|
this.subs = new Subscription();
|
|
155
|
-
this.subs.add(this.cursor.changes
|
|
156
|
-
.subscribe(args => this.onCursorChanges(args)));
|
|
155
|
+
this.subs.add(this.cursor.changes.subscribe(args => this.onCursorChanges(args)));
|
|
157
156
|
this.subs.add(this.domEvents.focus.pipe(switchMap(onStable))
|
|
158
157
|
.subscribe((args) => this.navigateTo(args.target)));
|
|
159
158
|
this.subs.add(this.domEvents.focusOut.pipe(filter(() => this.mode !== 0 /* Standby */), switchMap(onStableSubscriber(takeUntil(this.domEvents.focus))))
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-grid',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
13
|
-
version: '15.
|
|
12
|
+
publishDate: 1710360642,
|
|
13
|
+
version: '15.3.0-develop.3',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
15
15
|
};
|
|
@@ -10,7 +10,7 @@ import { ScrollerService, PageAction, ScrollAction, ScrollBottomAction } from '.
|
|
|
10
10
|
import { ScrollRequestService } from '../scrolling/scroll-request.service';
|
|
11
11
|
import { ColumnBase } from '../columns/column-base';
|
|
12
12
|
import { DetailTemplateDirective } from './details/detail-template.directive';
|
|
13
|
-
import { isChanged, isPresent, isUniversal, anyChanged, isNumber, requestAnimationFrame, cancelAnimationFrame } from '../utils';
|
|
13
|
+
import { isChanged, isPresent, isUniversal, anyChanged, isNumber, requestAnimationFrame, cancelAnimationFrame, recursiveFlatMap } from '../utils';
|
|
14
14
|
import { DetailsService } from './details/details.service';
|
|
15
15
|
import { ColumnsContainer } from '../columns/columns-container';
|
|
16
16
|
import { ChangeNotificationService } from '../data/change-notification.service';
|
|
@@ -65,7 +65,7 @@ const elementAt = (index, elements, elementOffset) => {
|
|
|
65
65
|
elementIdx += offset;
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
const rowAt = (index, rows) => elementAt(index, rows,
|
|
68
|
+
const rowAt = (index, rows) => elementAt(index, rows, () => 1);
|
|
69
69
|
const cellAt = (index, cells) => elementAt(index, cells, cell => !hasClasses(cell, NON_DATA_CELL_CLASSES) ? parseInt(cell.getAttribute('colSpan'), 10) || 1 : 0);
|
|
70
70
|
const EMPTY_OBJECT = {};
|
|
71
71
|
/**
|
|
@@ -142,7 +142,7 @@ export class ListComponent {
|
|
|
142
142
|
this.rtl = false;
|
|
143
143
|
this.scroller = scrollerFactory(this.dispatcher);
|
|
144
144
|
this.subscriptions = detailsService.changes.subscribe(x => this.detailExpand(x));
|
|
145
|
-
this.subscriptions.add(scrollRequestService.requests.subscribe(
|
|
145
|
+
this.subscriptions.add(scrollRequestService.requests.subscribe(req => isPresent(req.adjustIndex) ? this.scrollTo(req.request, req.adjustIndex) : this.scrollToItem(req.request)));
|
|
146
146
|
}
|
|
147
147
|
get showFooter() {
|
|
148
148
|
return this.groupable && this.groupable.showFooter;
|
|
@@ -385,21 +385,21 @@ export class ListComponent {
|
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
-
scrollToVirtualRow(itemIndex) {
|
|
388
|
+
scrollToVirtualRow(itemIndex, adjustIndexForDetailTemplate = true) {
|
|
389
389
|
if (!isDocumentAvailable()) {
|
|
390
390
|
return;
|
|
391
391
|
}
|
|
392
|
-
if (isPresent(this.detailTemplate)) {
|
|
392
|
+
if (isPresent(this.detailTemplate) && adjustIndexForDetailTemplate) {
|
|
393
393
|
itemIndex = Math.floor(itemIndex / 2);
|
|
394
394
|
}
|
|
395
|
-
const offset = this.rowHeightService.offset(itemIndex);
|
|
395
|
+
const offset = this.rowHeightService.offset(itemIndex, !adjustIndexForDetailTemplate);
|
|
396
396
|
this.container.nativeElement.scrollTop = offset;
|
|
397
397
|
this.resetNavigationViewport();
|
|
398
398
|
}
|
|
399
|
-
scrollTo({ row, column }) {
|
|
399
|
+
scrollTo({ row, column }, adjustIndex = false) {
|
|
400
400
|
if (isNumber(row)) {
|
|
401
401
|
if (this.isVirtual) {
|
|
402
|
-
this.scrollToVirtualRow(row);
|
|
402
|
+
this.scrollToVirtualRow(row, adjustIndex);
|
|
403
403
|
}
|
|
404
404
|
else {
|
|
405
405
|
const element = rowAt(row, this.table.nativeElement.rows);
|
|
@@ -433,6 +433,23 @@ export class ListComponent {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
+
scrollToItem(item) {
|
|
437
|
+
if (!isDocumentAvailable()) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const data = this.ctx.grid.data;
|
|
441
|
+
const gridData = Array.isArray(data) ? data : data.data;
|
|
442
|
+
const gridDataItems = gridData.flatMap(recursiveFlatMap);
|
|
443
|
+
const dataItemIndex = gridDataItems.findIndex(dataItem => dataItem[item.idField] === item.id);
|
|
444
|
+
if (dataItemIndex !== -1) {
|
|
445
|
+
const row = Array.from(this.table.nativeElement.rows).find((r) => {
|
|
446
|
+
const dataAttribute = r.getAttribute('data-kendo-grid-item-index');
|
|
447
|
+
return dataAttribute && +dataAttribute === this.ctx.grid.skip + dataItemIndex;
|
|
448
|
+
});
|
|
449
|
+
row && row.scrollIntoView();
|
|
450
|
+
this.isVirtual && this.resetNavigationViewport();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
436
453
|
resetNavigationViewport() {
|
|
437
454
|
if (!isDocumentAvailable) {
|
|
438
455
|
return;
|
|
@@ -458,7 +458,6 @@ TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
|
|
|
458
458
|
</ng-container>
|
|
459
459
|
</td>
|
|
460
460
|
</tr>
|
|
461
|
-
|
|
462
461
|
<ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
|
|
463
462
|
<tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
|
|
464
463
|
kendoGridGroupHeader
|
|
@@ -688,7 +687,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
688
687
|
</ng-container>
|
|
689
688
|
</td>
|
|
690
689
|
</tr>
|
|
691
|
-
|
|
692
690
|
<ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
|
|
693
691
|
<tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
|
|
694
692
|
kendoGridGroupHeader
|
|
@@ -60,7 +60,26 @@ export class RowHeightService {
|
|
|
60
60
|
}, undefined);
|
|
61
61
|
return result === undefined ? this.total - 1 : result;
|
|
62
62
|
}
|
|
63
|
-
offset(rowIndex) {
|
|
63
|
+
offset(rowIndex, adjustIndex = false) {
|
|
64
|
+
if (adjustIndex) {
|
|
65
|
+
let targetOffset = 0;
|
|
66
|
+
let targetIndex = 0;
|
|
67
|
+
for (let i = 0; i < rowIndex; i++) {
|
|
68
|
+
targetOffset += this.rowHeight;
|
|
69
|
+
targetIndex++;
|
|
70
|
+
if (targetIndex === rowIndex) {
|
|
71
|
+
return targetOffset;
|
|
72
|
+
}
|
|
73
|
+
if (this.isExpanded(i)) {
|
|
74
|
+
targetOffset += this.detailRowHeight;
|
|
75
|
+
targetIndex++;
|
|
76
|
+
if (targetIndex === rowIndex) {
|
|
77
|
+
return targetOffset;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return targetOffset;
|
|
82
|
+
}
|
|
64
83
|
return this.offsets[rowIndex];
|
|
65
84
|
}
|
|
66
85
|
totalHeight() {
|
|
@@ -12,8 +12,11 @@ export class ScrollRequestService {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
this.requests = new Subject();
|
|
14
14
|
}
|
|
15
|
-
scrollTo(request) {
|
|
16
|
-
this.requests.next(request);
|
|
15
|
+
scrollTo(request, adjustIndex = true) {
|
|
16
|
+
this.requests.next({ request, adjustIndex });
|
|
17
|
+
}
|
|
18
|
+
scrollToItem(request) {
|
|
19
|
+
this.requests.next({ request });
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
ScrollRequestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ScrollRequestService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|