@progress/kendo-angular-grid 19.2.0-develop.11 → 19.2.0-develop.12
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.
|
@@ -21214,8 +21214,8 @@ const packageMetadata = {
|
|
|
21214
21214
|
productName: 'Kendo UI for Angular',
|
|
21215
21215
|
productCode: 'KENDOUIANGULAR',
|
|
21216
21216
|
productCodes: ['KENDOUIANGULAR'],
|
|
21217
|
-
publishDate:
|
|
21218
|
-
version: '19.2.0-develop.
|
|
21217
|
+
publishDate: 1751375460,
|
|
21218
|
+
version: '19.2.0-develop.12',
|
|
21219
21219
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
21220
21220
|
};
|
|
21221
21221
|
|
|
@@ -27645,723 +27645,191 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
27645
27645
|
args: [GroupToolbarToolComponent]
|
|
27646
27646
|
}] } });
|
|
27647
27647
|
|
|
27648
|
+
const createControl = (source) => (acc, key) => {
|
|
27649
|
+
acc[key] = new FormControl(source[key]);
|
|
27650
|
+
return acc;
|
|
27651
|
+
};
|
|
27652
|
+
const validateColumnsField = (columns) => expandColumns(columns.toArray())
|
|
27653
|
+
.filter(isColumnComponent)
|
|
27654
|
+
.filter(({ field }) => !isValidFieldName(field))
|
|
27655
|
+
.forEach(({ field }) => console.warn(ColumnConfigurationErrorMessages.fieldName(field)));
|
|
27656
|
+
const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group, emit }) => emit && isPresent(group)))
|
|
27657
|
+
.subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
|
|
27658
|
+
const handleExpandCollapseDetailsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ dataItem }) => isPresent(dataItem)))
|
|
27659
|
+
.subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
|
|
27660
|
+
const isInEditedCell = (element, gridElement) => closest(element, matchesClasses('k-grid-edit-cell')) &&
|
|
27661
|
+
closest(element, matchesNodeName('kendo-grid')) === gridElement;
|
|
27662
|
+
const NOTIFY_DELAY = 500;
|
|
27648
27663
|
/**
|
|
27649
|
-
*
|
|
27650
|
-
* [sorting]({% slug sorting_grid %}), and [grouping]({% slug grouping_grid %}).
|
|
27664
|
+
* Represents the Kendo UI for Angular Data Grid component.
|
|
27651
27665
|
*
|
|
27652
|
-
* Use
|
|
27653
|
-
* ([More information and examples]({% slug local_data_grid %}#toc-using-the-data-binding-directive)).
|
|
27666
|
+
* Use the `kendo-grid` component to display and manage tabular data.
|
|
27654
27667
|
*
|
|
27655
27668
|
* @example
|
|
27656
27669
|
* ```html
|
|
27657
|
-
* <kendo-grid [
|
|
27670
|
+
* <kendo-grid [data]="gridData"></kendo-grid>
|
|
27658
27671
|
* ```
|
|
27672
|
+
*
|
|
27659
27673
|
* @remarks
|
|
27660
|
-
*
|
|
27674
|
+
* Supported children components are:
|
|
27675
|
+
* {@link CheckboxColumnComponent},
|
|
27676
|
+
* {@link ColumnChooserComponent},
|
|
27677
|
+
* {@link ColumnComponent},
|
|
27678
|
+
* {@link ColumnGroupComponent},
|
|
27679
|
+
* {@link ColumnMenuAutoSizeAllColumnsComponent},
|
|
27680
|
+
* {@link ColumnMenuAutoSizeColumnComponent},
|
|
27681
|
+
* {@link ColumnMenuChooserComponent},
|
|
27682
|
+
* {@link ColumnMenuComponent},
|
|
27683
|
+
* {@link ColumnMenuFilterComponent},
|
|
27684
|
+
* {@link ColumnMenuItemComponent},
|
|
27685
|
+
* {@link ColumnMenuLockComponent},
|
|
27686
|
+
* {@link ColumnMenuPositionComponent},
|
|
27687
|
+
* {@link ColumnMenuSortComponent},
|
|
27688
|
+
* {@link ColumnMenuStickComponent},
|
|
27689
|
+
* {@link CommandColumnComponent},
|
|
27690
|
+
* {@link CustomMessagesComponent},
|
|
27691
|
+
* {@link ExcelComponent},
|
|
27692
|
+
* {@link GridSpacerComponent},
|
|
27693
|
+
* {@link PDFComponent},
|
|
27694
|
+
* {@link RowReorderColumnComponent},
|
|
27695
|
+
* {@link SpanColumnComponent},
|
|
27696
|
+
* {@link ToolBarComponent}.
|
|
27661
27697
|
*/
|
|
27662
|
-
class
|
|
27663
|
-
|
|
27664
|
-
|
|
27665
|
-
|
|
27698
|
+
class GridComponent {
|
|
27699
|
+
supportService;
|
|
27700
|
+
selectionService;
|
|
27701
|
+
cellSelectionService;
|
|
27702
|
+
wrapper;
|
|
27703
|
+
groupInfoService;
|
|
27704
|
+
groupsService;
|
|
27705
|
+
changeNotification;
|
|
27706
|
+
detailsService;
|
|
27707
|
+
editService;
|
|
27708
|
+
filterService;
|
|
27709
|
+
pdfService;
|
|
27710
|
+
responsiveService;
|
|
27711
|
+
renderer;
|
|
27712
|
+
excelService;
|
|
27713
|
+
ngZone;
|
|
27714
|
+
scrollSyncService;
|
|
27715
|
+
domEvents;
|
|
27716
|
+
columnResizingService;
|
|
27717
|
+
changeDetectorRef;
|
|
27718
|
+
columnReorderService;
|
|
27719
|
+
columnInfoService;
|
|
27720
|
+
navigationService;
|
|
27721
|
+
sortService;
|
|
27722
|
+
scrollRequestService;
|
|
27723
|
+
localization;
|
|
27724
|
+
ctx;
|
|
27725
|
+
sizingService;
|
|
27726
|
+
adaptiveGridService;
|
|
27666
27727
|
rowReorderService;
|
|
27728
|
+
dataMappingService;
|
|
27667
27729
|
/**
|
|
27668
|
-
* Sets the
|
|
27669
|
-
*
|
|
27670
|
-
* @default 0
|
|
27730
|
+
* Sets the data of the Grid. If you provide an array, the Grid gets the total count automatically.
|
|
27731
|
+
* ([more information and example]({% slug binding_grid %})).
|
|
27671
27732
|
*/
|
|
27672
|
-
set
|
|
27673
|
-
|
|
27674
|
-
|
|
27733
|
+
set data(value) {
|
|
27734
|
+
this._data = value;
|
|
27735
|
+
if (this.selectable && this.selectableSettings?.enabled && this.isVirtual) {
|
|
27736
|
+
this.blockArrowSelection = false;
|
|
27675
27737
|
}
|
|
27676
|
-
|
|
27677
|
-
|
|
27678
|
-
this.
|
|
27738
|
+
if (this.notifyTimeout) {
|
|
27739
|
+
clearTimeout(this.notifyTimeout);
|
|
27740
|
+
this.notifyTimeout = null;
|
|
27741
|
+
}
|
|
27742
|
+
if (this.rowReorderable) {
|
|
27743
|
+
this.ngZone.runOutsideAngular(() => {
|
|
27744
|
+
this.notifyTimeout = setTimeout(() => {
|
|
27745
|
+
this.notifyReorderContainers();
|
|
27746
|
+
}, NOTIFY_DELAY);
|
|
27747
|
+
});
|
|
27679
27748
|
}
|
|
27680
27749
|
}
|
|
27750
|
+
get data() {
|
|
27751
|
+
return this._data;
|
|
27752
|
+
}
|
|
27753
|
+
get hintText() {
|
|
27754
|
+
return this.rowReorderService.getDefaultHintText(this.columnList, this.flatData);
|
|
27755
|
+
}
|
|
27681
27756
|
/**
|
|
27682
|
-
*
|
|
27683
|
-
*
|
|
27757
|
+
* @hidden
|
|
27684
27758
|
*/
|
|
27685
|
-
|
|
27686
|
-
|
|
27759
|
+
get customHintTemplate() {
|
|
27760
|
+
if (this.rowReorderable) {
|
|
27761
|
+
const allColumns = this.columnList.toArray();
|
|
27762
|
+
const rowReorderColumn = allColumns.find(column => column.isRowReorderColumn);
|
|
27763
|
+
return rowReorderColumn.rowDragHintTemplateRef;
|
|
27764
|
+
}
|
|
27687
27765
|
}
|
|
27688
27766
|
/**
|
|
27689
|
-
*
|
|
27690
|
-
*
|
|
27767
|
+
* @hidden
|
|
27691
27768
|
*/
|
|
27692
|
-
|
|
27693
|
-
|
|
27769
|
+
get hintContext() {
|
|
27770
|
+
if (this.customHintTemplate) {
|
|
27771
|
+
const draggedRow = this.rowReorderService?.getDraggedRow(this.flatData);
|
|
27772
|
+
return {
|
|
27773
|
+
$implicit: draggedRow?.dataItem,
|
|
27774
|
+
rowIndex: draggedRow?.rowIndex
|
|
27775
|
+
};
|
|
27776
|
+
}
|
|
27694
27777
|
}
|
|
27695
27778
|
/**
|
|
27696
|
-
*
|
|
27697
|
-
*
|
|
27779
|
+
* Defines the page size used by the Grid pager.
|
|
27780
|
+
* Required for the [`paging`]({% slug paging_grid %}) feature.
|
|
27698
27781
|
*/
|
|
27699
|
-
|
|
27700
|
-
this.grid.pageSize = this.state.take = value;
|
|
27701
|
-
}
|
|
27782
|
+
pageSize;
|
|
27702
27783
|
/**
|
|
27703
|
-
*
|
|
27704
|
-
*
|
|
27784
|
+
* Defines the height in pixels for the Grid when `scrollable` is set.
|
|
27785
|
+
* You can also set the height using `style.height` with units like `px`, `%`, `em`, or `rem`.
|
|
27705
27786
|
*/
|
|
27706
|
-
|
|
27707
|
-
this.grid.group = this.state.group = value;
|
|
27708
|
-
}
|
|
27787
|
+
height;
|
|
27709
27788
|
/**
|
|
27710
|
-
*
|
|
27711
|
-
*
|
|
27789
|
+
* Represents the row height in pixels for each Grid row (`tr`) element.
|
|
27790
|
+
* Required for [virtual scrolling]({% slug scrollmmodes_grid %}).
|
|
27791
|
+
* Set `rowHeight` to match the actual DOM row height. The property does not change the height of the rows in the UI.
|
|
27712
27792
|
*/
|
|
27713
|
-
|
|
27714
|
-
this.originalData = value || [];
|
|
27715
|
-
if (this.localDataChangesService) {
|
|
27716
|
-
this.localDataChangesService.data = value;
|
|
27717
|
-
}
|
|
27718
|
-
this.dataChanged = true;
|
|
27719
|
-
}
|
|
27720
|
-
state = {
|
|
27721
|
-
skip: 0
|
|
27722
|
-
};
|
|
27723
|
-
originalData = [];
|
|
27724
|
-
dataChanged;
|
|
27725
|
-
stateChangeSubscription;
|
|
27726
|
-
dataChangedSubscription;
|
|
27727
|
-
rowReorderSubscription;
|
|
27728
|
-
constructor(grid, changeDetector, localDataChangesService, rowReorderService, ctx) {
|
|
27729
|
-
this.grid = grid;
|
|
27730
|
-
this.changeDetector = changeDetector;
|
|
27731
|
-
this.localDataChangesService = localDataChangesService;
|
|
27732
|
-
this.rowReorderService = rowReorderService;
|
|
27733
|
-
if (localDataChangesService) {
|
|
27734
|
-
this.dataChangedSubscription = this.localDataChangesService.changes.subscribe(this.rebind.bind(this));
|
|
27735
|
-
}
|
|
27736
|
-
ctx && (ctx.dataBindingDirective = this);
|
|
27737
|
-
}
|
|
27793
|
+
rowHeight;
|
|
27738
27794
|
/**
|
|
27739
|
-
*
|
|
27795
|
+
* Enables or disables adaptive mode. Adaptive rendering is off by default.
|
|
27796
|
+
*
|
|
27797
|
+
* @default 'none'
|
|
27740
27798
|
*/
|
|
27741
|
-
|
|
27742
|
-
this.applyState(this.state);
|
|
27743
|
-
this.stateChangeSubscription = this.grid
|
|
27744
|
-
.dataStateChange
|
|
27745
|
-
.subscribe(this.onStateChange.bind(this));
|
|
27746
|
-
if (this.rowReorderService) {
|
|
27747
|
-
this.rowReorderSubscription = this.grid
|
|
27748
|
-
.rowReorder
|
|
27749
|
-
.subscribe(this.onRowReorder.bind(this));
|
|
27750
|
-
}
|
|
27751
|
-
}
|
|
27799
|
+
adaptiveMode = 'none';
|
|
27752
27800
|
/**
|
|
27753
|
-
*
|
|
27801
|
+
* Represents the height in pixels for each Grid detail row (`tr`) element.
|
|
27802
|
+
* Required for [virtual scrolling]({% slug scrollmmodes_grid %}).
|
|
27803
|
+
* Set `detailRowHeight` to match the actual DOM detail row height. The property does not change the height of the rows in the UI.
|
|
27754
27804
|
*/
|
|
27755
|
-
|
|
27756
|
-
if (this.stateChangeSubscription) {
|
|
27757
|
-
this.stateChangeSubscription.unsubscribe();
|
|
27758
|
-
}
|
|
27759
|
-
if (this.dataChangedSubscription) {
|
|
27760
|
-
this.dataChangedSubscription.unsubscribe();
|
|
27761
|
-
}
|
|
27762
|
-
if (this.rowReorderSubscription) {
|
|
27763
|
-
this.rowReorderSubscription.unsubscribe();
|
|
27764
|
-
}
|
|
27765
|
-
}
|
|
27805
|
+
detailRowHeight;
|
|
27766
27806
|
/**
|
|
27767
|
-
*
|
|
27807
|
+
* Defines the number of records to skip in the pager.
|
|
27808
|
+
* Required for the [`paging`]({% slug paging_grid %}) feature.
|
|
27768
27809
|
*/
|
|
27769
|
-
|
|
27770
|
-
|
|
27771
|
-
this.rebind();
|
|
27772
|
-
}
|
|
27810
|
+
get skip() {
|
|
27811
|
+
return this._skip;
|
|
27773
27812
|
}
|
|
27774
|
-
|
|
27775
|
-
if (
|
|
27776
|
-
this.
|
|
27813
|
+
set skip(value) {
|
|
27814
|
+
if (typeof value === 'number' && value >= 0) {
|
|
27815
|
+
this._skip = this.rowReorderService.skip = value;
|
|
27777
27816
|
}
|
|
27778
27817
|
}
|
|
27779
27818
|
/**
|
|
27780
|
-
*
|
|
27819
|
+
* Defines the scroll mode for the Grid.
|
|
27820
|
+
*
|
|
27821
|
+
* @default 'scrollable'
|
|
27781
27822
|
*/
|
|
27782
|
-
|
|
27783
|
-
this.applyState(state);
|
|
27784
|
-
this.rebind();
|
|
27785
|
-
}
|
|
27823
|
+
scrollable = 'scrollable';
|
|
27786
27824
|
/**
|
|
27787
|
-
*
|
|
27825
|
+
* Enables the selection feature of the Grid. The `selectable` property can be set to `true`, `false`, or an object with additional settings.
|
|
27826
|
+
* [See example](slug:grid_row_selection).
|
|
27827
|
+
*
|
|
27828
|
+
* @default false
|
|
27788
27829
|
*/
|
|
27789
|
-
|
|
27790
|
-
this.rowReorderService.reorderRows(ev, this.originalData);
|
|
27791
|
-
this.rebind();
|
|
27792
|
-
}
|
|
27830
|
+
selectable = false;
|
|
27793
27831
|
/**
|
|
27794
|
-
*
|
|
27795
|
-
*/
|
|
27796
|
-
rebind() {
|
|
27797
|
-
this.data = this.originalData;
|
|
27798
|
-
this.updateGridData();
|
|
27799
|
-
this.notifyDataChange();
|
|
27800
|
-
}
|
|
27801
|
-
/**
|
|
27802
|
-
* Notifies the Grid that its data has changed.
|
|
27803
|
-
*/
|
|
27804
|
-
notifyDataChange() {
|
|
27805
|
-
this.grid.onDataChange();
|
|
27806
|
-
if (this.changeDetector) {
|
|
27807
|
-
this.changeDetector.markForCheck();
|
|
27808
|
-
}
|
|
27809
|
-
}
|
|
27810
|
-
process(state) {
|
|
27811
|
-
if (this.grid.isVirtual && (!isPresent(state.take) || state.take === 0)) {
|
|
27812
|
-
return {
|
|
27813
|
-
data: [],
|
|
27814
|
-
total: this.originalData?.length || 0
|
|
27815
|
-
};
|
|
27816
|
-
}
|
|
27817
|
-
return process(this.originalData, state);
|
|
27818
|
-
}
|
|
27819
|
-
applyState({ skip, take, sort, group, filter }) {
|
|
27820
|
-
this.skip = skip;
|
|
27821
|
-
this.pageSize = take;
|
|
27822
|
-
this.sort = sort;
|
|
27823
|
-
this.group = group;
|
|
27824
|
-
this.filter = filter;
|
|
27825
|
-
}
|
|
27826
|
-
updateGridData() {
|
|
27827
|
-
this.grid.data = this.process(this.state);
|
|
27828
|
-
this.grid.updateNavigationMetadata();
|
|
27829
|
-
this.dataChanged = false;
|
|
27830
|
-
}
|
|
27831
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataBindingDirective, deps: [{ token: GridComponent }, { token: i0.ChangeDetectorRef }, { token: LocalDataChangesService }, { token: RowReorderService }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
27832
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: DataBindingDirective, isStandalone: true, selector: "[kendoGridBinding]", inputs: { skip: "skip", sort: "sort", filter: "filter", pageSize: "pageSize", group: "group", data: ["kendoGridBinding", "data"] }, exportAs: ["kendoGridBinding"], usesOnChanges: true, ngImport: i0 });
|
|
27833
|
-
}
|
|
27834
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataBindingDirective, decorators: [{
|
|
27835
|
-
type: Directive,
|
|
27836
|
-
args: [{
|
|
27837
|
-
selector: '[kendoGridBinding]',
|
|
27838
|
-
exportAs: 'kendoGridBinding',
|
|
27839
|
-
standalone: true
|
|
27840
|
-
}]
|
|
27841
|
-
}], ctorParameters: function () { return [{ type: GridComponent }, { type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }, { type: RowReorderService }, { type: ContextService }]; }, propDecorators: { skip: [{
|
|
27842
|
-
type: Input
|
|
27843
|
-
}], sort: [{
|
|
27844
|
-
type: Input
|
|
27845
|
-
}], filter: [{
|
|
27846
|
-
type: Input
|
|
27847
|
-
}], pageSize: [{
|
|
27848
|
-
type: Input
|
|
27849
|
-
}], group: [{
|
|
27850
|
-
type: Input
|
|
27851
|
-
}], data: [{
|
|
27852
|
-
type: Input,
|
|
27853
|
-
args: ["kendoGridBinding"]
|
|
27854
|
-
}] } });
|
|
27855
|
-
|
|
27856
|
-
const hasGroups = (items) => items && items.length && items[0].field && items[0].items;
|
|
27857
|
-
const groupDescriptorsPresent = (descriptors) => isPresent(descriptors) && descriptors.length > 0;
|
|
27858
|
-
const processGroups = (data, state) => process(data, state).data;
|
|
27859
|
-
const removeParentDescriptors = (parents, owner) => g => g.field !== owner.field && !parents.some(y => y.field === g.field);
|
|
27860
|
-
const findGroup = (groupIndex, groups) => {
|
|
27861
|
-
const parents = [];
|
|
27862
|
-
return {
|
|
27863
|
-
group: groupIndex.split("_").reduce((acc, x) => {
|
|
27864
|
-
const idx = parseInt(x, 10);
|
|
27865
|
-
if (acc.items) {
|
|
27866
|
-
parents.push(acc);
|
|
27867
|
-
return acc.items[idx];
|
|
27868
|
-
}
|
|
27869
|
-
return isArray(acc) ? acc[idx] : acc;
|
|
27870
|
-
}, groups),
|
|
27871
|
-
parents
|
|
27872
|
-
};
|
|
27873
|
-
};
|
|
27874
|
-
const findChildren = (data, parents) => {
|
|
27875
|
-
const filters = parents.map(p => ({ field: p.field, operator: "eq", value: p.value }));
|
|
27876
|
-
return filterBy(data, {
|
|
27877
|
-
filters: filters,
|
|
27878
|
-
logic: "and"
|
|
27879
|
-
});
|
|
27880
|
-
};
|
|
27881
|
-
/**
|
|
27882
|
-
* @hidden
|
|
27883
|
-
*/
|
|
27884
|
-
const count = (groups, includeFooters = false) => (groups.reduce((acc, group) => {
|
|
27885
|
-
if (!group.skipHeader) {
|
|
27886
|
-
acc++;
|
|
27887
|
-
}
|
|
27888
|
-
if (group.items) {
|
|
27889
|
-
const children = count(group.items, includeFooters);
|
|
27890
|
-
if (includeFooters && children && !group.hideFooter) {
|
|
27891
|
-
acc++;
|
|
27892
|
-
}
|
|
27893
|
-
acc += children;
|
|
27894
|
-
}
|
|
27895
|
-
return acc;
|
|
27896
|
-
}, 0));
|
|
27897
|
-
/**
|
|
27898
|
-
* @hidden
|
|
27899
|
-
*/
|
|
27900
|
-
const noDescriptors = (descriptors) => !isPresent(descriptors) || !descriptors.length;
|
|
27901
|
-
/**
|
|
27902
|
-
* @hidden
|
|
27903
|
-
*/
|
|
27904
|
-
const slice = (groups, skip, take, includeFooters = false) => {
|
|
27905
|
-
if (!isPresent(take)) {
|
|
27906
|
-
return groups;
|
|
27907
|
-
}
|
|
27908
|
-
const result = [];
|
|
27909
|
-
for (let idx = 0, length = groups.length; idx < length; idx++) {
|
|
27910
|
-
if (take <= 0) {
|
|
27911
|
-
break;
|
|
27912
|
-
}
|
|
27913
|
-
const group = groups[idx];
|
|
27914
|
-
const groupItems = group.items;
|
|
27915
|
-
let itemCount = count(groupItems, includeFooters);
|
|
27916
|
-
if (includeFooters && groupItems.length) {
|
|
27917
|
-
itemCount++;
|
|
27918
|
-
}
|
|
27919
|
-
const skipHeader = skip > 0;
|
|
27920
|
-
if (skip) {
|
|
27921
|
-
skip--;
|
|
27922
|
-
if (itemCount && skip >= itemCount) {
|
|
27923
|
-
skip -= itemCount;
|
|
27924
|
-
continue;
|
|
27925
|
-
}
|
|
27926
|
-
}
|
|
27927
|
-
if (!skipHeader || itemCount) {
|
|
27928
|
-
const items = [];
|
|
27929
|
-
let hideFooter = true;
|
|
27930
|
-
if (!skipHeader) {
|
|
27931
|
-
take--;
|
|
27932
|
-
}
|
|
27933
|
-
if (take) {
|
|
27934
|
-
if (hasGroups(groupItems)) {
|
|
27935
|
-
const children = slice(groupItems, skip, take, includeFooters);
|
|
27936
|
-
items.push(...children);
|
|
27937
|
-
take -= count(children, includeFooters);
|
|
27938
|
-
}
|
|
27939
|
-
else {
|
|
27940
|
-
items.push(...groupItems.slice(skip, Math.min(skip + take, groupItems.length)));
|
|
27941
|
-
take -= items.length;
|
|
27942
|
-
}
|
|
27943
|
-
if (take && includeFooters) {
|
|
27944
|
-
hideFooter = false;
|
|
27945
|
-
take--;
|
|
27946
|
-
}
|
|
27947
|
-
skip = 0;
|
|
27948
|
-
}
|
|
27949
|
-
result.push({
|
|
27950
|
-
aggregates: group.aggregates,
|
|
27951
|
-
field: group.field,
|
|
27952
|
-
hideFooter,
|
|
27953
|
-
items,
|
|
27954
|
-
offset: idx,
|
|
27955
|
-
skipHeader,
|
|
27956
|
-
value: group.value
|
|
27957
|
-
});
|
|
27958
|
-
}
|
|
27959
|
-
}
|
|
27960
|
-
return result;
|
|
27961
|
-
};
|
|
27962
|
-
const skippedHeaders = (groupItem) => {
|
|
27963
|
-
let total = 0;
|
|
27964
|
-
while (groupItem) {
|
|
27965
|
-
if (groupItem.skipHeader) {
|
|
27966
|
-
total++;
|
|
27967
|
-
}
|
|
27968
|
-
groupItem = groupItem.items && groupItem.items[0] || null;
|
|
27969
|
-
}
|
|
27970
|
-
return total;
|
|
27971
|
-
};
|
|
27972
|
-
/**
|
|
27973
|
-
* A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
|
|
27974
|
-
* @remarks
|
|
27975
|
-
* Applied to: {@link GridComponent}.
|
|
27976
|
-
*/
|
|
27977
|
-
class GroupBindingDirective extends DataBindingDirective {
|
|
27978
|
-
groupsService;
|
|
27979
|
-
/**
|
|
27980
|
-
* The array of data which will be used to populate the Grid.
|
|
27981
|
-
*/
|
|
27982
|
-
set kendoGridGroupBinding(value) {
|
|
27983
|
-
this.groups = null;
|
|
27984
|
-
this.grid.resetGroupsState();
|
|
27985
|
-
this.data = value;
|
|
27986
|
-
}
|
|
27987
|
-
/**
|
|
27988
|
-
* @hidden
|
|
27989
|
-
*/
|
|
27990
|
-
set data(value) {
|
|
27991
|
-
this.originalData = value || [];
|
|
27992
|
-
this.dataChanged = true;
|
|
27993
|
-
}
|
|
27994
|
-
/**
|
|
27995
|
-
* Defines the descriptors by which the data will be sorted.
|
|
27996
|
-
*/
|
|
27997
|
-
set sort(value) {
|
|
27998
|
-
const noCurrentDescriptors = noDescriptors(this.state.sort);
|
|
27999
|
-
const noIncomingDescriptors = noDescriptors(value);
|
|
28000
|
-
const clear = this.state.sort !== value && !(noCurrentDescriptors && noIncomingDescriptors);
|
|
28001
|
-
this.grid.sort = this.state.sort = value;
|
|
28002
|
-
if (clear) {
|
|
28003
|
-
this.groups = null;
|
|
28004
|
-
this.grid.resetGroupsState();
|
|
28005
|
-
}
|
|
28006
|
-
}
|
|
28007
|
-
/**
|
|
28008
|
-
* Defines the descriptor by which the data will be filtered.
|
|
28009
|
-
*/
|
|
28010
|
-
set filter(value) {
|
|
28011
|
-
const clear = diffFilters(this.state.filter, value);
|
|
28012
|
-
if (clear) {
|
|
28013
|
-
this.state.filter = value;
|
|
28014
|
-
this.grid.filter = cloneFilters(value);
|
|
28015
|
-
this.groups = null;
|
|
28016
|
-
this.grid.resetGroupsState();
|
|
28017
|
-
}
|
|
28018
|
-
}
|
|
28019
|
-
/**
|
|
28020
|
-
* Defines the descriptors by which the data will be grouped.
|
|
28021
|
-
*/
|
|
28022
|
-
set group(value) {
|
|
28023
|
-
// don't clear if no groups are present in previous and current value
|
|
28024
|
-
const groupsPresent = groupDescriptorsPresent(this.state.group) || groupDescriptorsPresent(value);
|
|
28025
|
-
const clear = this.state.group !== value && groupsPresent;
|
|
28026
|
-
this.grid.group = this.state.group = value;
|
|
28027
|
-
if (clear) {
|
|
28028
|
-
this.groups = null;
|
|
28029
|
-
this.grid.resetGroupsState();
|
|
28030
|
-
this.skip = 0;
|
|
28031
|
-
}
|
|
28032
|
-
}
|
|
28033
|
-
groups;
|
|
28034
|
-
gridSubs = new Subscription();
|
|
28035
|
-
constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
|
|
28036
|
-
super(ctxService.grid, changeDetector, localDataChangesService, null, ctxService);
|
|
28037
|
-
this.groupsService = groupsService;
|
|
28038
|
-
ctxService.dataBindingDirective = this;
|
|
28039
|
-
}
|
|
28040
|
-
ngOnInit() {
|
|
28041
|
-
super.ngOnInit();
|
|
28042
|
-
this.gridSubs.add(this.grid.groupExpand.subscribe(this.groupExpand.bind(this)));
|
|
28043
|
-
this.gridSubs.add(this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this)));
|
|
28044
|
-
}
|
|
28045
|
-
ngAfterContentInit() {
|
|
28046
|
-
if (isDevMode() && this.grid.isGroupExpanded) {
|
|
28047
|
-
throw new Error(GridConfigurationErrorMessages.groupBindingDirectives);
|
|
28048
|
-
}
|
|
28049
|
-
}
|
|
28050
|
-
ngOnDestroy() {
|
|
28051
|
-
this.gridSubs.unsubscribe();
|
|
28052
|
-
}
|
|
28053
|
-
/**
|
|
28054
|
-
* @hidden
|
|
28055
|
-
*/
|
|
28056
|
-
toggleAll(expand) {
|
|
28057
|
-
this.skip = 0;
|
|
28058
|
-
this.grid.scrollTo({ row: 0, column: 0 });
|
|
28059
|
-
this.groups.forEach((gr, idx) => {
|
|
28060
|
-
const expanded = this.groupsService.isExpanded({
|
|
28061
|
-
group: gr,
|
|
28062
|
-
groupIndex: idx.toString(),
|
|
28063
|
-
parentGroup: undefined
|
|
28064
|
-
});
|
|
28065
|
-
const performToggle = (expand && !expanded) || (!expand && expanded);
|
|
28066
|
-
if (performToggle) {
|
|
28067
|
-
this.grid.groupsService.toggleRow({
|
|
28068
|
-
type: 'group',
|
|
28069
|
-
data: gr,
|
|
28070
|
-
index: idx.toString(),
|
|
28071
|
-
level: 0,
|
|
28072
|
-
parentGroup: undefined
|
|
28073
|
-
});
|
|
28074
|
-
this[expand ? 'groupExpand' : 'groupCollapse']({ groupIndex: idx.toString() });
|
|
28075
|
-
}
|
|
28076
|
-
});
|
|
28077
|
-
}
|
|
28078
|
-
/**
|
|
28079
|
-
* Collapses all expanded root level groups.
|
|
28080
|
-
*/
|
|
28081
|
-
collapseAll() {
|
|
28082
|
-
this.toggleAll(false);
|
|
28083
|
-
}
|
|
28084
|
-
/**
|
|
28085
|
-
* Expands all expanded root level groups.
|
|
28086
|
-
*/
|
|
28087
|
-
expandAll() {
|
|
28088
|
-
this.toggleAll(true);
|
|
28089
|
-
}
|
|
28090
|
-
/**
|
|
28091
|
-
* @hidden
|
|
28092
|
-
*/
|
|
28093
|
-
groupExpand({ groupIndex }) {
|
|
28094
|
-
const { group, parents } = findGroup(groupIndex, this.groups);
|
|
28095
|
-
if (!group) {
|
|
28096
|
-
return;
|
|
28097
|
-
}
|
|
28098
|
-
this.groupsService.expandChildren(groupIndex);
|
|
28099
|
-
if (!group.items.length) {
|
|
28100
|
-
const descriptors = this.state.group.filter(removeParentDescriptors(parents, group));
|
|
28101
|
-
const children = findChildren(this.originalData, parents.concat(group));
|
|
28102
|
-
group.items = processGroups(children, {
|
|
28103
|
-
filter: this.state.filter,
|
|
28104
|
-
group: descriptors,
|
|
28105
|
-
sort: this.state.sort
|
|
28106
|
-
});
|
|
28107
|
-
}
|
|
28108
|
-
this.grid.data = this.dataResult(this.state.skip, this.state.take);
|
|
28109
|
-
}
|
|
28110
|
-
/**
|
|
28111
|
-
* @hidden
|
|
28112
|
-
*/
|
|
28113
|
-
groupCollapse({ groupIndex }) {
|
|
28114
|
-
const { group } = findGroup(groupIndex, this.groups);
|
|
28115
|
-
if (group) {
|
|
28116
|
-
group.items = [];
|
|
28117
|
-
}
|
|
28118
|
-
else {
|
|
28119
|
-
return;
|
|
28120
|
-
}
|
|
28121
|
-
this.grid.data = this.dataResult(this.state.skip, this.state.take);
|
|
28122
|
-
}
|
|
28123
|
-
process(state) {
|
|
28124
|
-
if (state.group && state.group.length) {
|
|
28125
|
-
const groups = this.processGroups(state);
|
|
28126
|
-
this.grid.skip -= skippedHeaders(groups.data[0]);
|
|
28127
|
-
return groups;
|
|
28128
|
-
}
|
|
28129
|
-
else {
|
|
28130
|
-
this.groups = null;
|
|
28131
|
-
}
|
|
28132
|
-
return super.process(state);
|
|
28133
|
-
}
|
|
28134
|
-
processGroups(state) {
|
|
28135
|
-
if (!this.groups || !this.groups.length) {
|
|
28136
|
-
this.groups = processGroups(this.originalData, {
|
|
28137
|
-
filter: state.filter,
|
|
28138
|
-
group: state.group,
|
|
28139
|
-
sort: state.sort
|
|
28140
|
-
});
|
|
28141
|
-
}
|
|
28142
|
-
return this.dataResult(state.skip, state.take);
|
|
28143
|
-
}
|
|
28144
|
-
dataResult(skip, take) {
|
|
28145
|
-
const includeFooters = this.grid.showGroupFooters;
|
|
28146
|
-
return {
|
|
28147
|
-
data: slice(this.groups, skip, take, includeFooters),
|
|
28148
|
-
total: count(this.groups, includeFooters)
|
|
28149
|
-
};
|
|
28150
|
-
}
|
|
28151
|
-
applyState({ skip, take, sort, group, filter }) {
|
|
28152
|
-
this.skip = skip;
|
|
28153
|
-
this.state.take = take;
|
|
28154
|
-
// this.pageSize = take; // do need to update take as the process with slice correctly
|
|
28155
|
-
this.sort = sort;
|
|
28156
|
-
this.group = group;
|
|
28157
|
-
this.filter = filter;
|
|
28158
|
-
}
|
|
28159
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupBindingDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: LocalDataChangesService }, { token: ContextService }, { token: GroupsService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
28160
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: GroupBindingDirective, isStandalone: true, selector: "[kendoGridGroupBinding]", inputs: { kendoGridGroupBinding: "kendoGridGroupBinding", sort: "sort", filter: "filter", group: "group" }, exportAs: ["kendoGridGroupBinding"], usesInheritance: true, ngImport: i0 });
|
|
28161
|
-
}
|
|
28162
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupBindingDirective, decorators: [{
|
|
28163
|
-
type: Directive,
|
|
28164
|
-
args: [{
|
|
28165
|
-
selector: '[kendoGridGroupBinding]',
|
|
28166
|
-
exportAs: 'kendoGridGroupBinding',
|
|
28167
|
-
standalone: true
|
|
28168
|
-
}]
|
|
28169
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }, { type: ContextService }, { type: GroupsService }]; }, propDecorators: { kendoGridGroupBinding: [{
|
|
28170
|
-
type: Input,
|
|
28171
|
-
args: ["kendoGridGroupBinding"]
|
|
28172
|
-
}], sort: [{
|
|
28173
|
-
type: Input
|
|
28174
|
-
}], filter: [{
|
|
28175
|
-
type: Input
|
|
28176
|
-
}], group: [{
|
|
28177
|
-
type: Input
|
|
28178
|
-
}] } });
|
|
28179
|
-
|
|
28180
|
-
const createControl = (source) => (acc, key) => {
|
|
28181
|
-
acc[key] = new FormControl(source[key]);
|
|
28182
|
-
return acc;
|
|
28183
|
-
};
|
|
28184
|
-
const validateColumnsField = (columns) => expandColumns(columns.toArray())
|
|
28185
|
-
.filter(isColumnComponent)
|
|
28186
|
-
.filter(({ field }) => !isValidFieldName(field))
|
|
28187
|
-
.forEach(({ field }) => console.warn(ColumnConfigurationErrorMessages.fieldName(field)));
|
|
28188
|
-
const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group, emit }) => emit && isPresent(group)))
|
|
28189
|
-
.subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
|
|
28190
|
-
const handleExpandCollapseDetailsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ dataItem }) => isPresent(dataItem)))
|
|
28191
|
-
.subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
|
|
28192
|
-
const isInEditedCell = (element, gridElement) => closest(element, matchesClasses('k-grid-edit-cell')) &&
|
|
28193
|
-
closest(element, matchesNodeName('kendo-grid')) === gridElement;
|
|
28194
|
-
const NOTIFY_DELAY = 500;
|
|
28195
|
-
/**
|
|
28196
|
-
* Represents the Kendo UI for Angular Data Grid component.
|
|
28197
|
-
*
|
|
28198
|
-
* Use the `kendo-grid` component to display and manage tabular data.
|
|
28199
|
-
*
|
|
28200
|
-
* @example
|
|
28201
|
-
* ```html
|
|
28202
|
-
* <kendo-grid [data]="gridData"></kendo-grid>
|
|
28203
|
-
* ```
|
|
28204
|
-
*
|
|
28205
|
-
* @remarks
|
|
28206
|
-
* Supported children components are:
|
|
28207
|
-
* {@link CheckboxColumnComponent},
|
|
28208
|
-
* {@link ColumnChooserComponent},
|
|
28209
|
-
* {@link ColumnComponent},
|
|
28210
|
-
* {@link ColumnGroupComponent},
|
|
28211
|
-
* {@link ColumnMenuAutoSizeAllColumnsComponent},
|
|
28212
|
-
* {@link ColumnMenuAutoSizeColumnComponent},
|
|
28213
|
-
* {@link ColumnMenuChooserComponent},
|
|
28214
|
-
* {@link ColumnMenuComponent},
|
|
28215
|
-
* {@link ColumnMenuFilterComponent},
|
|
28216
|
-
* {@link ColumnMenuItemComponent},
|
|
28217
|
-
* {@link ColumnMenuLockComponent},
|
|
28218
|
-
* {@link ColumnMenuPositionComponent},
|
|
28219
|
-
* {@link ColumnMenuSortComponent},
|
|
28220
|
-
* {@link ColumnMenuStickComponent},
|
|
28221
|
-
* {@link CommandColumnComponent},
|
|
28222
|
-
* {@link CustomMessagesComponent},
|
|
28223
|
-
* {@link ExcelComponent},
|
|
28224
|
-
* {@link GridSpacerComponent},
|
|
28225
|
-
* {@link PDFComponent},
|
|
28226
|
-
* {@link RowReorderColumnComponent},
|
|
28227
|
-
* {@link SpanColumnComponent},
|
|
28228
|
-
* {@link ToolBarComponent}.
|
|
28229
|
-
*/
|
|
28230
|
-
class GridComponent {
|
|
28231
|
-
supportService;
|
|
28232
|
-
selectionService;
|
|
28233
|
-
cellSelectionService;
|
|
28234
|
-
wrapper;
|
|
28235
|
-
groupInfoService;
|
|
28236
|
-
groupsService;
|
|
28237
|
-
changeNotification;
|
|
28238
|
-
detailsService;
|
|
28239
|
-
editService;
|
|
28240
|
-
filterService;
|
|
28241
|
-
pdfService;
|
|
28242
|
-
responsiveService;
|
|
28243
|
-
renderer;
|
|
28244
|
-
excelService;
|
|
28245
|
-
ngZone;
|
|
28246
|
-
scrollSyncService;
|
|
28247
|
-
domEvents;
|
|
28248
|
-
columnResizingService;
|
|
28249
|
-
changeDetectorRef;
|
|
28250
|
-
columnReorderService;
|
|
28251
|
-
columnInfoService;
|
|
28252
|
-
navigationService;
|
|
28253
|
-
sortService;
|
|
28254
|
-
scrollRequestService;
|
|
28255
|
-
localization;
|
|
28256
|
-
ctx;
|
|
28257
|
-
sizingService;
|
|
28258
|
-
adaptiveGridService;
|
|
28259
|
-
rowReorderService;
|
|
28260
|
-
dataMappingService;
|
|
28261
|
-
/**
|
|
28262
|
-
* Sets the data of the Grid. If you provide an array, the Grid gets the total count automatically.
|
|
28263
|
-
* ([more information and example]({% slug binding_grid %})).
|
|
28264
|
-
*/
|
|
28265
|
-
set data(value) {
|
|
28266
|
-
this._data = value;
|
|
28267
|
-
if (this.selectable && this.selectableSettings?.enabled && this.isVirtual) {
|
|
28268
|
-
this.blockArrowSelection = false;
|
|
28269
|
-
}
|
|
28270
|
-
if (this.notifyTimeout) {
|
|
28271
|
-
clearTimeout(this.notifyTimeout);
|
|
28272
|
-
this.notifyTimeout = null;
|
|
28273
|
-
}
|
|
28274
|
-
if (this.rowReorderable) {
|
|
28275
|
-
this.ngZone.runOutsideAngular(() => {
|
|
28276
|
-
this.notifyTimeout = setTimeout(() => {
|
|
28277
|
-
this.notifyReorderContainers();
|
|
28278
|
-
}, NOTIFY_DELAY);
|
|
28279
|
-
});
|
|
28280
|
-
}
|
|
28281
|
-
}
|
|
28282
|
-
get data() {
|
|
28283
|
-
return this._data;
|
|
28284
|
-
}
|
|
28285
|
-
get hintText() {
|
|
28286
|
-
return this.rowReorderService.getDefaultHintText(this.columnList, this.flatData);
|
|
28287
|
-
}
|
|
28288
|
-
/**
|
|
28289
|
-
* @hidden
|
|
28290
|
-
*/
|
|
28291
|
-
get customHintTemplate() {
|
|
28292
|
-
if (this.rowReorderable) {
|
|
28293
|
-
const allColumns = this.columnList.toArray();
|
|
28294
|
-
const rowReorderColumn = allColumns.find(column => column.isRowReorderColumn);
|
|
28295
|
-
return rowReorderColumn.rowDragHintTemplateRef;
|
|
28296
|
-
}
|
|
28297
|
-
}
|
|
28298
|
-
/**
|
|
28299
|
-
* @hidden
|
|
28300
|
-
*/
|
|
28301
|
-
get hintContext() {
|
|
28302
|
-
if (this.customHintTemplate) {
|
|
28303
|
-
const draggedRow = this.rowReorderService?.getDraggedRow(this.flatData);
|
|
28304
|
-
return {
|
|
28305
|
-
$implicit: draggedRow?.dataItem,
|
|
28306
|
-
rowIndex: draggedRow?.rowIndex
|
|
28307
|
-
};
|
|
28308
|
-
}
|
|
28309
|
-
}
|
|
28310
|
-
/**
|
|
28311
|
-
* Defines the page size used by the Grid pager.
|
|
28312
|
-
* Required for the [`paging`]({% slug paging_grid %}) feature.
|
|
28313
|
-
*/
|
|
28314
|
-
pageSize;
|
|
28315
|
-
/**
|
|
28316
|
-
* Defines the height in pixels for the Grid when `scrollable` is set.
|
|
28317
|
-
* You can also set the height using `style.height` with units like `px`, `%`, `em`, or `rem`.
|
|
28318
|
-
*/
|
|
28319
|
-
height;
|
|
28320
|
-
/**
|
|
28321
|
-
* Represents the row height in pixels for each Grid row (`tr`) element.
|
|
28322
|
-
* Required for [virtual scrolling]({% slug scrollmmodes_grid %}).
|
|
28323
|
-
* Set `rowHeight` to match the actual DOM row height. The property does not change the height of the rows in the UI.
|
|
28324
|
-
*/
|
|
28325
|
-
rowHeight;
|
|
28326
|
-
/**
|
|
28327
|
-
* Enables or disables adaptive mode. Adaptive rendering is off by default.
|
|
28328
|
-
*
|
|
28329
|
-
* @default 'none'
|
|
28330
|
-
*/
|
|
28331
|
-
adaptiveMode = 'none';
|
|
28332
|
-
/**
|
|
28333
|
-
* Represents the height in pixels for each Grid detail row (`tr`) element.
|
|
28334
|
-
* Required for [virtual scrolling]({% slug scrollmmodes_grid %}).
|
|
28335
|
-
* Set `detailRowHeight` to match the actual DOM detail row height. The property does not change the height of the rows in the UI.
|
|
28336
|
-
*/
|
|
28337
|
-
detailRowHeight;
|
|
28338
|
-
/**
|
|
28339
|
-
* Defines the number of records to skip in the pager.
|
|
28340
|
-
* Required for the [`paging`]({% slug paging_grid %}) feature.
|
|
28341
|
-
*/
|
|
28342
|
-
get skip() {
|
|
28343
|
-
return this._skip;
|
|
28344
|
-
}
|
|
28345
|
-
set skip(value) {
|
|
28346
|
-
if (typeof value === 'number' && value >= 0) {
|
|
28347
|
-
this._skip = this.rowReorderService.skip = value;
|
|
28348
|
-
}
|
|
28349
|
-
}
|
|
28350
|
-
/**
|
|
28351
|
-
* Defines the scroll mode for the Grid.
|
|
28352
|
-
*
|
|
28353
|
-
* @default 'scrollable'
|
|
28354
|
-
*/
|
|
28355
|
-
scrollable = 'scrollable';
|
|
28356
|
-
/**
|
|
28357
|
-
* Enables the selection feature of the Grid. The `selectable` property can be set to `true`, `false`, or an object with additional settings.
|
|
28358
|
-
* [See example](slug:grid_row_selection).
|
|
28359
|
-
*
|
|
28360
|
-
* @default false
|
|
28361
|
-
*/
|
|
28362
|
-
selectable = false;
|
|
28363
|
-
/**
|
|
28364
|
-
* Sets the descriptors for sorting the data ([see example]({% slug sorting_grid %})).
|
|
27832
|
+
* Sets the descriptors for sorting the data ([see example]({% slug sorting_grid %})).
|
|
28365
27833
|
*/
|
|
28366
27834
|
set sort(value) {
|
|
28367
27835
|
if (isArray(value)) {
|
|
@@ -30353,7 +29821,7 @@ class GridComponent {
|
|
|
30353
29821
|
}
|
|
30354
29822
|
if (this.groupsService.isExpanded({ groupIndex: index }) !== expand) {
|
|
30355
29823
|
this.groupsService.toggleRow({ index }, false);
|
|
30356
|
-
if (this.ctx.dataBindingDirective && this.ctx.dataBindingDirective
|
|
29824
|
+
if (this.ctx.dataBindingDirective && isPresent(this.ctx.dataBindingDirective.groupExpand)) {
|
|
30357
29825
|
this.ctx.dataBindingDirective[`group${expand ? 'Expand' : 'Collapse'}`]({ groupIndex: index });
|
|
30358
29826
|
}
|
|
30359
29827
|
}
|
|
@@ -32293,7 +31761,215 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
32293
31761
|
template: ``,
|
|
32294
31762
|
standalone: true
|
|
32295
31763
|
}]
|
|
32296
|
-
}], ctorParameters: function () { return [{ type: i1$2.LocalizationService }]; } });
|
|
31764
|
+
}], ctorParameters: function () { return [{ type: i1$2.LocalizationService }]; } });
|
|
31765
|
+
|
|
31766
|
+
/**
|
|
31767
|
+
* A directive that handles in-memory data operations like [paging]({% slug paging_grid %}),
|
|
31768
|
+
* [sorting]({% slug sorting_grid %}), and [grouping]({% slug grouping_grid %}).
|
|
31769
|
+
*
|
|
31770
|
+
* Use this directive with local data and enable the Grid data operations with minimal configuration.
|
|
31771
|
+
* ([More information and examples]({% slug local_data_grid %}#toc-using-the-data-binding-directive)).
|
|
31772
|
+
*
|
|
31773
|
+
* @example
|
|
31774
|
+
* ```html
|
|
31775
|
+
* <kendo-grid [kendoGridBinding]="gridData"></kendo-grid>
|
|
31776
|
+
* ```
|
|
31777
|
+
* @remarks
|
|
31778
|
+
* Applied to: {@link GridComponent}.
|
|
31779
|
+
*/
|
|
31780
|
+
class DataBindingDirective {
|
|
31781
|
+
grid;
|
|
31782
|
+
changeDetector;
|
|
31783
|
+
localDataChangesService;
|
|
31784
|
+
rowReorderService;
|
|
31785
|
+
/**
|
|
31786
|
+
* Sets the number of records to skip in the Grid.
|
|
31787
|
+
*
|
|
31788
|
+
* @default 0
|
|
31789
|
+
*/
|
|
31790
|
+
set skip(value) {
|
|
31791
|
+
if (!isPresent(value)) {
|
|
31792
|
+
value = 0;
|
|
31793
|
+
}
|
|
31794
|
+
this.grid.skip = this.state.skip = value;
|
|
31795
|
+
if (this.rowReorderService) {
|
|
31796
|
+
this.rowReorderService.skip = value;
|
|
31797
|
+
}
|
|
31798
|
+
}
|
|
31799
|
+
/**
|
|
31800
|
+
* Sets the sort descriptors for the Grid data.
|
|
31801
|
+
*
|
|
31802
|
+
*/
|
|
31803
|
+
set sort(value) {
|
|
31804
|
+
this.grid.sort = this.state.sort = value;
|
|
31805
|
+
}
|
|
31806
|
+
/**
|
|
31807
|
+
* Sets the filter descriptor for the Grid data.
|
|
31808
|
+
*
|
|
31809
|
+
*/
|
|
31810
|
+
set filter(value) {
|
|
31811
|
+
this.grid.filter = this.state.filter = value;
|
|
31812
|
+
}
|
|
31813
|
+
/**
|
|
31814
|
+
* Sets the page size for the Grid pager.
|
|
31815
|
+
*
|
|
31816
|
+
*/
|
|
31817
|
+
set pageSize(value) {
|
|
31818
|
+
this.grid.pageSize = this.state.take = value;
|
|
31819
|
+
}
|
|
31820
|
+
/**
|
|
31821
|
+
* Sets the group descriptors for the Grid data.
|
|
31822
|
+
*
|
|
31823
|
+
*/
|
|
31824
|
+
set group(value) {
|
|
31825
|
+
this.grid.group = this.state.group = value;
|
|
31826
|
+
}
|
|
31827
|
+
/**
|
|
31828
|
+
* Sets the data array for the Grid.
|
|
31829
|
+
*
|
|
31830
|
+
*/
|
|
31831
|
+
set data(value) {
|
|
31832
|
+
this.originalData = value || [];
|
|
31833
|
+
if (this.localDataChangesService) {
|
|
31834
|
+
this.localDataChangesService.data = value;
|
|
31835
|
+
}
|
|
31836
|
+
this.dataChanged = true;
|
|
31837
|
+
}
|
|
31838
|
+
state = {
|
|
31839
|
+
skip: 0
|
|
31840
|
+
};
|
|
31841
|
+
originalData = [];
|
|
31842
|
+
dataChanged;
|
|
31843
|
+
stateChangeSubscription;
|
|
31844
|
+
dataChangedSubscription;
|
|
31845
|
+
rowReorderSubscription;
|
|
31846
|
+
constructor(grid, changeDetector, localDataChangesService, rowReorderService, ctx) {
|
|
31847
|
+
this.grid = grid;
|
|
31848
|
+
this.changeDetector = changeDetector;
|
|
31849
|
+
this.localDataChangesService = localDataChangesService;
|
|
31850
|
+
this.rowReorderService = rowReorderService;
|
|
31851
|
+
if (localDataChangesService) {
|
|
31852
|
+
this.dataChangedSubscription = this.localDataChangesService.changes.subscribe(this.rebind.bind(this));
|
|
31853
|
+
}
|
|
31854
|
+
ctx && (ctx.dataBindingDirective = this);
|
|
31855
|
+
}
|
|
31856
|
+
/**
|
|
31857
|
+
* @hidden
|
|
31858
|
+
*/
|
|
31859
|
+
ngOnInit() {
|
|
31860
|
+
this.applyState(this.state);
|
|
31861
|
+
this.stateChangeSubscription = this.grid
|
|
31862
|
+
.dataStateChange
|
|
31863
|
+
.subscribe(this.onStateChange.bind(this));
|
|
31864
|
+
if (this.rowReorderService) {
|
|
31865
|
+
this.rowReorderSubscription = this.grid
|
|
31866
|
+
.rowReorder
|
|
31867
|
+
.subscribe(this.onRowReorder.bind(this));
|
|
31868
|
+
}
|
|
31869
|
+
}
|
|
31870
|
+
/**
|
|
31871
|
+
* @hidden
|
|
31872
|
+
*/
|
|
31873
|
+
ngOnDestroy() {
|
|
31874
|
+
if (this.stateChangeSubscription) {
|
|
31875
|
+
this.stateChangeSubscription.unsubscribe();
|
|
31876
|
+
}
|
|
31877
|
+
if (this.dataChangedSubscription) {
|
|
31878
|
+
this.dataChangedSubscription.unsubscribe();
|
|
31879
|
+
}
|
|
31880
|
+
if (this.rowReorderSubscription) {
|
|
31881
|
+
this.rowReorderSubscription.unsubscribe();
|
|
31882
|
+
}
|
|
31883
|
+
}
|
|
31884
|
+
/**
|
|
31885
|
+
* @hidden
|
|
31886
|
+
*/
|
|
31887
|
+
ngOnChanges(changes) {
|
|
31888
|
+
if (anyChanged(["pageSize", "skip", "sort", "group", "filter"], changes)) {
|
|
31889
|
+
this.rebind();
|
|
31890
|
+
}
|
|
31891
|
+
}
|
|
31892
|
+
ngDoCheck() {
|
|
31893
|
+
if (this.dataChanged) {
|
|
31894
|
+
this.updateGridData();
|
|
31895
|
+
}
|
|
31896
|
+
}
|
|
31897
|
+
/**
|
|
31898
|
+
* @hidden
|
|
31899
|
+
*/
|
|
31900
|
+
onStateChange(state) {
|
|
31901
|
+
this.applyState(state);
|
|
31902
|
+
this.rebind();
|
|
31903
|
+
}
|
|
31904
|
+
/**
|
|
31905
|
+
* @hidden
|
|
31906
|
+
*/
|
|
31907
|
+
onRowReorder(ev) {
|
|
31908
|
+
this.rowReorderService.reorderRows(ev, this.originalData);
|
|
31909
|
+
this.rebind();
|
|
31910
|
+
}
|
|
31911
|
+
/**
|
|
31912
|
+
* @hidden
|
|
31913
|
+
*/
|
|
31914
|
+
rebind() {
|
|
31915
|
+
this.data = this.originalData;
|
|
31916
|
+
this.updateGridData();
|
|
31917
|
+
this.notifyDataChange();
|
|
31918
|
+
}
|
|
31919
|
+
/**
|
|
31920
|
+
* Notifies the Grid that its data has changed.
|
|
31921
|
+
*/
|
|
31922
|
+
notifyDataChange() {
|
|
31923
|
+
this.grid.onDataChange();
|
|
31924
|
+
if (this.changeDetector) {
|
|
31925
|
+
this.changeDetector.markForCheck();
|
|
31926
|
+
}
|
|
31927
|
+
}
|
|
31928
|
+
process(state) {
|
|
31929
|
+
if (this.grid.isVirtual && (!isPresent(state.take) || state.take === 0)) {
|
|
31930
|
+
return {
|
|
31931
|
+
data: [],
|
|
31932
|
+
total: this.originalData?.length || 0
|
|
31933
|
+
};
|
|
31934
|
+
}
|
|
31935
|
+
return process(this.originalData, state);
|
|
31936
|
+
}
|
|
31937
|
+
applyState({ skip, take, sort, group, filter }) {
|
|
31938
|
+
this.skip = skip;
|
|
31939
|
+
this.pageSize = take;
|
|
31940
|
+
this.sort = sort;
|
|
31941
|
+
this.group = group;
|
|
31942
|
+
this.filter = filter;
|
|
31943
|
+
}
|
|
31944
|
+
updateGridData() {
|
|
31945
|
+
this.grid.data = this.process(this.state);
|
|
31946
|
+
this.grid.updateNavigationMetadata();
|
|
31947
|
+
this.dataChanged = false;
|
|
31948
|
+
}
|
|
31949
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataBindingDirective, deps: [{ token: GridComponent }, { token: i0.ChangeDetectorRef }, { token: LocalDataChangesService }, { token: RowReorderService }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
31950
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: DataBindingDirective, isStandalone: true, selector: "[kendoGridBinding]", inputs: { skip: "skip", sort: "sort", filter: "filter", pageSize: "pageSize", group: "group", data: ["kendoGridBinding", "data"] }, exportAs: ["kendoGridBinding"], usesOnChanges: true, ngImport: i0 });
|
|
31951
|
+
}
|
|
31952
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataBindingDirective, decorators: [{
|
|
31953
|
+
type: Directive,
|
|
31954
|
+
args: [{
|
|
31955
|
+
selector: '[kendoGridBinding]',
|
|
31956
|
+
exportAs: 'kendoGridBinding',
|
|
31957
|
+
standalone: true
|
|
31958
|
+
}]
|
|
31959
|
+
}], ctorParameters: function () { return [{ type: GridComponent }, { type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }, { type: RowReorderService }, { type: ContextService }]; }, propDecorators: { skip: [{
|
|
31960
|
+
type: Input
|
|
31961
|
+
}], sort: [{
|
|
31962
|
+
type: Input
|
|
31963
|
+
}], filter: [{
|
|
31964
|
+
type: Input
|
|
31965
|
+
}], pageSize: [{
|
|
31966
|
+
type: Input
|
|
31967
|
+
}], group: [{
|
|
31968
|
+
type: Input
|
|
31969
|
+
}], data: [{
|
|
31970
|
+
type: Input,
|
|
31971
|
+
args: ["kendoGridBinding"]
|
|
31972
|
+
}] } });
|
|
32297
31973
|
|
|
32298
31974
|
/**
|
|
32299
31975
|
* Stores the row selection state of the Grid in memory
|
|
@@ -33072,128 +32748,452 @@ const DEFAULT_KEY_GETTER = (groupRowArgs) => ({
|
|
|
33072
32748
|
parentGroupKeys: mapParentGroup(groupRowArgs.parentGroup)
|
|
33073
32749
|
});
|
|
33074
32750
|
/**
|
|
33075
|
-
* Controls the expanded state of group rows in the Grid.
|
|
33076
|
-
* Use this directive to manage which group rows are expanded or collapsed
|
|
33077
|
-
* ([see example]({% slug groups_expanded_state_grid %}#toc-built-in-directive)).
|
|
33078
|
-
*
|
|
33079
|
-
* @example
|
|
33080
|
-
* ```typescript
|
|
33081
|
-
* <kendo-grid [kendoGridExpandGroupBy]="expandGroupBy" [expandedGroupKeys]="expandedGroupKeys"></kendo-grid>
|
|
33082
|
-
* ```
|
|
32751
|
+
* Controls the expanded state of group rows in the Grid.
|
|
32752
|
+
* Use this directive to manage which group rows are expanded or collapsed
|
|
32753
|
+
* ([see example]({% slug groups_expanded_state_grid %}#toc-built-in-directive)).
|
|
32754
|
+
*
|
|
32755
|
+
* @example
|
|
32756
|
+
* ```typescript
|
|
32757
|
+
* <kendo-grid [kendoGridExpandGroupBy]="expandGroupBy" [expandedGroupKeys]="expandedGroupKeys"></kendo-grid>
|
|
32758
|
+
* ```
|
|
32759
|
+
* @remarks
|
|
32760
|
+
* Applied to: {@link GridComponent}.
|
|
32761
|
+
*/
|
|
32762
|
+
class ExpandGroupDirective {
|
|
32763
|
+
grid;
|
|
32764
|
+
/**
|
|
32765
|
+
* Fires when the `expandedGroupKeys` collection changes.
|
|
32766
|
+
*/
|
|
32767
|
+
expandedGroupKeysChange = new EventEmitter();
|
|
32768
|
+
/**
|
|
32769
|
+
* Sets the item format stored in the `expandedGroupKeys` collection.
|
|
32770
|
+
* Accepts a property name or a function that returns a unique key for each group
|
|
32771
|
+
* ([see example]({% slug groups_expanded_state_grid %}#toc-custom-group-key-format)).
|
|
32772
|
+
*/
|
|
32773
|
+
get expandGroupBy() {
|
|
32774
|
+
return this._expandGroupBy;
|
|
32775
|
+
}
|
|
32776
|
+
set expandGroupBy(key) {
|
|
32777
|
+
if (typeof key === 'function') {
|
|
32778
|
+
this._expandGroupBy = key;
|
|
32779
|
+
}
|
|
32780
|
+
}
|
|
32781
|
+
/**
|
|
32782
|
+
* Holds the collection of expanded group keys.
|
|
32783
|
+
* Set this property to control which group rows are expanded.
|
|
32784
|
+
*/
|
|
32785
|
+
get expandedGroupKeys() {
|
|
32786
|
+
return this._expandedGroupKeys;
|
|
32787
|
+
}
|
|
32788
|
+
set expandedGroupKeys(expandedGroups) {
|
|
32789
|
+
this._expandedGroupKeys = (expandedGroups || []).slice();
|
|
32790
|
+
}
|
|
32791
|
+
/**
|
|
32792
|
+
* Specifies if group items are expanded by default.
|
|
32793
|
+
* @default false
|
|
32794
|
+
*/
|
|
32795
|
+
groupsInitiallyExpanded = false;
|
|
32796
|
+
_expandGroupBy;
|
|
32797
|
+
_expandedGroupKeys;
|
|
32798
|
+
subscriptions = new Subscription();
|
|
32799
|
+
constructor(grid) {
|
|
32800
|
+
this.grid = grid;
|
|
32801
|
+
this.grid.isGroupExpanded = this.isExpanded.bind(this);
|
|
32802
|
+
this.subscriptions.add(merge(this.grid.groupExpand.pipe(map(e => ({ expand: true, ...e }))), this.grid.groupCollapse.pipe(map(e => ({ expand: false, ...e })))).subscribe(this.toggleState.bind(this)));
|
|
32803
|
+
}
|
|
32804
|
+
ngOnDestroy() {
|
|
32805
|
+
this.subscriptions.unsubscribe();
|
|
32806
|
+
}
|
|
32807
|
+
get keyGetter() {
|
|
32808
|
+
return this.expandGroupBy || DEFAULT_KEY_GETTER;
|
|
32809
|
+
}
|
|
32810
|
+
/**
|
|
32811
|
+
* @hidden
|
|
32812
|
+
*/
|
|
32813
|
+
isExpanded(groupArgs) {
|
|
32814
|
+
const itemIndex = this.getItemIndex(groupArgs);
|
|
32815
|
+
return itemIndex > -1 ? !this.groupsInitiallyExpanded : this.groupsInitiallyExpanded;
|
|
32816
|
+
}
|
|
32817
|
+
getItemIndex(groupArgs) {
|
|
32818
|
+
if (this.expandGroupBy) {
|
|
32819
|
+
return this.expandedGroupKeys.indexOf(this.keyGetter(groupArgs));
|
|
32820
|
+
}
|
|
32821
|
+
return this.expandedGroupKeys.findIndex(item => {
|
|
32822
|
+
let index = 0;
|
|
32823
|
+
let parentGroup = groupArgs.parentGroup;
|
|
32824
|
+
while (isPresent(parentGroup)) {
|
|
32825
|
+
if (!isPresent(item.parentGroupKeys) || !isPresent(item.parentGroupKeys[index]) ||
|
|
32826
|
+
parentGroup.group.value !== item.parentGroupKeys[index].value ||
|
|
32827
|
+
parentGroup.group.field !== item.parentGroupKeys[index].field) {
|
|
32828
|
+
return false;
|
|
32829
|
+
}
|
|
32830
|
+
parentGroup = parentGroup.parentGroup;
|
|
32831
|
+
index++;
|
|
32832
|
+
}
|
|
32833
|
+
return item.value === groupArgs.group.value && item.field === groupArgs.group.field;
|
|
32834
|
+
});
|
|
32835
|
+
}
|
|
32836
|
+
toggleState(groupArgs) {
|
|
32837
|
+
const key = this.keyGetter(groupArgs);
|
|
32838
|
+
if (Boolean(this.groupsInitiallyExpanded) !== groupArgs.expand) {
|
|
32839
|
+
this.expandedGroupKeys.push(key);
|
|
32840
|
+
}
|
|
32841
|
+
else {
|
|
32842
|
+
const index = this.expandedGroupKeys.findIndex(group => {
|
|
32843
|
+
if (this.expandGroupBy) {
|
|
32844
|
+
return group === key;
|
|
32845
|
+
}
|
|
32846
|
+
else if (key.parentGroupKeys?.length === 0) {
|
|
32847
|
+
return group.value === key.value;
|
|
32848
|
+
}
|
|
32849
|
+
return JSON.stringify(group) === JSON.stringify(key);
|
|
32850
|
+
});
|
|
32851
|
+
this.expandedGroupKeys.splice(index, 1);
|
|
32852
|
+
}
|
|
32853
|
+
this.expandedGroupKeysChange.emit(this.expandedGroupKeys.slice());
|
|
32854
|
+
}
|
|
32855
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExpandGroupDirective, deps: [{ token: GridComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
|
32856
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ExpandGroupDirective, isStandalone: true, selector: "[kendoGridExpandGroupBy]", inputs: { expandGroupBy: ["kendoGridExpandGroupBy", "expandGroupBy"], expandedGroupKeys: "expandedGroupKeys", groupsInitiallyExpanded: "groupsInitiallyExpanded" }, outputs: { expandedGroupKeysChange: "expandedGroupKeysChange" }, exportAs: ["kendoGridExpandGroupBy"], ngImport: i0 });
|
|
32857
|
+
}
|
|
32858
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExpandGroupDirective, decorators: [{
|
|
32859
|
+
type: Directive,
|
|
32860
|
+
args: [{
|
|
32861
|
+
selector: '[kendoGridExpandGroupBy]',
|
|
32862
|
+
exportAs: 'kendoGridExpandGroupBy',
|
|
32863
|
+
standalone: true
|
|
32864
|
+
}]
|
|
32865
|
+
}], ctorParameters: function () { return [{ type: GridComponent }]; }, propDecorators: { expandedGroupKeysChange: [{
|
|
32866
|
+
type: Output
|
|
32867
|
+
}], expandGroupBy: [{
|
|
32868
|
+
type: Input,
|
|
32869
|
+
args: ['kendoGridExpandGroupBy']
|
|
32870
|
+
}], expandedGroupKeys: [{
|
|
32871
|
+
type: Input
|
|
32872
|
+
}], groupsInitiallyExpanded: [{
|
|
32873
|
+
type: Input
|
|
32874
|
+
}] } });
|
|
32875
|
+
|
|
32876
|
+
const hasGroups = (items) => items && items.length && items[0].field && items[0].items;
|
|
32877
|
+
const groupDescriptorsPresent = (descriptors) => isPresent(descriptors) && descriptors.length > 0;
|
|
32878
|
+
const processGroups = (data, state) => process(data, state).data;
|
|
32879
|
+
const removeParentDescriptors = (parents, owner) => g => g.field !== owner.field && !parents.some(y => y.field === g.field);
|
|
32880
|
+
const findGroup = (groupIndex, groups) => {
|
|
32881
|
+
const parents = [];
|
|
32882
|
+
return {
|
|
32883
|
+
group: groupIndex.split("_").reduce((acc, x) => {
|
|
32884
|
+
const idx = parseInt(x, 10);
|
|
32885
|
+
if (acc.items) {
|
|
32886
|
+
parents.push(acc);
|
|
32887
|
+
return acc.items[idx];
|
|
32888
|
+
}
|
|
32889
|
+
return isArray(acc) ? acc[idx] : acc;
|
|
32890
|
+
}, groups),
|
|
32891
|
+
parents
|
|
32892
|
+
};
|
|
32893
|
+
};
|
|
32894
|
+
const findChildren = (data, parents) => {
|
|
32895
|
+
const filters = parents.map(p => ({ field: p.field, operator: "eq", value: p.value }));
|
|
32896
|
+
return filterBy(data, {
|
|
32897
|
+
filters: filters,
|
|
32898
|
+
logic: "and"
|
|
32899
|
+
});
|
|
32900
|
+
};
|
|
32901
|
+
/**
|
|
32902
|
+
* @hidden
|
|
32903
|
+
*/
|
|
32904
|
+
const count = (groups, includeFooters = false) => (groups.reduce((acc, group) => {
|
|
32905
|
+
if (!group.skipHeader) {
|
|
32906
|
+
acc++;
|
|
32907
|
+
}
|
|
32908
|
+
if (group.items) {
|
|
32909
|
+
const children = count(group.items, includeFooters);
|
|
32910
|
+
if (includeFooters && children && !group.hideFooter) {
|
|
32911
|
+
acc++;
|
|
32912
|
+
}
|
|
32913
|
+
acc += children;
|
|
32914
|
+
}
|
|
32915
|
+
return acc;
|
|
32916
|
+
}, 0));
|
|
32917
|
+
/**
|
|
32918
|
+
* @hidden
|
|
32919
|
+
*/
|
|
32920
|
+
const noDescriptors = (descriptors) => !isPresent(descriptors) || !descriptors.length;
|
|
32921
|
+
/**
|
|
32922
|
+
* @hidden
|
|
32923
|
+
*/
|
|
32924
|
+
const slice = (groups, skip, take, includeFooters = false) => {
|
|
32925
|
+
if (!isPresent(take)) {
|
|
32926
|
+
return groups;
|
|
32927
|
+
}
|
|
32928
|
+
const result = [];
|
|
32929
|
+
for (let idx = 0, length = groups.length; idx < length; idx++) {
|
|
32930
|
+
if (take <= 0) {
|
|
32931
|
+
break;
|
|
32932
|
+
}
|
|
32933
|
+
const group = groups[idx];
|
|
32934
|
+
const groupItems = group.items;
|
|
32935
|
+
let itemCount = count(groupItems, includeFooters);
|
|
32936
|
+
if (includeFooters && groupItems.length) {
|
|
32937
|
+
itemCount++;
|
|
32938
|
+
}
|
|
32939
|
+
const skipHeader = skip > 0;
|
|
32940
|
+
if (skip) {
|
|
32941
|
+
skip--;
|
|
32942
|
+
if (itemCount && skip >= itemCount) {
|
|
32943
|
+
skip -= itemCount;
|
|
32944
|
+
continue;
|
|
32945
|
+
}
|
|
32946
|
+
}
|
|
32947
|
+
if (!skipHeader || itemCount) {
|
|
32948
|
+
const items = [];
|
|
32949
|
+
let hideFooter = true;
|
|
32950
|
+
if (!skipHeader) {
|
|
32951
|
+
take--;
|
|
32952
|
+
}
|
|
32953
|
+
if (take) {
|
|
32954
|
+
if (hasGroups(groupItems)) {
|
|
32955
|
+
const children = slice(groupItems, skip, take, includeFooters);
|
|
32956
|
+
items.push(...children);
|
|
32957
|
+
take -= count(children, includeFooters);
|
|
32958
|
+
}
|
|
32959
|
+
else {
|
|
32960
|
+
items.push(...groupItems.slice(skip, Math.min(skip + take, groupItems.length)));
|
|
32961
|
+
take -= items.length;
|
|
32962
|
+
}
|
|
32963
|
+
if (take && includeFooters) {
|
|
32964
|
+
hideFooter = false;
|
|
32965
|
+
take--;
|
|
32966
|
+
}
|
|
32967
|
+
skip = 0;
|
|
32968
|
+
}
|
|
32969
|
+
result.push({
|
|
32970
|
+
aggregates: group.aggregates,
|
|
32971
|
+
field: group.field,
|
|
32972
|
+
hideFooter,
|
|
32973
|
+
items,
|
|
32974
|
+
offset: idx,
|
|
32975
|
+
skipHeader,
|
|
32976
|
+
value: group.value
|
|
32977
|
+
});
|
|
32978
|
+
}
|
|
32979
|
+
}
|
|
32980
|
+
return result;
|
|
32981
|
+
};
|
|
32982
|
+
const skippedHeaders = (groupItem) => {
|
|
32983
|
+
let total = 0;
|
|
32984
|
+
while (groupItem) {
|
|
32985
|
+
if (groupItem.skipHeader) {
|
|
32986
|
+
total++;
|
|
32987
|
+
}
|
|
32988
|
+
groupItem = groupItem.items && groupItem.items[0] || null;
|
|
32989
|
+
}
|
|
32990
|
+
return total;
|
|
32991
|
+
};
|
|
32992
|
+
/**
|
|
32993
|
+
* A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
|
|
33083
32994
|
* @remarks
|
|
33084
32995
|
* Applied to: {@link GridComponent}.
|
|
33085
32996
|
*/
|
|
33086
|
-
class
|
|
33087
|
-
|
|
32997
|
+
class GroupBindingDirective extends DataBindingDirective {
|
|
32998
|
+
groupsService;
|
|
33088
32999
|
/**
|
|
33089
|
-
*
|
|
33000
|
+
* The array of data which will be used to populate the Grid.
|
|
33090
33001
|
*/
|
|
33091
|
-
|
|
33002
|
+
set kendoGridGroupBinding(value) {
|
|
33003
|
+
this.groups = null;
|
|
33004
|
+
this.grid.resetGroupsState();
|
|
33005
|
+
this.data = value;
|
|
33006
|
+
}
|
|
33092
33007
|
/**
|
|
33093
|
-
*
|
|
33094
|
-
* Accepts a property name or a function that returns a unique key for each group
|
|
33095
|
-
* ([see example]({% slug groups_expanded_state_grid %}#toc-custom-group-key-format)).
|
|
33008
|
+
* @hidden
|
|
33096
33009
|
*/
|
|
33097
|
-
|
|
33098
|
-
|
|
33010
|
+
set data(value) {
|
|
33011
|
+
this.originalData = value || [];
|
|
33012
|
+
this.dataChanged = true;
|
|
33099
33013
|
}
|
|
33100
|
-
|
|
33101
|
-
|
|
33102
|
-
|
|
33014
|
+
/**
|
|
33015
|
+
* Defines the descriptors by which the data will be sorted.
|
|
33016
|
+
*/
|
|
33017
|
+
set sort(value) {
|
|
33018
|
+
const noCurrentDescriptors = noDescriptors(this.state.sort);
|
|
33019
|
+
const noIncomingDescriptors = noDescriptors(value);
|
|
33020
|
+
const clear = this.state.sort !== value && !(noCurrentDescriptors && noIncomingDescriptors);
|
|
33021
|
+
this.grid.sort = this.state.sort = value;
|
|
33022
|
+
if (clear) {
|
|
33023
|
+
this.groups = null;
|
|
33024
|
+
this.grid.resetGroupsState();
|
|
33103
33025
|
}
|
|
33104
33026
|
}
|
|
33105
33027
|
/**
|
|
33106
|
-
*
|
|
33107
|
-
* Set this property to control which group rows are expanded.
|
|
33028
|
+
* Defines the descriptor by which the data will be filtered.
|
|
33108
33029
|
*/
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
33112
|
-
|
|
33113
|
-
|
|
33030
|
+
set filter(value) {
|
|
33031
|
+
const clear = diffFilters(this.state.filter, value);
|
|
33032
|
+
if (clear) {
|
|
33033
|
+
this.state.filter = value;
|
|
33034
|
+
this.grid.filter = cloneFilters(value);
|
|
33035
|
+
this.groups = null;
|
|
33036
|
+
this.grid.resetGroupsState();
|
|
33037
|
+
}
|
|
33114
33038
|
}
|
|
33115
33039
|
/**
|
|
33116
|
-
*
|
|
33117
|
-
* @default false
|
|
33040
|
+
* Defines the descriptors by which the data will be grouped.
|
|
33118
33041
|
*/
|
|
33119
|
-
|
|
33120
|
-
|
|
33121
|
-
|
|
33122
|
-
|
|
33123
|
-
|
|
33124
|
-
|
|
33125
|
-
|
|
33126
|
-
|
|
33042
|
+
set group(value) {
|
|
33043
|
+
// don't clear if no groups are present in previous and current value
|
|
33044
|
+
const groupsPresent = groupDescriptorsPresent(this.state.group) || groupDescriptorsPresent(value);
|
|
33045
|
+
const clear = this.state.group !== value && groupsPresent;
|
|
33046
|
+
this.grid.group = this.state.group = value;
|
|
33047
|
+
if (clear) {
|
|
33048
|
+
this.groups = null;
|
|
33049
|
+
this.grid.resetGroupsState();
|
|
33050
|
+
this.skip = 0;
|
|
33051
|
+
}
|
|
33052
|
+
}
|
|
33053
|
+
groups;
|
|
33054
|
+
gridSubs = new Subscription();
|
|
33055
|
+
constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
|
|
33056
|
+
super(ctxService.grid, changeDetector, localDataChangesService, null, ctxService);
|
|
33057
|
+
this.groupsService = groupsService;
|
|
33058
|
+
ctxService.dataBindingDirective = this;
|
|
33059
|
+
}
|
|
33060
|
+
ngOnInit() {
|
|
33061
|
+
super.ngOnInit();
|
|
33062
|
+
this.gridSubs.add(this.grid.groupExpand.subscribe(this.groupExpand.bind(this)));
|
|
33063
|
+
this.gridSubs.add(this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this)));
|
|
33064
|
+
}
|
|
33065
|
+
ngAfterContentInit() {
|
|
33066
|
+
if (isDevMode() && this.grid.isGroupExpanded) {
|
|
33067
|
+
throw new Error(GridConfigurationErrorMessages.groupBindingDirectives);
|
|
33068
|
+
}
|
|
33127
33069
|
}
|
|
33128
33070
|
ngOnDestroy() {
|
|
33129
|
-
this.
|
|
33071
|
+
this.gridSubs.unsubscribe();
|
|
33130
33072
|
}
|
|
33131
|
-
|
|
33132
|
-
|
|
33073
|
+
/**
|
|
33074
|
+
* @hidden
|
|
33075
|
+
*/
|
|
33076
|
+
toggleAll(expand) {
|
|
33077
|
+
this.skip = 0;
|
|
33078
|
+
this.grid.scrollTo({ row: 0, column: 0 });
|
|
33079
|
+
this.groups.forEach((gr, idx) => {
|
|
33080
|
+
const expanded = this.groupsService.isExpanded({
|
|
33081
|
+
group: gr,
|
|
33082
|
+
groupIndex: idx.toString(),
|
|
33083
|
+
parentGroup: undefined
|
|
33084
|
+
});
|
|
33085
|
+
const performToggle = (expand && !expanded) || (!expand && expanded);
|
|
33086
|
+
if (performToggle) {
|
|
33087
|
+
this.grid.groupsService.toggleRow({
|
|
33088
|
+
type: 'group',
|
|
33089
|
+
data: gr,
|
|
33090
|
+
index: idx.toString(),
|
|
33091
|
+
level: 0,
|
|
33092
|
+
parentGroup: undefined
|
|
33093
|
+
});
|
|
33094
|
+
this[expand ? 'groupExpand' : 'groupCollapse']({ groupIndex: idx.toString() });
|
|
33095
|
+
}
|
|
33096
|
+
});
|
|
33097
|
+
}
|
|
33098
|
+
/**
|
|
33099
|
+
* Collapses all expanded root level groups.
|
|
33100
|
+
*/
|
|
33101
|
+
collapseAll() {
|
|
33102
|
+
this.toggleAll(false);
|
|
33103
|
+
}
|
|
33104
|
+
/**
|
|
33105
|
+
* Expands all expanded root level groups.
|
|
33106
|
+
*/
|
|
33107
|
+
expandAll() {
|
|
33108
|
+
this.toggleAll(true);
|
|
33133
33109
|
}
|
|
33134
33110
|
/**
|
|
33135
33111
|
* @hidden
|
|
33136
33112
|
*/
|
|
33137
|
-
|
|
33138
|
-
const
|
|
33139
|
-
|
|
33113
|
+
groupExpand({ groupIndex }) {
|
|
33114
|
+
const { group, parents } = findGroup(groupIndex, this.groups);
|
|
33115
|
+
if (!group) {
|
|
33116
|
+
return;
|
|
33117
|
+
}
|
|
33118
|
+
this.groupsService.expandChildren(groupIndex);
|
|
33119
|
+
if (!group.items.length) {
|
|
33120
|
+
const descriptors = this.state.group.filter(removeParentDescriptors(parents, group));
|
|
33121
|
+
const children = findChildren(this.originalData, parents.concat(group));
|
|
33122
|
+
group.items = processGroups(children, {
|
|
33123
|
+
filter: this.state.filter,
|
|
33124
|
+
group: descriptors,
|
|
33125
|
+
sort: this.state.sort
|
|
33126
|
+
});
|
|
33127
|
+
}
|
|
33128
|
+
this.grid.data = this.dataResult(this.state.skip, this.state.take);
|
|
33140
33129
|
}
|
|
33141
|
-
|
|
33142
|
-
|
|
33143
|
-
|
|
33130
|
+
/**
|
|
33131
|
+
* @hidden
|
|
33132
|
+
*/
|
|
33133
|
+
groupCollapse({ groupIndex }) {
|
|
33134
|
+
const { group } = findGroup(groupIndex, this.groups);
|
|
33135
|
+
if (group) {
|
|
33136
|
+
group.items = [];
|
|
33144
33137
|
}
|
|
33145
|
-
|
|
33146
|
-
|
|
33147
|
-
|
|
33148
|
-
|
|
33149
|
-
if (!isPresent(item.parentGroupKeys) || !isPresent(item.parentGroupKeys[index]) ||
|
|
33150
|
-
parentGroup.group.value !== item.parentGroupKeys[index].value ||
|
|
33151
|
-
parentGroup.group.field !== item.parentGroupKeys[index].field) {
|
|
33152
|
-
return false;
|
|
33153
|
-
}
|
|
33154
|
-
parentGroup = parentGroup.parentGroup;
|
|
33155
|
-
index++;
|
|
33156
|
-
}
|
|
33157
|
-
return item.value === groupArgs.group.value && item.field === groupArgs.group.field;
|
|
33158
|
-
});
|
|
33138
|
+
else {
|
|
33139
|
+
return;
|
|
33140
|
+
}
|
|
33141
|
+
this.grid.data = this.dataResult(this.state.skip, this.state.take);
|
|
33159
33142
|
}
|
|
33160
|
-
|
|
33161
|
-
|
|
33162
|
-
|
|
33163
|
-
this.
|
|
33143
|
+
process(state) {
|
|
33144
|
+
if (state.group && state.group.length) {
|
|
33145
|
+
const groups = this.processGroups(state);
|
|
33146
|
+
this.grid.skip -= skippedHeaders(groups.data[0]);
|
|
33147
|
+
return groups;
|
|
33164
33148
|
}
|
|
33165
33149
|
else {
|
|
33166
|
-
|
|
33167
|
-
|
|
33168
|
-
|
|
33169
|
-
|
|
33170
|
-
|
|
33171
|
-
|
|
33172
|
-
|
|
33173
|
-
|
|
33150
|
+
this.groups = null;
|
|
33151
|
+
}
|
|
33152
|
+
return super.process(state);
|
|
33153
|
+
}
|
|
33154
|
+
processGroups(state) {
|
|
33155
|
+
if (!this.groups || !this.groups.length) {
|
|
33156
|
+
this.groups = processGroups(this.originalData, {
|
|
33157
|
+
filter: state.filter,
|
|
33158
|
+
group: state.group,
|
|
33159
|
+
sort: state.sort
|
|
33174
33160
|
});
|
|
33175
|
-
this.expandedGroupKeys.splice(index, 1);
|
|
33176
33161
|
}
|
|
33177
|
-
this.
|
|
33162
|
+
return this.dataResult(state.skip, state.take);
|
|
33178
33163
|
}
|
|
33179
|
-
|
|
33180
|
-
|
|
33164
|
+
dataResult(skip, take) {
|
|
33165
|
+
const includeFooters = this.grid.showGroupFooters;
|
|
33166
|
+
return {
|
|
33167
|
+
data: slice(this.groups, skip, take, includeFooters),
|
|
33168
|
+
total: count(this.groups, includeFooters)
|
|
33169
|
+
};
|
|
33170
|
+
}
|
|
33171
|
+
applyState({ skip, take, sort, group, filter }) {
|
|
33172
|
+
this.skip = skip;
|
|
33173
|
+
this.state.take = take;
|
|
33174
|
+
// this.pageSize = take; // do need to update take as the process with slice correctly
|
|
33175
|
+
this.sort = sort;
|
|
33176
|
+
this.group = group;
|
|
33177
|
+
this.filter = filter;
|
|
33178
|
+
}
|
|
33179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupBindingDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: LocalDataChangesService }, { token: ContextService }, { token: GroupsService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
33180
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: GroupBindingDirective, isStandalone: true, selector: "[kendoGridGroupBinding]", inputs: { kendoGridGroupBinding: "kendoGridGroupBinding", sort: "sort", filter: "filter", group: "group" }, exportAs: ["kendoGridGroupBinding"], usesInheritance: true, ngImport: i0 });
|
|
33181
33181
|
}
|
|
33182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type:
|
|
33182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupBindingDirective, decorators: [{
|
|
33183
33183
|
type: Directive,
|
|
33184
33184
|
args: [{
|
|
33185
|
-
selector: '[
|
|
33186
|
-
exportAs: '
|
|
33185
|
+
selector: '[kendoGridGroupBinding]',
|
|
33186
|
+
exportAs: 'kendoGridGroupBinding',
|
|
33187
33187
|
standalone: true
|
|
33188
33188
|
}]
|
|
33189
|
-
}], ctorParameters: function () { return [{ type:
|
|
33190
|
-
type: Output
|
|
33191
|
-
}], expandGroupBy: [{
|
|
33189
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }, { type: ContextService }, { type: GroupsService }]; }, propDecorators: { kendoGridGroupBinding: [{
|
|
33192
33190
|
type: Input,
|
|
33193
|
-
args: [
|
|
33194
|
-
}],
|
|
33191
|
+
args: ["kendoGridGroupBinding"]
|
|
33192
|
+
}], sort: [{
|
|
33195
33193
|
type: Input
|
|
33196
|
-
}],
|
|
33194
|
+
}], filter: [{
|
|
33195
|
+
type: Input
|
|
33196
|
+
}], group: [{
|
|
33197
33197
|
type: Input
|
|
33198
33198
|
}] } });
|
|
33199
33199
|
|