@progress/kendo-angular-grid 18.1.0-develop.3 → 18.1.0-develop.31

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.
@@ -455,6 +455,10 @@ const recursiveFlatMap = (item) => isGroupResult(item) ? item.items.flatMap(recu
455
455
  const isGroupResult = (obj) => {
456
456
  return 'aggregates' in obj && 'items' in obj && 'field' in obj && 'value' in obj;
457
457
  };
458
+ /**
459
+ * @hidden
460
+ */
461
+ const roundDown = (value) => Math.floor(value * 100) / 100;
458
462
 
459
463
  /**
460
464
  * @hidden
@@ -2088,6 +2092,18 @@ const isColumnContainer = column => column.isColumnGroup || isSpanColumn(column)
2088
2092
  */
2089
2093
  class ColumnBase {
2090
2094
  parent;
2095
+ /**
2096
+ * @hidden
2097
+ */
2098
+ isReordered;
2099
+ /**
2100
+ * @hidden
2101
+ */
2102
+ initialMaxResizableWidth;
2103
+ /**
2104
+ * @hidden
2105
+ */
2106
+ initialMinResizableWidth;
2091
2107
  /**
2092
2108
  * @hidden
2093
2109
  */
@@ -2755,6 +2771,10 @@ class ColumnComponent extends ColumnBase {
2755
2771
  get displayTitle() {
2756
2772
  return this.title === undefined ? this.field : this.title;
2757
2773
  }
2774
+ ngAfterViewInit() {
2775
+ this.initialMaxResizableWidth = this.maxResizableWidth;
2776
+ this.initialMinResizableWidth = this.minResizableWidth;
2777
+ }
2758
2778
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnComponent, deps: [{ token: ColumnBase, host: true, optional: true, skipSelf: true }, { token: IdService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2759
2779
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColumnComponent, isStandalone: true, selector: "kendo-grid-column", inputs: { field: "field", format: "format", sortable: "sortable", groupable: "groupable", editor: "editor", filter: "filter", filterable: "filterable", editable: "editable" }, providers: [
2760
2780
  {
@@ -3083,8 +3103,10 @@ class ColumnResizingService {
3083
3103
  areColumnsReordered = false;
3084
3104
  isShiftPressed = false;
3085
3105
  originalWidth;
3086
- column;
3106
+ draggedGroupColumn;
3087
3107
  resizedColumns;
3108
+ autoFitResize = false;
3109
+ column;
3088
3110
  tables = [];
3089
3111
  batch = null;
3090
3112
  start(column) {
@@ -3120,7 +3142,10 @@ class ColumnResizingService {
3120
3142
  resizedColumns: this.resizedColumns,
3121
3143
  type: 'end'
3122
3144
  });
3145
+ this.restoreInitialMaxMinWidths();
3123
3146
  this.adjacentColumn = null;
3147
+ this.draggedGroupColumn = null;
3148
+ this.autoFitResize = false;
3124
3149
  }
3125
3150
  registerTable(tableMetadata) {
3126
3151
  this.tables.push(tableMetadata);
@@ -3193,6 +3218,16 @@ class ColumnResizingService {
3193
3218
  });
3194
3219
  this.batch = null;
3195
3220
  }
3221
+ restoreInitialMaxMinWidths() {
3222
+ if (this.adjacentColumn) {
3223
+ this.adjacentColumn.maxResizableWidth = this.adjacentColumn.initialMaxResizableWidth;
3224
+ this.adjacentColumn.minResizableWidth = this.adjacentColumn.initialMinResizableWidth;
3225
+ }
3226
+ if (this.column) {
3227
+ this.column.maxResizableWidth = this.column.initialMaxResizableWidth;
3228
+ this.column.minResizableWidth = this.column.initialMinResizableWidth;
3229
+ }
3230
+ }
3196
3231
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnResizingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3197
3232
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnResizingService });
3198
3233
  }
@@ -3304,7 +3339,25 @@ class NavigationService {
3304
3339
  }
3305
3340
  }
3306
3341
  get isColumnResizable() {
3307
- return this.activeCell.colIndex !== this.ctx.grid.columnsContainer.leafColumnsToRender.length - 1;
3342
+ const allColumns = Array.from(this.ctx.grid.columnsContainer.allColumns);
3343
+ const column = allColumns.find((col) => col.level === this.activeCell.rowIndex && col.leafIndex === this.activeCell.colIndex);
3344
+ if (!column.parent) {
3345
+ if (column.isColumnGroup) {
3346
+ return this.activeCell.colIndex + this.activeCell.colSpan !== this.ctx.grid.columnsContainer.leafColumnsToRender.length;
3347
+ }
3348
+ else {
3349
+ return this.activeCell.colIndex !== this.ctx.grid.columnsContainer.leafColumnsToRender.length - 1;
3350
+ }
3351
+ }
3352
+ else {
3353
+ const columnGroup = column.parent;
3354
+ const columnGroupChildren = Array.from(columnGroup.children).sort((a, b) => a.orderIndex - b.orderIndex);
3355
+ const columnIndexInsideGroup = columnGroupChildren.indexOf(column);
3356
+ if (column.isReordered || column.orderIndex > 0 || (column.isReordered && column.orderIndex === 0)) {
3357
+ return (column.orderIndex - columnGroupChildren[0]['orderIndex']) !== columnGroupChildren.length - 1;
3358
+ }
3359
+ return columnIndexInsideGroup !== columnGroupChildren.length - 1;
3360
+ }
3308
3361
  }
3309
3362
  viewport;
3310
3363
  columnViewport;
@@ -3746,8 +3799,7 @@ class NavigationService {
3746
3799
  }
3747
3800
  }
3748
3801
  columnResize(onRightArrow) {
3749
- const column = this.ctx.grid.columnsContainer.leafColumnsToRender[this.activeCell.colIndex];
3750
- column.resizeStartWidth = Array.from(this.ctx.grid.wrapper.nativeElement.querySelectorAll('.k-grid-header th.k-header'))[this.activeCell.colIndex]['offsetWidth'];
3802
+ const column = this.ctx.grid.columnsContainer.allColumns.find((col) => col.level === this.activeCell.rowIndex && col.leafIndex === this.activeCell.colIndex);
3751
3803
  this.resizeService.start(column);
3752
3804
  this.resizeService.resizeColumns(onRightArrow ? resizeStep : -1 * resizeStep);
3753
3805
  if (this.resizeService.resizeColumns.length > 0) {
@@ -14606,11 +14658,20 @@ const toPercentage = (value, whole) => (value / whole) * 100;
14606
14658
  /**
14607
14659
  * @hidden
14608
14660
  */
14609
- const headerWidth = (handle) => handle.nativeElement.parentElement.offsetWidth;
14661
+ const headerWidth = (handle) => handle.nativeElement.parentElement.getBoundingClientRect().width;
14610
14662
  /**
14611
14663
  * @hidden
14612
14664
  */
14613
- const adjacentColumnWidth = (handle) => handle.nativeElement.parentElement.nextElementSibling?.offsetWidth;
14665
+ const adjacentColumnWidth = (handle) => handle.nativeElement.parentElement.nextElementSibling?.getBoundingClientRect().width;
14666
+ /**
14667
+ * @hidden
14668
+ */
14669
+ const adjacentColumnInGroupWidth = (handle, rowIndex, colIndex) => {
14670
+ const tableElement = handle.nativeElement.closest('.k-grid-header-table');
14671
+ const selector = (rowAttribute) => `tr[${rowAttribute}="${rowIndex}"] th[aria-colindex="${colIndex}"]`;
14672
+ const thElement = tableElement.querySelector([selector('aria-rowindex'), selector('data-kendo-grid-row-index')]);
14673
+ return thElement.getBoundingClientRect().width;
14674
+ };
14614
14675
  /**
14615
14676
  * @hidden
14616
14677
  */
@@ -14670,7 +14731,7 @@ class ColumnHandleDirective {
14670
14731
  columns = [];
14671
14732
  column;
14672
14733
  get visible() {
14673
- if (this.isConstrainedMode && this.isLast) {
14734
+ if (this.isConstrainedMode && (this.isLast || this.isLastInGroup(this.column))) {
14674
14735
  return 'none';
14675
14736
  }
14676
14737
  return this.column.resizable ? 'block' : 'none';
@@ -14690,7 +14751,12 @@ class ColumnHandleDirective {
14690
14751
  }
14691
14752
  subscriptions = new Subscription();
14692
14753
  rtl = false;
14754
+ totalChildrenSum = 0;
14755
+ childrenColumns = [];
14756
+ minWidthTotal = 0;
14757
+ foundColumn;
14693
14758
  autoFit() {
14759
+ this.service.autoFitResize = true;
14694
14760
  const allLeafs = allLeafColumns(this.columns);
14695
14761
  const currentLeafs = leafColumns([this.column]).filter(column => isTruthy(column.resizable));
14696
14762
  const columnInfo = currentLeafs.map(column => {
@@ -14748,35 +14814,19 @@ class ColumnHandleDirective {
14748
14814
  }
14749
14815
  shouldUpdate() {
14750
14816
  return !allLeafColumns(this.columns)
14751
- .map(column => column.width)
14817
+ .map(column => column.width || (this.isConstrainedMode && !column.width && column.implicitWidth))
14752
14818
  .some(isBlank);
14753
14819
  }
14754
14820
  initColumnWidth() {
14755
14821
  this.column.width = headerWidth(this.element);
14822
+ if (this.isConstrainedMode) {
14823
+ this.column.resizeStartWidth = this.column.width;
14824
+ }
14756
14825
  }
14757
14826
  initState() {
14758
14827
  this.column.resizeStartWidth = headerWidth(this.element);
14759
- let columns = [];
14760
- if (this.ctx.grid?.columns) {
14761
- columns = Array.from(this.ctx.grid?.columns) || [];
14762
- }
14763
- if (this.isConstrainedMode) {
14764
- if (this.service.areColumnsReordered) {
14765
- this.service.adjacentColumn = columns.find(c => c.orderIndex === this.column.orderIndex + 1);
14766
- this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14767
- this.service.resizedColumn({
14768
- column: this.service.adjacentColumn,
14769
- oldWidth: this.service.adjacentColumn.resizeStartWidth
14770
- });
14771
- }
14772
- else {
14773
- this.service.adjacentColumn = columns[this.column.leafIndex + 1];
14774
- this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14775
- this.service.resizedColumn({
14776
- column: this.service.adjacentColumn,
14777
- oldWidth: this.service.adjacentColumn.resizeStartWidth
14778
- });
14779
- }
14828
+ if (this.isConstrainedMode && !this.service.adjacentColumn) {
14829
+ this.setAdjacentColumn();
14780
14830
  }
14781
14831
  this.service.resizedColumn({
14782
14832
  column: this.column,
@@ -14793,12 +14843,7 @@ class ColumnHandleDirective {
14793
14843
  newWidth = Math.min(newWidth, this.column.maxResizableWidth);
14794
14844
  }
14795
14845
  if (this.isConstrainedMode) {
14796
- const maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.minResizableWidth;
14797
- newWidth = Math.min(newWidth, maxAllowedResizableWidth);
14798
- }
14799
- if (this.isConstrainedMode && isPresent(this.service.adjacentColumn.maxResizableWidth)) {
14800
- const maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.maxResizableWidth;
14801
- newWidth = Math.max(newWidth, maxAllowedResizableWidth);
14846
+ newWidth = this.calcNewColumnWidth(newWidth);
14802
14847
  }
14803
14848
  const tableDelta = this.getTableDelta(newWidth, delta);
14804
14849
  this.updateWidth(this.column, newWidth);
@@ -14812,11 +14857,8 @@ class ColumnHandleDirective {
14812
14857
  this.service.resizeTable(this.column, tableDelta);
14813
14858
  }
14814
14859
  updateWidth(column, width) {
14815
- if (this.isConstrainedMode && this.service.adjacentColumn) {
14816
- const adjacentColumnNewWidth = column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - width;
14817
- if (adjacentColumnNewWidth < (column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth)) {
14818
- this.service.adjacentColumn.width = adjacentColumnNewWidth;
14819
- }
14860
+ if (this.isConstrainedMode && this.service.adjacentColumn && !this.service.autoFitResize) {
14861
+ this.updateWidthsOfResizedColumns(column, width);
14820
14862
  }
14821
14863
  column.width = width;
14822
14864
  this.columnInfoService.hiddenColumns.forEach((col) => {
@@ -14828,9 +14870,188 @@ class ColumnHandleDirective {
14828
14870
  });
14829
14871
  this.cdr.markForCheck(); //force CD cycle
14830
14872
  }
14873
+ updateWidthsOfResizedColumns(column, width) {
14874
+ let adjacentColumnNewWidth = column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - width;
14875
+ if (this.service.draggedGroupColumn && column.parent) {
14876
+ this.updateWidthOfDraggedColumn(column, width);
14877
+ this.setGroupWidths(this.service.draggedGroupColumn);
14878
+ }
14879
+ else if (!this.service.draggedGroupColumn && !column.parent && this.service.adjacentColumn.parent) {
14880
+ this.service.adjacentColumn.parent.width = column.width + this.service.adjacentColumn.parent.width - width;
14881
+ this.service.adjacentColumn.width = adjacentColumnNewWidth;
14882
+ }
14883
+ else if (!this.service.draggedGroupColumn && column.parent && this.service.adjacentColumn.parent) {
14884
+ adjacentColumnNewWidth = column.width + this.service.adjacentColumn.width - width;
14885
+ this.service.adjacentColumn.width = adjacentColumnNewWidth;
14886
+ const filteredColumns = this.service.adjacentColumn.parent.children.filter(c => c !== this.service.adjacentColumn);
14887
+ const filteredColumnsWidth = filteredColumns.reduce((acc, c) => acc + c.width, 0);
14888
+ this.service.adjacentColumn.parent.width = adjacentColumnNewWidth + filteredColumnsWidth;
14889
+ this.setGroupWidths(this.service.adjacentColumn.parent);
14890
+ }
14891
+ else if (adjacentColumnNewWidth > this.service.adjacentColumn.minResizableWidth) {
14892
+ this.service.adjacentColumn.width = adjacentColumnNewWidth;
14893
+ }
14894
+ }
14895
+ calcNewColumnWidth(newWidth) {
14896
+ let maxAllowedResizableWidth;
14897
+ if (!this.service.adjacentColumn.parent) {
14898
+ maxAllowedResizableWidth = this.column.width + this.service.adjacentColumn.width - this.service.adjacentColumn.minResizableWidth;
14899
+ if (!this.column.parent) {
14900
+ maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.minResizableWidth;
14901
+ if (this.service.adjacentColumn.maxResizableWidth) {
14902
+ const minResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.maxResizableWidth;
14903
+ maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.minResizableWidth;
14904
+ this.column.minResizableWidth = minResizableWidth;
14905
+ this.column.maxResizableWidth = maxAllowedResizableWidth;
14906
+ }
14907
+ }
14908
+ }
14909
+ else {
14910
+ maxAllowedResizableWidth = this.column.width + this.service.adjacentColumn.width;
14911
+ newWidth = Math.min(newWidth, maxAllowedResizableWidth);
14912
+ this.minWidthTotal = 0;
14913
+ const minResizableWidth = this.minAdjacentColumnWidth(this.service.adjacentColumn);
14914
+ maxAllowedResizableWidth -= minResizableWidth;
14915
+ }
14916
+ return Math.min(newWidth, maxAllowedResizableWidth - 1);
14917
+ }
14918
+ setAdjacentColumn() {
14919
+ const columnsForLevel = this.columnsForLevel(this.column.level);
14920
+ if (this.column.parent) {
14921
+ if (this.column.isReordered) {
14922
+ this.service.adjacentColumn = columnsForLevel.find(c => c.orderIndex === this.column.orderIndex + 1);
14923
+ this.service.adjacentColumn.resizeStartWidth = this.service.adjacentColumn.width;
14924
+ }
14925
+ else {
14926
+ const columnIndex = columnsForLevel.indexOf(this.column);
14927
+ this.service.adjacentColumn = columnsForLevel[columnIndex + 1];
14928
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14929
+ const parentColumnChildren = Array.from(this.column.parent.children);
14930
+ const indexOfCurrentColumn = parentColumnChildren.indexOf(this.column);
14931
+ let adjacentColumn;
14932
+ if (indexOfCurrentColumn + 1 <= parentColumnChildren.length - 1) {
14933
+ adjacentColumn = parentColumnChildren[indexOfCurrentColumn + 1];
14934
+ if (adjacentColumn?.isColumnGroup) {
14935
+ this.service.adjacentColumn = adjacentColumn;
14936
+ }
14937
+ }
14938
+ }
14939
+ if (this.service.adjacentColumn.isColumnGroup) {
14940
+ this.foundColumn = null;
14941
+ this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
14942
+ }
14943
+ if (this.column.isColumnGroup) {
14944
+ this.service.draggedGroupColumn = this.column;
14945
+ }
14946
+ }
14947
+ else if (this.column.isColumnGroup) {
14948
+ if (this.column.isReordered) {
14949
+ this.service.adjacentColumn = columnsForLevel.find(c => c.orderIndex === this.column.orderIndex + 1);
14950
+ }
14951
+ else {
14952
+ this.service.adjacentColumn = columnsForLevel[columnsForLevel.indexOf(this.column) + 1];
14953
+ }
14954
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14955
+ if (this.service.adjacentColumn.isColumnGroup) {
14956
+ this.foundColumn = null;
14957
+ this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
14958
+ }
14959
+ this.service.adjacentColumn.resizeStartWidth = this.service.adjacentColumn.width;
14960
+ this.service.draggedGroupColumn = this.column;
14961
+ }
14962
+ else {
14963
+ if (this.column.isReordered) {
14964
+ this.service.adjacentColumn = columnsForLevel.find(col => col.orderIndex === this.column.orderIndex + 1);
14965
+ }
14966
+ else {
14967
+ let adjacentColumn = columnsForLevel.find(c => c.leafIndex === this.column.leafIndex + 1);
14968
+ if (!adjacentColumn) {
14969
+ const indexOfCurrentColumn = columnsForLevel.indexOf(this.column);
14970
+ adjacentColumn = columnsForLevel[indexOfCurrentColumn + 1];
14971
+ }
14972
+ this.service.adjacentColumn = adjacentColumn;
14973
+ }
14974
+ if (!this.service.adjacentColumn.parent) {
14975
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14976
+ }
14977
+ if (this.service.adjacentColumn.isColumnGroup) {
14978
+ this.foundColumn = null;
14979
+ this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
14980
+ const rowIndex = this.service.adjacentColumn.level + 1;
14981
+ const colIndex = this.service.adjacentColumn.leafIndex + 1;
14982
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnInGroupWidth(this.element, rowIndex, colIndex);
14983
+ }
14984
+ }
14985
+ this.service.resizedColumn({
14986
+ column: this.service.adjacentColumn,
14987
+ oldWidth: this.service.adjacentColumn.resizeStartWidth
14988
+ });
14989
+ }
14990
+ firstGroupChild(column) {
14991
+ Array.from(column.children).sort((a, b) => a.orderIndex - b.orderIndex).forEach((c, idx) => {
14992
+ if (idx === 0 && !c.isColumnGroup) {
14993
+ if (!this.foundColumn) {
14994
+ this.foundColumn = c;
14995
+ }
14996
+ }
14997
+ else if (c.isColumnGroup) {
14998
+ this.firstGroupChild(c);
14999
+ }
15000
+ });
15001
+ return this.foundColumn;
15002
+ }
15003
+ setGroupWidths(column) {
15004
+ const childrenWidths = column.children.reduce((acc, c) => acc + c.width, 0);
15005
+ column.width = childrenWidths;
15006
+ column.children.forEach(c => {
15007
+ if (c.isColumnGroup) {
15008
+ this.setGroupWidths(c);
15009
+ }
15010
+ });
15011
+ }
15012
+ updateWidthOfDraggedColumn(column, width) {
15013
+ this.totalChildrenSum = 0;
15014
+ this.childrenColumns = [];
15015
+ this.calcChildrenWidth(this.service.draggedGroupColumn);
15016
+ const childrenWidthNotIncludingColumn = this.childrenColumns.reduce((acc, col) => {
15017
+ return col !== column ? acc + col.width : acc;
15018
+ }, 0);
15019
+ this.service.draggedGroupColumn.width = childrenWidthNotIncludingColumn + width;
15020
+ if (this.service.adjacentColumn.minResizableWidth <= this.totalChildrenSum + this.service.adjacentColumn.resizeStartWidth - width - childrenWidthNotIncludingColumn) {
15021
+ this.service.adjacentColumn.width = this.totalChildrenSum + this.service.adjacentColumn.resizeStartWidth - width - childrenWidthNotIncludingColumn;
15022
+ }
15023
+ }
15024
+ calcChildrenWidth(column) {
15025
+ const columnChildren = Array.from(column.children);
15026
+ const childrenNoGroups = columnChildren.filter(c => !c.isColumnGroup);
15027
+ const childrenGroups = columnChildren.filter(c => c.isColumnGroup);
15028
+ childrenNoGroups.forEach(col => {
15029
+ if (this.childrenColumns.indexOf(col) === -1) {
15030
+ this.childrenColumns.push(col);
15031
+ }
15032
+ });
15033
+ this.totalChildrenSum += childrenNoGroups.reduce((acc, col) => acc + col.resizeStartWidth, 0);
15034
+ childrenGroups.forEach((col) => {
15035
+ this.calcChildrenWidth(col);
15036
+ });
15037
+ }
14831
15038
  columnsForLevel(level) {
14832
15039
  return columnsToRender(this.columns ? this.columns.filter(column => column.level === level) : []);
14833
15040
  }
15041
+ minAdjacentColumnWidth(column) {
15042
+ if (column.isColumnGroup) {
15043
+ Array.from(column.children).forEach(c => {
15044
+ this.minAdjacentColumnWidth(c);
15045
+ });
15046
+ }
15047
+ else {
15048
+ this.minWidthTotal += column.minResizableWidth;
15049
+ if (column.width < column.minResizableWidth) {
15050
+ column.width = column.minResizableWidth;
15051
+ }
15052
+ }
15053
+ return this.minWidthTotal;
15054
+ }
14834
15055
  getTableDelta(newWidth, delta) {
14835
15056
  const minWidth = this.column.minResizableWidth;
14836
15057
  const maxWidth = this.column.maxResizableWidth;
@@ -14855,6 +15076,18 @@ class ColumnHandleDirective {
14855
15076
  event.stopPropagation();
14856
15077
  event.preventDefault();
14857
15078
  };
15079
+ isLastInGroup(column) {
15080
+ if (column.parent) {
15081
+ const groupChildren = Array.from(column.parent.children);
15082
+ const indexOfCurrentColumn = groupChildren.indexOf(column);
15083
+ if (column.isReordered || column.orderIndex > 0 || (column.isReordered && column.orderIndex === 0)) {
15084
+ return (column.orderIndex - groupChildren[0].orderIndex) === groupChildren.length - 1;
15085
+ }
15086
+ else {
15087
+ return indexOfCurrentColumn === groupChildren.length - 1;
15088
+ }
15089
+ }
15090
+ }
14858
15091
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnHandleDirective, deps: [{ token: i1$3.DraggableDirective, host: true }, { token: i0.ElementRef }, { token: ColumnResizingService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: ContextService }, { token: ColumnInfoService }], target: i0.ɵɵFactoryTarget.Directive });
14859
15092
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ColumnHandleDirective, isStandalone: true, selector: "[kendoGridColumnHandle]", inputs: { isLast: "isLast", columns: "columns", column: "column" }, host: { listeners: { "dblclick": "autoFit()" }, properties: { "style.display": "this.visible", "style.left": "this.leftStyle", "style.right": "this.rightStyle" } }, ngImport: i0 });
14860
15093
  }
@@ -16275,9 +16508,6 @@ class HeaderComponent {
16275
16508
  isCheckboxColumn(column) {
16276
16509
  return isCheckboxColumn(column) && !column.templateRef;
16277
16510
  }
16278
- trackByIndex(index) {
16279
- return index;
16280
- }
16281
16511
  addStickyStyles(column) {
16282
16512
  const stickyStyles = this.columnInfoService.stickyColumnsStyles(column);
16283
16513
  return { ...column.headerStyle, ...stickyStyles };
@@ -16416,7 +16646,7 @@ class HeaderComponent {
16416
16646
  *ngIf="detailTemplate?.templateRef"
16417
16647
  >
16418
16648
  </th>
16419
- <ng-container *ngFor="let column of columnsForLevel(levelIndex); trackBy: trackByIndex; let columnIndex = index; let last = last;">
16649
+ <ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
16420
16650
  <th *ngIf="!isColumnGroupComponent(column)"
16421
16651
  kendoGridLogicalCell
16422
16652
  [logicalRowIndex]="levelIndex"
@@ -16643,7 +16873,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
16643
16873
  *ngIf="detailTemplate?.templateRef"
16644
16874
  >
16645
16875
  </th>
16646
- <ng-container *ngFor="let column of columnsForLevel(levelIndex); trackBy: trackByIndex; let columnIndex = index; let last = last;">
16876
+ <ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
16647
16877
  <th *ngIf="!isColumnGroupComponent(column)"
16648
16878
  kendoGridLogicalCell
16649
16879
  [logicalRowIndex]="levelIndex"
@@ -19480,8 +19710,8 @@ const packageMetadata = {
19480
19710
  productName: 'Kendo UI for Angular',
19481
19711
  productCode: 'KENDOUIANGULAR',
19482
19712
  productCodes: ['KENDOUIANGULAR'],
19483
- publishDate: 1738245965,
19484
- version: '18.1.0-develop.3',
19713
+ publishDate: 1739264413,
19714
+ version: '18.1.0-develop.31',
19485
19715
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
19486
19716
  };
19487
19717
 
@@ -21441,7 +21671,7 @@ class TableDirective {
21441
21671
  const constrainedModeNoShift = this.ctx.grid?.resizable === 'constrained' && !this.service.isShiftPressed;
21442
21672
  const unconstrainedModeShift = (this.ctx.grid?.resizable === true || this.ctx.grid?.resizable === 'unconstrained') && this.service.isShiftPressed;
21443
21673
  const isConstrainedMode = constrainedModeNoShift || unconstrainedModeShift;
21444
- if (isConstrainedMode) {
21674
+ if (isConstrainedMode && !this.service.autoFitResize) {
21445
21675
  this.renderer.setStyle(this.element.nativeElement, 'width', this.service.originalWidth + 'px');
21446
21676
  }
21447
21677
  else {
@@ -23470,6 +23700,11 @@ class GridComponent {
23470
23700
  * @default false
23471
23701
  */
23472
23702
  groupable = false;
23703
+ /**
23704
+ * Determines whether the Grid can be resized.
23705
+ * @default false
23706
+ */
23707
+ gridResizable = false;
23473
23708
  /**
23474
23709
  * Enables the [row reordering]({% slug reordering_rows_grid %}) of the Grid.
23475
23710
  * @default false
@@ -23807,6 +24042,21 @@ class GridComponent {
23807
24042
  get noScrollbarClass() {
23808
24043
  return this.scrollbarWidth === 0;
23809
24044
  }
24045
+ get isResizable() {
24046
+ return Boolean(this.gridResizable);
24047
+ }
24048
+ get minWidth() {
24049
+ return this.gridResizable.minWidth;
24050
+ }
24051
+ get maxWidth() {
24052
+ return this.gridResizable.maxWidth;
24053
+ }
24054
+ get minHeight() {
24055
+ return this.gridResizable.minHeight;
24056
+ }
24057
+ get maxHeight() {
24058
+ return this.gridResizable.maxHeight;
24059
+ }
23810
24060
  detailTemplateChildren;
23811
24061
  get detailTemplate() {
23812
24062
  if (this._customDetailTemplate) {
@@ -24766,16 +25016,19 @@ class GridComponent {
24766
25016
  }
24767
25017
  else if (column === source) {
24768
25018
  i += toSkip;
25019
+ column.isReordered = true;
24769
25020
  continue;
24770
25021
  }
24771
25022
  else {
24772
25023
  column.orderIndex = nextIndex;
24773
25024
  }
25025
+ column.isReordered = true;
24774
25026
  nextIndex++;
24775
25027
  i++;
24776
25028
  }
24777
25029
  for (i = sourceColumnIndex; i < sourceColumnIndex + toSkip; i++) {
24778
25030
  expandedColumns[i].orderIndex = nextSourceIndex++;
25031
+ expandedColumns[i].isReordered = true;
24779
25032
  }
24780
25033
  this.updateIndicesForLevel(source.level + 1);
24781
25034
  this.columnResizingService.areColumnsReordered = true;
@@ -24788,7 +25041,11 @@ class GridComponent {
24788
25041
  colsForLevel.push(...c.childrenArray.sort((a, b) => a.orderIndex - b.orderIndex));
24789
25042
  }
24790
25043
  });
24791
- expandColumnsWithSpan(colsForLevel).map((c, i) => c.orderIndex = i);
25044
+ expandColumnsWithSpan(colsForLevel).map((c, i) => {
25045
+ c.orderIndex = i;
25046
+ c.isReordered = true;
25047
+ return c;
25048
+ });
24792
25049
  if (level < this.columnList.totalColumnLevels()) {
24793
25050
  this.updateIndicesForLevel(level + 1);
24794
25051
  }
@@ -25106,8 +25363,8 @@ class GridComponent {
25106
25363
  .filter(item => isTruthy(item.column.resizable) && !item.column.isColumnGroup)
25107
25364
  .map(item => ({
25108
25365
  column: item.column,
25109
- newWidth: item.column.width,
25110
- oldWidth: item.oldWidth
25366
+ newWidth: roundDown(item.column.width),
25367
+ oldWidth: roundDown(item.oldWidth)
25111
25368
  }));
25112
25369
  this.columnResize.emit(args);
25113
25370
  }
@@ -25228,7 +25485,7 @@ class GridComponent {
25228
25485
  this.dropTargetContainer?.notify();
25229
25486
  }
25230
25487
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GridComponent, deps: [{ token: BrowserSupportService }, { token: SelectionService }, { token: CellSelectionService }, { token: i0.ElementRef }, { token: GroupInfoService }, { token: GroupsService }, { token: ChangeNotificationService }, { token: DetailsService }, { token: EditService }, { token: FilterService }, { token: PDFService }, { token: ResponsiveService }, { token: i0.Renderer2 }, { token: ExcelService }, { token: i0.NgZone }, { token: ScrollSyncService }, { token: DomEventsService }, { token: ColumnResizingService }, { token: i0.ChangeDetectorRef }, { token: ColumnReorderService }, { token: ColumnInfoService }, { token: NavigationService }, { token: SortService }, { token: ScrollRequestService }, { token: i1$2.LocalizationService }, { token: ContextService }, { token: SizingOptionsService }, { token: RowReorderService }], target: i0.ɵɵFactoryTarget.Component });
25231
- 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: [
25488
+ 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: [
25232
25489
  BrowserSupportService,
25233
25490
  LocalizationService,
25234
25491
  ColumnInfoService,
@@ -26685,6 +26942,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
26685
26942
  type: Input
26686
26943
  }], groupable: [{
26687
26944
  type: Input
26945
+ }], gridResizable: [{
26946
+ type: Input
26688
26947
  }], rowReorderable: [{
26689
26948
  type: Input
26690
26949
  }], navigable: [{
@@ -26791,6 +27050,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
26791
27050
  }], noScrollbarClass: [{
26792
27051
  type: HostBinding,
26793
27052
  args: ['class.k-grid-no-scrollbar']
27053
+ }], isResizable: [{
27054
+ type: HostBinding,
27055
+ args: ['class.k-grid-resizable']
27056
+ }], minWidth: [{
27057
+ type: HostBinding,
27058
+ args: ['style.minWidth']
27059
+ }], maxWidth: [{
27060
+ type: HostBinding,
27061
+ args: ['style.maxWidth']
27062
+ }], minHeight: [{
27063
+ type: HostBinding,
27064
+ args: ['style.minHeight']
27065
+ }], maxHeight: [{
27066
+ type: HostBinding,
27067
+ args: ['style.maxHeight']
26794
27068
  }], detailTemplateChildren: [{
26795
27069
  type: ContentChildren,
26796
27070
  args: [DetailTemplateDirective]
@@ -80,6 +80,7 @@ import { DragTargetContainerDirective, DragTargetDataFn, DropTargetContainerDire
80
80
  import { RowReorderService } from './row-reordering/row-reorder.service';
81
81
  import { StatusBarTemplateDirective } from './aggregates/status-bar-template.directive';
82
82
  import { PagerTemplateDirective } from '@progress/kendo-angular-pager';
83
+ import { GridResizableSettings } from './common/resizable-settings';
83
84
  import * as i0 from "@angular/core";
84
85
  /**
85
86
  * Represents the Kendo UI for Angular Data Grid component.
@@ -271,6 +272,11 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
271
272
  * @default false
272
273
  */
273
274
  groupable: GroupableSettings | boolean;
275
+ /**
276
+ * Determines whether the Grid can be resized.
277
+ * @default false
278
+ */
279
+ gridResizable: GridResizableSettings | boolean;
274
280
  /**
275
281
  * Enables the [row reordering]({% slug reordering_rows_grid %}) of the Grid.
276
282
  * @default false
@@ -516,6 +522,11 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
516
522
  get lockedClasses(): boolean;
517
523
  get virtualClasses(): boolean;
518
524
  get noScrollbarClass(): boolean;
525
+ get isResizable(): boolean;
526
+ get minWidth(): string;
527
+ get maxWidth(): string;
528
+ get minHeight(): string;
529
+ get maxHeight(): string;
519
530
  detailTemplateChildren: QueryList<DetailTemplateDirective>;
520
531
  get detailTemplate(): DetailTemplateDirective;
521
532
  set detailTemplate(detailTemplate: DetailTemplateDirective);
@@ -934,5 +945,5 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
934
945
  private shouldResetSelection;
935
946
  private notifyReorderContainers;
936
947
  static ɵfac: i0.ɵɵFactoryDeclaration<GridComponent, never>;
937
- static ɵcmp: i0.ɵɵComponentDeclaration<GridComponent, "kendo-grid", ["kendoGrid"], { "data": { "alias": "data"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "height": { "alias": "height"; "required": false; }; "rowHeight": { "alias": "rowHeight"; "required": false; }; "detailRowHeight": { "alias": "detailRowHeight"; "required": false; }; "skip": { "alias": "skip"; "required": false; }; "scrollable": { "alias": "scrollable"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "sort": { "alias": "sort"; "required": false; }; "size": { "alias": "size"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "group": { "alias": "group"; "required": false; }; "virtualColumns": { "alias": "virtualColumns"; "required": false; }; "filterable": { "alias": "filterable"; "required": false; }; "sortable": { "alias": "sortable"; "required": false; }; "pageable": { "alias": "pageable"; "required": false; }; "groupable": { "alias": "groupable"; "required": false; }; "rowReorderable": { "alias": "rowReorderable"; "required": false; }; "navigable": { "alias": "navigable"; "required": false; }; "navigatable": { "alias": "navigatable"; "required": false; }; "autoSize": { "alias": "autoSize"; "required": false; }; "rowClass": { "alias": "rowClass"; "required": false; }; "rowSticky": { "alias": "rowSticky"; "required": false; }; "rowSelected": { "alias": "rowSelected"; "required": false; }; "isRowSelectable": { "alias": "isRowSelectable"; "required": false; }; "cellSelected": { "alias": "cellSelected"; "required": false; }; "resizable": { "alias": "resizable"; "required": false; }; "reorderable": { "alias": "reorderable"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "columnMenu": { "alias": "columnMenu"; "required": false; }; "hideHeader": { "alias": "hideHeader"; "required": false; }; "isDetailExpanded": { "alias": "isDetailExpanded"; "required": false; }; "isGroupExpanded": { "alias": "isGroupExpanded"; "required": false; }; }, { "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"; }, ["columns", "detailTemplateChildren", "cellLoadingTemplateChildren", "loadingTemplateChildren", "statusBarTemplateChildren", "noRecordsTemplateChildren", "pagerTemplateChildren", "toolbarTemplateChildren", "columnMenuTemplates"], ["kendo-toolbar"], true, never>;
948
+ static ɵcmp: i0.ɵɵComponentDeclaration<GridComponent, "kendo-grid", ["kendoGrid"], { "data": { "alias": "data"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "height": { "alias": "height"; "required": false; }; "rowHeight": { "alias": "rowHeight"; "required": false; }; "detailRowHeight": { "alias": "detailRowHeight"; "required": false; }; "skip": { "alias": "skip"; "required": false; }; "scrollable": { "alias": "scrollable"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "sort": { "alias": "sort"; "required": false; }; "size": { "alias": "size"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "group": { "alias": "group"; "required": false; }; "virtualColumns": { "alias": "virtualColumns"; "required": false; }; "filterable": { "alias": "filterable"; "required": false; }; "sortable": { "alias": "sortable"; "required": false; }; "pageable": { "alias": "pageable"; "required": false; }; "groupable": { "alias": "groupable"; "required": false; }; "gridResizable": { "alias": "gridResizable"; "required": false; }; "rowReorderable": { "alias": "rowReorderable"; "required": false; }; "navigable": { "alias": "navigable"; "required": false; }; "navigatable": { "alias": "navigatable"; "required": false; }; "autoSize": { "alias": "autoSize"; "required": false; }; "rowClass": { "alias": "rowClass"; "required": false; }; "rowSticky": { "alias": "rowSticky"; "required": false; }; "rowSelected": { "alias": "rowSelected"; "required": false; }; "isRowSelectable": { "alias": "isRowSelectable"; "required": false; }; "cellSelected": { "alias": "cellSelected"; "required": false; }; "resizable": { "alias": "resizable"; "required": false; }; "reorderable": { "alias": "reorderable"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "columnMenu": { "alias": "columnMenu"; "required": false; }; "hideHeader": { "alias": "hideHeader"; "required": false; }; "isDetailExpanded": { "alias": "isDetailExpanded"; "required": false; }; "isGroupExpanded": { "alias": "isGroupExpanded"; "required": false; }; }, { "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"; }, ["columns", "detailTemplateChildren", "cellLoadingTemplateChildren", "loadingTemplateChildren", "statusBarTemplateChildren", "noRecordsTemplateChildren", "pagerTemplateChildren", "toolbarTemplateChildren", "columnMenuTemplates"], ["kendo-toolbar"], true, never>;
938
949
  }