@progress/kendo-angular-grid 18.1.0-develop.2 → 18.1.0-develop.20

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.
@@ -14,7 +14,7 @@ import { isSpanColumnComponent } from './columns/span-column.component';
14
14
  import { isColumnGroupComponent, ColumnGroupComponent } from './columns/column-group.component';
15
15
  import { DetailTemplateDirective } from './rendering/details/detail-template.directive';
16
16
  import { normalize } from './common/pager-settings';
17
- import { isArray, anyChanged, isChanged, isPresent, isUniversal, observe, isTruthy, createPromise, hasObservers } from './utils';
17
+ import { isArray, anyChanged, isChanged, isPresent, isUniversal, observe, isTruthy, createPromise, hasObservers, roundDown } from './utils';
18
18
  import { BrowserSupportService } from './layout/browser-support.service';
19
19
  import { DataResultIterator, DataCollection } from './data/data.collection';
20
20
  import { SelectionService } from './selection/selection.service';
@@ -411,6 +411,11 @@ export class GridComponent {
411
411
  * @default false
412
412
  */
413
413
  groupable = false;
414
+ /**
415
+ * Determines whether the Grid can be resized.
416
+ * @default false
417
+ */
418
+ gridResizable = false;
414
419
  /**
415
420
  * Enables the [row reordering]({% slug reordering_rows_grid %}) of the Grid.
416
421
  * @default false
@@ -748,6 +753,21 @@ export class GridComponent {
748
753
  get noScrollbarClass() {
749
754
  return this.scrollbarWidth === 0;
750
755
  }
756
+ get isResizable() {
757
+ return Boolean(this.gridResizable);
758
+ }
759
+ get minWidth() {
760
+ return this.gridResizable.minWidth;
761
+ }
762
+ get maxWidth() {
763
+ return this.gridResizable.maxWidth;
764
+ }
765
+ get minHeight() {
766
+ return this.gridResizable.minHeight;
767
+ }
768
+ get maxHeight() {
769
+ return this.gridResizable.maxHeight;
770
+ }
751
771
  detailTemplateChildren;
752
772
  get detailTemplate() {
753
773
  if (this._customDetailTemplate) {
@@ -1707,16 +1727,19 @@ export class GridComponent {
1707
1727
  }
1708
1728
  else if (column === source) {
1709
1729
  i += toSkip;
1730
+ column.isReordered = true;
1710
1731
  continue;
1711
1732
  }
1712
1733
  else {
1713
1734
  column.orderIndex = nextIndex;
1714
1735
  }
1736
+ column.isReordered = true;
1715
1737
  nextIndex++;
1716
1738
  i++;
1717
1739
  }
1718
1740
  for (i = sourceColumnIndex; i < sourceColumnIndex + toSkip; i++) {
1719
1741
  expandedColumns[i].orderIndex = nextSourceIndex++;
1742
+ expandedColumns[i].isReordered = true;
1720
1743
  }
1721
1744
  this.updateIndicesForLevel(source.level + 1);
1722
1745
  this.columnResizingService.areColumnsReordered = true;
@@ -1729,7 +1752,11 @@ export class GridComponent {
1729
1752
  colsForLevel.push(...c.childrenArray.sort((a, b) => a.orderIndex - b.orderIndex));
1730
1753
  }
1731
1754
  });
1732
- expandColumnsWithSpan(colsForLevel).map((c, i) => c.orderIndex = i);
1755
+ expandColumnsWithSpan(colsForLevel).map((c, i) => {
1756
+ c.orderIndex = i;
1757
+ c.isReordered = true;
1758
+ return c;
1759
+ });
1733
1760
  if (level < this.columnList.totalColumnLevels()) {
1734
1761
  this.updateIndicesForLevel(level + 1);
1735
1762
  }
@@ -2047,8 +2074,8 @@ export class GridComponent {
2047
2074
  .filter(item => isTruthy(item.column.resizable) && !item.column.isColumnGroup)
2048
2075
  .map(item => ({
2049
2076
  column: item.column,
2050
- newWidth: item.column.width,
2051
- oldWidth: item.oldWidth
2077
+ newWidth: roundDown(item.column.width),
2078
+ oldWidth: roundDown(item.oldWidth)
2052
2079
  }));
2053
2080
  this.columnResize.emit(args);
2054
2081
  }
@@ -2169,7 +2196,7 @@ export class GridComponent {
2169
2196
  this.dropTargetContainer?.notify();
2170
2197
  }
2171
2198
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GridComponent, deps: [{ token: i1.BrowserSupportService }, { token: i2.SelectionService }, { token: i3.CellSelectionService }, { token: i0.ElementRef }, { token: i4.GroupInfoService }, { token: i5.GroupsService }, { token: i6.ChangeNotificationService }, { token: i7.DetailsService }, { token: i8.EditService }, { token: i9.FilterService }, { token: i10.PDFService }, { token: i11.ResponsiveService }, { token: i0.Renderer2 }, { token: i12.ExcelService }, { token: i0.NgZone }, { token: i13.ScrollSyncService }, { token: i14.DomEventsService }, { token: i15.ColumnResizingService }, { token: i0.ChangeDetectorRef }, { token: i16.ColumnReorderService }, { token: i17.ColumnInfoService }, { token: i18.NavigationService }, { token: i19.SortService }, { token: i20.ScrollRequestService }, { token: i21.LocalizationService }, { token: i22.ContextService }, { token: i23.SizingOptionsService }, { token: i24.RowReorderService }], target: i0.ɵɵFactoryTarget.Component });
2172
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GridComponent, isStandalone: true, selector: "kendo-grid", inputs: { data: "data", pageSize: "pageSize", height: "height", rowHeight: "rowHeight", detailRowHeight: "detailRowHeight", skip: "skip", scrollable: "scrollable", selectable: "selectable", sort: "sort", size: "size", trackBy: "trackBy", filter: "filter", group: "group", virtualColumns: "virtualColumns", filterable: "filterable", sortable: "sortable", pageable: "pageable", groupable: "groupable", rowReorderable: "rowReorderable", navigable: "navigable", navigatable: "navigatable", autoSize: "autoSize", rowClass: "rowClass", rowSticky: "rowSticky", rowSelected: "rowSelected", isRowSelectable: "isRowSelectable", cellSelected: "cellSelected", resizable: "resizable", reorderable: "reorderable", loading: "loading", columnMenu: "columnMenu", hideHeader: "hideHeader", isDetailExpanded: "isDetailExpanded", isGroupExpanded: "isGroupExpanded" }, outputs: { filterChange: "filterChange", pageChange: "pageChange", groupChange: "groupChange", sortChange: "sortChange", selectionChange: "selectionChange", rowReorder: "rowReorder", dataStateChange: "dataStateChange", groupExpand: "groupExpand", groupCollapse: "groupCollapse", detailExpand: "detailExpand", detailCollapse: "detailCollapse", edit: "edit", cancel: "cancel", save: "save", remove: "remove", add: "add", cellClose: "cellClose", cellClick: "cellClick", pdfExport: "pdfExport", excelExport: "excelExport", columnResize: "columnResize", columnReorder: "columnReorder", columnVisibilityChange: "columnVisibilityChange", columnLockedChange: "columnLockedChange", columnStickyChange: "columnStickyChange", scrollBottom: "scrollBottom", contentScroll: "contentScroll" }, host: { properties: { "attr.dir": "this.dir", "class.k-grid": "this.hostClass", "class.k-grid-sm": "this.sizeSmallClass", "class.k-grid-md": "this.sizeMediumClass", "class.k-grid-lockedcolumns": "this.lockedClasses", "class.k-grid-virtual": "this.virtualClasses", "class.k-grid-no-scrollbar": "this.noScrollbarClass" } }, providers: [
2199
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GridComponent, isStandalone: true, selector: "kendo-grid", inputs: { data: "data", pageSize: "pageSize", height: "height", rowHeight: "rowHeight", detailRowHeight: "detailRowHeight", skip: "skip", scrollable: "scrollable", selectable: "selectable", sort: "sort", size: "size", trackBy: "trackBy", filter: "filter", group: "group", virtualColumns: "virtualColumns", filterable: "filterable", sortable: "sortable", pageable: "pageable", groupable: "groupable", gridResizable: "gridResizable", rowReorderable: "rowReorderable", navigable: "navigable", navigatable: "navigatable", autoSize: "autoSize", rowClass: "rowClass", rowSticky: "rowSticky", rowSelected: "rowSelected", isRowSelectable: "isRowSelectable", cellSelected: "cellSelected", resizable: "resizable", reorderable: "reorderable", loading: "loading", columnMenu: "columnMenu", hideHeader: "hideHeader", isDetailExpanded: "isDetailExpanded", isGroupExpanded: "isGroupExpanded" }, outputs: { filterChange: "filterChange", pageChange: "pageChange", groupChange: "groupChange", sortChange: "sortChange", selectionChange: "selectionChange", rowReorder: "rowReorder", dataStateChange: "dataStateChange", groupExpand: "groupExpand", groupCollapse: "groupCollapse", detailExpand: "detailExpand", detailCollapse: "detailCollapse", edit: "edit", cancel: "cancel", save: "save", remove: "remove", add: "add", cellClose: "cellClose", cellClick: "cellClick", pdfExport: "pdfExport", excelExport: "excelExport", columnResize: "columnResize", columnReorder: "columnReorder", columnVisibilityChange: "columnVisibilityChange", columnLockedChange: "columnLockedChange", columnStickyChange: "columnStickyChange", scrollBottom: "scrollBottom", contentScroll: "contentScroll" }, host: { properties: { "attr.dir": "this.dir", "class.k-grid": "this.hostClass", "class.k-grid-sm": "this.sizeSmallClass", "class.k-grid-md": "this.sizeMediumClass", "class.k-grid-lockedcolumns": "this.lockedClasses", "class.k-grid-virtual": "this.virtualClasses", "class.k-grid-no-scrollbar": "this.noScrollbarClass", "class.k-grid-resizable": "this.isResizable", "style.minWidth": "this.minWidth", "style.maxWidth": "this.maxWidth", "style.minHeight": "this.minHeight", "style.maxHeight": "this.maxHeight" } }, providers: [
2173
2200
  BrowserSupportService,
2174
2201
  LocalizationService,
2175
2202
  ColumnInfoService,
@@ -3626,6 +3653,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
3626
3653
  type: Input
3627
3654
  }], groupable: [{
3628
3655
  type: Input
3656
+ }], gridResizable: [{
3657
+ type: Input
3629
3658
  }], rowReorderable: [{
3630
3659
  type: Input
3631
3660
  }], navigable: [{
@@ -3732,6 +3761,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
3732
3761
  }], noScrollbarClass: [{
3733
3762
  type: HostBinding,
3734
3763
  args: ['class.k-grid-no-scrollbar']
3764
+ }], isResizable: [{
3765
+ type: HostBinding,
3766
+ args: ['class.k-grid-resizable']
3767
+ }], minWidth: [{
3768
+ type: HostBinding,
3769
+ args: ['style.minWidth']
3770
+ }], maxWidth: [{
3771
+ type: HostBinding,
3772
+ args: ['style.maxWidth']
3773
+ }], minHeight: [{
3774
+ type: HostBinding,
3775
+ args: ['style.minHeight']
3776
+ }], maxHeight: [{
3777
+ type: HostBinding,
3778
+ args: ['style.maxHeight']
3735
3779
  }], detailTemplateChildren: [{
3736
3780
  type: ContentChildren,
3737
3781
  args: [DetailTemplateDirective]
@@ -135,7 +135,25 @@ export class NavigationService {
135
135
  }
136
136
  }
137
137
  get isColumnResizable() {
138
- return this.activeCell.colIndex !== this.ctx.grid.columnsContainer.leafColumnsToRender.length - 1;
138
+ const allColumns = Array.from(this.ctx.grid.columnsContainer.allColumns);
139
+ const column = allColumns.find((col) => col.level === this.activeCell.rowIndex && col.leafIndex === this.activeCell.colIndex);
140
+ if (!column.parent) {
141
+ if (column.isColumnGroup) {
142
+ return this.activeCell.colIndex + this.activeCell.colSpan !== this.ctx.grid.columnsContainer.leafColumnsToRender.length;
143
+ }
144
+ else {
145
+ return this.activeCell.colIndex !== this.ctx.grid.columnsContainer.leafColumnsToRender.length - 1;
146
+ }
147
+ }
148
+ else {
149
+ const columnGroup = column.parent;
150
+ const columnGroupChildren = Array.from(columnGroup.children).sort((a, b) => a.orderIndex - b.orderIndex);
151
+ const columnIndexInsideGroup = columnGroupChildren.indexOf(column);
152
+ if (column.isReordered || column.orderIndex > 0 || (column.isReordered && column.orderIndex === 0)) {
153
+ return (column.orderIndex - columnGroupChildren[0]['orderIndex']) !== columnGroupChildren.length - 1;
154
+ }
155
+ return columnIndexInsideGroup !== columnGroupChildren.length - 1;
156
+ }
139
157
  }
140
158
  viewport;
141
159
  columnViewport;
@@ -577,8 +595,7 @@ export class NavigationService {
577
595
  }
578
596
  }
579
597
  columnResize(onRightArrow) {
580
- const column = this.ctx.grid.columnsContainer.leafColumnsToRender[this.activeCell.colIndex];
581
- column.resizeStartWidth = Array.from(this.ctx.grid.wrapper.nativeElement.querySelectorAll('.k-grid-header th.k-header'))[this.activeCell.colIndex]['offsetWidth'];
598
+ const column = this.ctx.grid.columnsContainer.allColumns.find((col) => col.level === this.activeCell.rowIndex && col.leafIndex === this.activeCell.colIndex);
582
599
  this.resizeService.start(column);
583
600
  this.resizeService.resizeColumns(onRightArrow ? resizeStep : -1 * resizeStep);
584
601
  if (this.resizeService.resizeColumns.length > 0) {
@@ -10,7 +10,7 @@ export const packageMetadata = {
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCode: 'KENDOUIANGULAR',
12
12
  productCodes: ['KENDOUIANGULAR'],
13
- publishDate: 1738227350,
14
- version: '18.1.0-develop.2',
13
+ publishDate: 1738834898,
14
+ version: '18.1.0-develop.20',
15
15
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
16
16
  };
@@ -368,9 +368,6 @@ export class HeaderComponent {
368
368
  isCheckboxColumn(column) {
369
369
  return isCheckboxColumn(column) && !column.templateRef;
370
370
  }
371
- trackByIndex(index) {
372
- return index;
373
- }
374
371
  addStickyStyles(column) {
375
372
  const stickyStyles = this.columnInfoService.stickyColumnsStyles(column);
376
373
  return { ...column.headerStyle, ...stickyStyles };
@@ -509,7 +506,7 @@ export class HeaderComponent {
509
506
  *ngIf="detailTemplate?.templateRef"
510
507
  >
511
508
  </th>
512
- <ng-container *ngFor="let column of columnsForLevel(levelIndex); trackBy: trackByIndex; let columnIndex = index; let last = last;">
509
+ <ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
513
510
  <th *ngIf="!isColumnGroupComponent(column)"
514
511
  kendoGridLogicalCell
515
512
  [logicalRowIndex]="levelIndex"
@@ -736,7 +733,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
736
733
  *ngIf="detailTemplate?.templateRef"
737
734
  >
738
735
  </th>
739
- <ng-container *ngFor="let column of columnsForLevel(levelIndex); trackBy: trackByIndex; let columnIndex = index; let last = last;">
736
+ <ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
740
737
  <th *ngIf="!isColumnGroupComponent(column)"
741
738
  kendoGridLogicalCell
742
739
  [logicalRowIndex]="levelIndex"
package/esm2022/utils.mjs CHANGED
@@ -139,3 +139,7 @@ export const recursiveFlatMap = (item) => isGroupResult(item) ? item.items.flatM
139
139
  export const isGroupResult = (obj) => {
140
140
  return 'aggregates' in obj && 'items' in obj && 'field' in obj && 'value' in obj;
141
141
  };
142
+ /**
143
+ * @hidden
144
+ */
145
+ export const roundDown = (value) => Math.floor(value * 100) / 100;