@progress/kendo-angular-grid 19.1.2 → 19.2.0-develop.1

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.
@@ -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, recursiveFlatMap } from '../utils';
13
+ import { isChanged, isPresent, isUniversal, anyChanged, isNumber, requestAnimationFrame, cancelAnimationFrame, recursiveFlatMap, calcRowHeight } 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';
@@ -40,7 +40,7 @@ import { ColGroupComponent } from './common/col-group.component';
40
40
  import { GridTableDirective } from './grid-table.directive';
41
41
  import { TableDirective } from '../column-resizing/table.directive';
42
42
  import { NgIf } from '@angular/common';
43
- import { RowspanService } from './rowspan.service';
43
+ import { DataMappingService } from '../data/data-mapping.service';
44
44
  import * as i0 from "@angular/core";
45
45
  import * as i1 from "./details/details.service";
46
46
  import * as i2 from "../data/change-notification.service";
@@ -56,7 +56,7 @@ import * as i11 from "../common/provider.service";
56
56
  import * as i12 from "../column-resizing/column-resizing.service";
57
57
  import * as i13 from "../pdf/pdf.service";
58
58
  import * as i14 from "../common/column-info.service";
59
- import * as i15 from "./rowspan.service";
59
+ import * as i15 from "../data/data-mapping.service";
60
60
  const elementAt = (index, elements, elementOffset) => {
61
61
  for (let idx = 0, elementIdx = 0; idx < elements.length; idx++) {
62
62
  const offset = elementOffset(elements[idx]);
@@ -121,14 +121,13 @@ export class ListComponent {
121
121
  changeDetector;
122
122
  pdfService;
123
123
  columnInfo;
124
- rowspanService;
124
+ dataMappingService;
125
125
  hostClass = true;
126
126
  hostRole = 'presentation';
127
127
  data;
128
128
  groups = [];
129
129
  total;
130
130
  rowHeight;
131
- stickyRowHeight;
132
131
  detailRowHeight;
133
132
  take;
134
133
  skip = 0;
@@ -153,6 +152,7 @@ export class ListComponent {
153
152
  scrollBottom = new EventEmitter();
154
153
  totalHeight;
155
154
  columnsStartIdx = 0;
155
+ allItems = [];
156
156
  get showFooter() {
157
157
  return this.groupable && this.groupable.showFooter;
158
158
  }
@@ -178,6 +178,7 @@ export class ListComponent {
178
178
  columnsEndIdx;
179
179
  viewportColumnsWidth;
180
180
  scrollLeft = 0;
181
+ recalculateRowspan = true;
181
182
  observer;
182
183
  get lockedLeafColumns() {
183
184
  return this.columns.lockedLeafColumns;
@@ -210,7 +211,8 @@ export class ListComponent {
210
211
  rtl = false;
211
212
  columnUpdateFrame;
212
213
  hasLockedContainer;
213
- constructor(scrollerFactory, detailsService, changeNotification, suspendService, groupsService, ngZone, renderer, scrollSyncService, resizeService, editService, supportService, navigationService, scrollRequestService, ctx, columnResizingService, changeDetector, pdfService, columnInfo, rowspanService) {
214
+ minRowHeight;
215
+ constructor(scrollerFactory, detailsService, changeNotification, suspendService, groupsService, ngZone, renderer, scrollSyncService, resizeService, editService, supportService, navigationService, scrollRequestService, ctx, columnResizingService, changeDetector, pdfService, columnInfo, dataMappingService) {
214
216
  this.changeNotification = changeNotification;
215
217
  this.suspendService = suspendService;
216
218
  this.groupsService = groupsService;
@@ -226,12 +228,13 @@ export class ListComponent {
226
228
  this.changeDetector = changeDetector;
227
229
  this.pdfService = pdfService;
228
230
  this.columnInfo = columnInfo;
229
- this.rowspanService = rowspanService;
231
+ this.dataMappingService = dataMappingService;
230
232
  this.scroller = scrollerFactory(this.dispatcher);
231
233
  this.subscriptions = detailsService.changes.subscribe(x => this.detailExpand(x));
232
234
  this.subscriptions.add(scrollRequestService.requests.subscribe(req => isPresent(req.adjustIndex) ? this.scrollTo(req.request, req.adjustIndex) : this.scrollToItem(req.request)));
233
235
  }
234
236
  ngOnInit() {
237
+ this.minRowHeight = this.isVirtual ? this.rowHeight || calcRowHeight(this.table.nativeElement) : this.rowHeight;
235
238
  this.init();
236
239
  this.subscriptions.add(this.ngZone.runOutsideAngular(this.handleRowSync.bind(this)));
237
240
  this.subscriptions.add(this.ngZone.runOutsideAngular(this.handleRowNavigationLocked.bind(this)));
@@ -267,6 +270,21 @@ export class ListComponent {
267
270
  if (this.virtualColumns && (!this.viewportColumns || this.viewportWidthChange())) {
268
271
  this.updateViewportColumns();
269
272
  }
273
+ if (this.isVirtual && this.ctx.grid && !this.ctx.grid.pageSize) {
274
+ const calculatedPageSize = this.calcVirtualPageSize();
275
+ if (calculatedPageSize > 0) {
276
+ this.ngZone.onMicrotaskEmpty.pipe(take(1)).subscribe(() => {
277
+ this.ctx.grid.pageSize = calculatedPageSize;
278
+ this.ngZone.run(() => {
279
+ this.pageChange.emit({
280
+ skip: this.skip || 0,
281
+ take: calculatedPageSize
282
+ });
283
+ });
284
+ });
285
+ }
286
+ }
287
+ this.allItems = this.dataMappingService.dataMapper(this.data, this.nonLockedColumnsToRender, this.lockedLeafColumns, this.detailTemplate, this.showFooter);
270
288
  }
271
289
  ngAfterViewInit() {
272
290
  if (!isDocumentAvailable()) {
@@ -305,7 +323,7 @@ export class ListComponent {
305
323
  if (this.suspendService.scroll) {
306
324
  return;
307
325
  }
308
- this.rowHeightService = new RowHeightService(this.total, this.rowHeight, this.detailRowHeight);
326
+ this.rowHeightService = new RowHeightService(this.total, this.rowHeight || this.minRowHeight, this.detailRowHeight);
309
327
  this.totalHeight = this.rowHeightService.totalHeight();
310
328
  if (!isUniversal()) {
311
329
  this.ngZone.runOutsideAngular(this.createScroller.bind(this));
@@ -374,10 +392,10 @@ export class ListComponent {
374
392
  const observable = this.scroller
375
393
  .create(this.rowHeightService, this.skip, this.take, this.total);
376
394
  this.skipScroll = false;
377
- this.scrollerSubscription = observable.pipe(filter((x) => x instanceof PageAction), filter(() => {
395
+ this.scrollerSubscription = observable.pipe(filter((x) => x instanceof PageAction), filter((x) => {
378
396
  const temp = this.skipScroll;
379
397
  this.skipScroll = false;
380
- return !temp;
398
+ return !temp && x.skip !== this.skip;
381
399
  }), tap(() => this.rebind = true))
382
400
  .subscribe((x) => this.ngZone.run(() => this.pageChange.emit(x)));
383
401
  this.scrollerSubscription.add(observable.pipe(filter((x) => x instanceof ScrollAction))
@@ -416,7 +434,6 @@ export class ListComponent {
416
434
  .pipe(filter(isLocked), switchMapTo(onStable())), this.editService.changed, this.resizeService.changes, this.columnResizingService.changes
417
435
  .pipe(filter(change => change.type === 'end')), this.supportService.changes)
418
436
  .pipe(tap(() => {
419
- this.ngZone.run(() => this.rowspanService.reset());
420
437
  this.resetNavigationViewport();
421
438
  }), filter(isLocked))
422
439
  .subscribe(() => {
@@ -661,8 +678,15 @@ export class ListComponent {
661
678
  }
662
679
  return element.offsetLeft;
663
680
  }
664
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListComponent, deps: [{ token: SCROLLER_FACTORY_TOKEN }, { token: i1.DetailsService }, { token: i2.ChangeNotificationService }, { token: i3.SuspendService }, { token: i4.GroupsService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i5.ScrollSyncService }, { token: i6.ResizeService }, { token: i7.EditService }, { token: i8.BrowserSupportService }, { token: i9.NavigationService }, { token: i10.ScrollRequestService }, { token: i11.ContextService }, { token: i12.ColumnResizingService }, { token: i0.ChangeDetectorRef }, { token: i13.PDFService }, { token: i14.ColumnInfoService }, { token: i15.RowspanService }], target: i0.ɵɵFactoryTarget.Component });
665
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ListComponent, isStandalone: true, selector: "kendo-grid-list", inputs: { data: "data", groups: "groups", total: "total", rowHeight: "rowHeight", stickyRowHeight: "stickyRowHeight", detailRowHeight: "detailRowHeight", take: "take", skip: "skip", columns: "columns", detailTemplate: "detailTemplate", noRecordsTemplate: "noRecordsTemplate", selectable: "selectable", groupable: "groupable", filterable: "filterable", rowClass: "rowClass", rowSticky: "rowSticky", loading: "loading", trackBy: "trackBy", virtualColumns: "virtualColumns", isVirtual: "isVirtual", cellLoadingTemplate: "cellLoadingTemplate", loadingTemplate: "loadingTemplate", sort: "sort", size: "size" }, outputs: { contentScroll: "contentScroll", pageChange: "pageChange", scrollBottom: "scrollBottom" }, host: { properties: { "class.k-grid-container": "this.hostClass", "attr.role": "this.hostRole" } }, providers: [
681
+ calcVirtualPageSize = () => {
682
+ const containerHeight = this.container.nativeElement.offsetHeight;
683
+ if (containerHeight && (this.rowHeight ?? this.minRowHeight)) {
684
+ return Math.ceil((containerHeight / (this.rowHeight ?? this.minRowHeight)) * 1.5);
685
+ }
686
+ return 0;
687
+ };
688
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListComponent, deps: [{ token: SCROLLER_FACTORY_TOKEN }, { token: i1.DetailsService }, { token: i2.ChangeNotificationService }, { token: i3.SuspendService }, { token: i4.GroupsService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i5.ScrollSyncService }, { token: i6.ResizeService }, { token: i7.EditService }, { token: i8.BrowserSupportService }, { token: i9.NavigationService }, { token: i10.ScrollRequestService }, { token: i11.ContextService }, { token: i12.ColumnResizingService }, { token: i0.ChangeDetectorRef }, { token: i13.PDFService }, { token: i14.ColumnInfoService }, { token: i15.DataMappingService }], target: i0.ɵɵFactoryTarget.Component });
689
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ListComponent, isStandalone: true, selector: "kendo-grid-list", inputs: { data: "data", groups: "groups", total: "total", rowHeight: "rowHeight", detailRowHeight: "detailRowHeight", take: "take", skip: "skip", columns: "columns", detailTemplate: "detailTemplate", noRecordsTemplate: "noRecordsTemplate", selectable: "selectable", groupable: "groupable", filterable: "filterable", rowClass: "rowClass", rowSticky: "rowSticky", loading: "loading", trackBy: "trackBy", virtualColumns: "virtualColumns", isVirtual: "isVirtual", cellLoadingTemplate: "cellLoadingTemplate", loadingTemplate: "loadingTemplate", sort: "sort", size: "size" }, outputs: { contentScroll: "contentScroll", pageChange: "pageChange", scrollBottom: "scrollBottom" }, host: { properties: { "class.k-grid-container": "this.hostClass", "attr.role": "this.hostRole" } }, providers: [
666
690
  {
667
691
  provide: SCROLLER_FACTORY_TOKEN,
668
692
  useValue: DEFAULT_SCROLLER_FACTORY
@@ -698,13 +722,12 @@ export class ListComponent {
698
722
  role="presentation"
699
723
  [groups]="groups"
700
724
  [isLocked]="true"
701
- [data]="data"
725
+ [rowsToRender]="allItems"
702
726
  [noRecordsText]="''"
703
727
  [columns]="$any(lockedLeafColumns)"
704
728
  [totalColumnsCount]="leafColumns.length"
705
729
  [totalColumns]="columns"
706
730
  [detailTemplate]="detailTemplate"
707
- [showGroupFooters]="showFooter"
708
731
  [skip]="skip"
709
732
  [selectable]="selectable"
710
733
  [trackBy]="trackBy"
@@ -746,9 +769,8 @@ export class ListComponent {
746
769
  <tbody kendoGridTableBody
747
770
  role="rowgroup"
748
771
  [skipGroupDecoration]="isLocked"
749
- [data]="data"
772
+ [rowsToRender]="allItems"
750
773
  [groups]="groups"
751
- [showGroupFooters]="showFooter"
752
774
  [columns]="$any(nonLockedColumnsToRender)"
753
775
  [allColumns]="$any(nonLockedLeafColumns)"
754
776
  [detailTemplate]="detailTemplate"
@@ -778,7 +800,7 @@ export class ListComponent {
778
800
  <div [style.width.px]="totalWidth"></div>
779
801
  </div>
780
802
  </div>
781
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { kind: "directive", type: TableDirective, selector: "[kendoGridResizableTable]", inputs: ["locked", "virtualColumns"] }, { kind: "directive", type: GridTableDirective, selector: "[kendoGridTable]", inputs: ["size"] }, { kind: "component", type: ColGroupComponent, selector: "[kendoGridColGroup]", inputs: ["columns", "groups", "detailTemplate", "sort"] }, { kind: "component", type: TableBodyComponent, selector: "[kendoGridTableBody]", inputs: ["columns", "allColumns", "groups", "detailTemplate", "noRecordsTemplate", "data", "skip", "selectable", "filterable", "noRecordsText", "isLocked", "isLoading", "isVirtual", "cellLoadingTemplate", "skipGroupDecoration", "showGroupFooters", "lockedColumnsCount", "totalColumnsCount", "virtualColumns", "trackBy", "rowSticky", "totalColumns", "rowClass"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { kind: "directive", type: ResizableContainerDirective, selector: "[kendoGridResizableContainer]", inputs: ["lockedWidth", "kendoGridResizableContainer"] }] });
803
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { kind: "directive", type: TableDirective, selector: "[kendoGridResizableTable]", inputs: ["locked", "virtualColumns"] }, { kind: "directive", type: GridTableDirective, selector: "[kendoGridTable]", inputs: ["size"] }, { kind: "component", type: ColGroupComponent, selector: "[kendoGridColGroup]", inputs: ["columns", "groups", "detailTemplate", "sort"] }, { kind: "component", type: TableBodyComponent, selector: "[kendoGridTableBody]", inputs: ["columns", "allColumns", "groups", "detailTemplate", "noRecordsTemplate", "rowsToRender", "skip", "selectable", "filterable", "noRecordsText", "isLocked", "isLoading", "isVirtual", "cellLoadingTemplate", "skipGroupDecoration", "lockedColumnsCount", "totalColumnsCount", "virtualColumns", "trackBy", "rowSticky", "totalColumns", "rowClass"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { kind: "directive", type: ResizableContainerDirective, selector: "[kendoGridResizableContainer]", inputs: ["lockedWidth", "kendoGridResizableContainer"] }] });
782
804
  }
783
805
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListComponent, decorators: [{
784
806
  type: Component,
@@ -821,13 +843,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
821
843
  role="presentation"
822
844
  [groups]="groups"
823
845
  [isLocked]="true"
824
- [data]="data"
846
+ [rowsToRender]="allItems"
825
847
  [noRecordsText]="''"
826
848
  [columns]="$any(lockedLeafColumns)"
827
849
  [totalColumnsCount]="leafColumns.length"
828
850
  [totalColumns]="columns"
829
851
  [detailTemplate]="detailTemplate"
830
- [showGroupFooters]="showFooter"
831
852
  [skip]="skip"
832
853
  [selectable]="selectable"
833
854
  [trackBy]="trackBy"
@@ -869,9 +890,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
869
890
  <tbody kendoGridTableBody
870
891
  role="rowgroup"
871
892
  [skipGroupDecoration]="isLocked"
872
- [data]="data"
893
+ [rowsToRender]="allItems"
873
894
  [groups]="groups"
874
- [showGroupFooters]="showFooter"
875
895
  [columns]="$any(nonLockedColumnsToRender)"
876
896
  [allColumns]="$any(nonLockedLeafColumns)"
877
897
  [detailTemplate]="detailTemplate"
@@ -908,7 +928,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
908
928
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
909
929
  type: Inject,
910
930
  args: [SCROLLER_FACTORY_TOKEN]
911
- }] }, { type: i1.DetailsService }, { type: i2.ChangeNotificationService }, { type: i3.SuspendService }, { type: i4.GroupsService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i5.ScrollSyncService }, { type: i6.ResizeService }, { type: i7.EditService }, { type: i8.BrowserSupportService }, { type: i9.NavigationService }, { type: i10.ScrollRequestService }, { type: i11.ContextService }, { type: i12.ColumnResizingService }, { type: i0.ChangeDetectorRef }, { type: i13.PDFService }, { type: i14.ColumnInfoService }, { type: i15.RowspanService }]; }, propDecorators: { hostClass: [{
931
+ }] }, { type: i1.DetailsService }, { type: i2.ChangeNotificationService }, { type: i3.SuspendService }, { type: i4.GroupsService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i5.ScrollSyncService }, { type: i6.ResizeService }, { type: i7.EditService }, { type: i8.BrowserSupportService }, { type: i9.NavigationService }, { type: i10.ScrollRequestService }, { type: i11.ContextService }, { type: i12.ColumnResizingService }, { type: i0.ChangeDetectorRef }, { type: i13.PDFService }, { type: i14.ColumnInfoService }, { type: i15.DataMappingService }]; }, propDecorators: { hostClass: [{
912
932
  type: HostBinding,
913
933
  args: ['class.k-grid-container']
914
934
  }], hostRole: [{
@@ -922,8 +942,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
922
942
  type: Input
923
943
  }], rowHeight: [{
924
944
  type: Input
925
- }], stickyRowHeight: [{
926
- type: Input
927
945
  }], detailRowHeight: [{
928
946
  type: Input
929
947
  }], take: [{
@@ -973,10 +991,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
973
991
  args: ['container', { static: true }]
974
992
  }], lockedContainer: [{
975
993
  type: ViewChild,
976
- args: ['lockedContainer', { static: false }]
994
+ args: ['lockedContainer']
977
995
  }], lockedTable: [{
978
996
  type: ViewChild,
979
- args: ['lockedTable', { static: false }]
997
+ args: ['lockedTable']
980
998
  }], table: [{
981
999
  type: ViewChild,
982
1000
  args: ['table', { static: true }]