@progress/kendo-angular-grid 18.1.0-develop.8 → 18.1.0

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) {
@@ -4764,6 +4816,9 @@ class LogicalCellDirective {
4764
4816
  get cellRowspan() {
4765
4817
  return String(this.rowSpan);
4766
4818
  }
4819
+ get rowspanClass() {
4820
+ return this.dataRowIndex > -1 && this.rowSpan > 1;
4821
+ }
4767
4822
  get ariaColIndex() {
4768
4823
  if (this.logicalSlaveCell || this.logicalColIndex === -1) {
4769
4824
  return undefined;
@@ -4870,7 +4925,7 @@ class LogicalCellDirective {
4870
4925
  return this.navigationService.isCellFocused(this);
4871
4926
  }
4872
4927
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogicalCellDirective, deps: [{ token: FocusGroup }, { token: i0.ElementRef }, { token: ColumnInfoService }, { token: IdService }, { token: NavigationService }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: CELL_CONTEXT, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
4873
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LogicalCellDirective, isStandalone: true, selector: "[kendoGridLogicalCell]", inputs: { logicalColIndex: "logicalColIndex", logicalRowIndex: "logicalRowIndex", logicalSlaveCell: "logicalSlaveCell", colIndex: "colIndex", colSpan: "colSpan", rowSpan: "rowSpan", groupItem: "groupItem", dataRowIndex: "dataRowIndex", dataItem: "dataItem", detailExpandCell: "detailExpandCell", headerLabelText: "headerLabelText" }, host: { properties: { "attr.id": "this.id", "attr.rowspan": "this.cellRowspan", "attr.aria-colindex": "this.ariaColIndex" } }, providers: [{
4928
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LogicalCellDirective, isStandalone: true, selector: "[kendoGridLogicalCell]", inputs: { logicalColIndex: "logicalColIndex", logicalRowIndex: "logicalRowIndex", logicalSlaveCell: "logicalSlaveCell", colIndex: "colIndex", colSpan: "colSpan", rowSpan: "rowSpan", groupItem: "groupItem", dataRowIndex: "dataRowIndex", dataItem: "dataItem", detailExpandCell: "detailExpandCell", headerLabelText: "headerLabelText" }, host: { properties: { "attr.id": "this.id", "attr.rowspan": "this.cellRowspan", "class.k-table-td-row-span": "this.rowspanClass", "attr.aria-colindex": "this.ariaColIndex" } }, providers: [{
4874
4929
  provide: FocusGroup,
4875
4930
  deps: [FocusRoot],
4876
4931
  useClass: FocusGroup
@@ -4920,6 +4975,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
4920
4975
  }], cellRowspan: [{
4921
4976
  type: HostBinding,
4922
4977
  args: ['attr.rowspan']
4978
+ }], rowspanClass: [{
4979
+ type: HostBinding,
4980
+ args: ['class.k-table-td-row-span']
4923
4981
  }], ariaColIndex: [{
4924
4982
  type: HostBinding,
4925
4983
  args: ['attr.aria-colindex']
@@ -14606,11 +14664,20 @@ const toPercentage = (value, whole) => (value / whole) * 100;
14606
14664
  /**
14607
14665
  * @hidden
14608
14666
  */
14609
- const headerWidth = (handle) => handle.nativeElement.parentElement.offsetWidth;
14667
+ const headerWidth = (handle) => handle.nativeElement.parentElement.getBoundingClientRect().width;
14610
14668
  /**
14611
14669
  * @hidden
14612
14670
  */
14613
- const adjacentColumnWidth = (handle) => handle.nativeElement.parentElement.nextElementSibling?.offsetWidth;
14671
+ const adjacentColumnWidth = (handle) => handle.nativeElement.parentElement.nextElementSibling?.getBoundingClientRect().width;
14672
+ /**
14673
+ * @hidden
14674
+ */
14675
+ const adjacentColumnInGroupWidth = (handle, rowIndex, colIndex) => {
14676
+ const tableElement = handle.nativeElement.closest('.k-grid-header-table');
14677
+ const selector = (rowAttribute) => `tr[${rowAttribute}="${rowIndex}"] th[aria-colindex="${colIndex}"]`;
14678
+ const thElement = tableElement.querySelector([selector('aria-rowindex'), selector('data-kendo-grid-row-index')]);
14679
+ return thElement.getBoundingClientRect().width;
14680
+ };
14614
14681
  /**
14615
14682
  * @hidden
14616
14683
  */
@@ -14670,7 +14737,7 @@ class ColumnHandleDirective {
14670
14737
  columns = [];
14671
14738
  column;
14672
14739
  get visible() {
14673
- if (this.isConstrainedMode && this.isLast) {
14740
+ if (this.isConstrainedMode && (this.isLast || this.isLastInGroup(this.column))) {
14674
14741
  return 'none';
14675
14742
  }
14676
14743
  return this.column.resizable ? 'block' : 'none';
@@ -14690,7 +14757,12 @@ class ColumnHandleDirective {
14690
14757
  }
14691
14758
  subscriptions = new Subscription();
14692
14759
  rtl = false;
14760
+ totalChildrenSum = 0;
14761
+ childrenColumns = [];
14762
+ minWidthTotal = 0;
14763
+ foundColumn;
14693
14764
  autoFit() {
14765
+ this.service.autoFitResize = true;
14694
14766
  const allLeafs = allLeafColumns(this.columns);
14695
14767
  const currentLeafs = leafColumns([this.column]).filter(column => isTruthy(column.resizable));
14696
14768
  const columnInfo = currentLeafs.map(column => {
@@ -14748,35 +14820,19 @@ class ColumnHandleDirective {
14748
14820
  }
14749
14821
  shouldUpdate() {
14750
14822
  return !allLeafColumns(this.columns)
14751
- .map(column => column.width)
14823
+ .map(column => column.width || (this.isConstrainedMode && !column.width && column.implicitWidth))
14752
14824
  .some(isBlank);
14753
14825
  }
14754
14826
  initColumnWidth() {
14755
14827
  this.column.width = headerWidth(this.element);
14828
+ if (this.isConstrainedMode) {
14829
+ this.column.resizeStartWidth = this.column.width;
14830
+ }
14756
14831
  }
14757
14832
  initState() {
14758
14833
  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
- }
14834
+ if (this.isConstrainedMode && !this.service.adjacentColumn) {
14835
+ this.setAdjacentColumn();
14780
14836
  }
14781
14837
  this.service.resizedColumn({
14782
14838
  column: this.column,
@@ -14793,12 +14849,7 @@ class ColumnHandleDirective {
14793
14849
  newWidth = Math.min(newWidth, this.column.maxResizableWidth);
14794
14850
  }
14795
14851
  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);
14852
+ newWidth = this.calcNewColumnWidth(newWidth);
14802
14853
  }
14803
14854
  const tableDelta = this.getTableDelta(newWidth, delta);
14804
14855
  this.updateWidth(this.column, newWidth);
@@ -14812,11 +14863,8 @@ class ColumnHandleDirective {
14812
14863
  this.service.resizeTable(this.column, tableDelta);
14813
14864
  }
14814
14865
  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
- }
14866
+ if (this.isConstrainedMode && this.service.adjacentColumn && !this.service.autoFitResize) {
14867
+ this.updateWidthsOfResizedColumns(column, width);
14820
14868
  }
14821
14869
  column.width = width;
14822
14870
  this.columnInfoService.hiddenColumns.forEach((col) => {
@@ -14828,9 +14876,188 @@ class ColumnHandleDirective {
14828
14876
  });
14829
14877
  this.cdr.markForCheck(); //force CD cycle
14830
14878
  }
14879
+ updateWidthsOfResizedColumns(column, width) {
14880
+ let adjacentColumnNewWidth = column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - width;
14881
+ if (this.service.draggedGroupColumn && column.parent) {
14882
+ this.updateWidthOfDraggedColumn(column, width);
14883
+ this.setGroupWidths(this.service.draggedGroupColumn);
14884
+ }
14885
+ else if (!this.service.draggedGroupColumn && !column.parent && this.service.adjacentColumn.parent) {
14886
+ this.service.adjacentColumn.parent.width = column.width + this.service.adjacentColumn.parent.width - width;
14887
+ this.service.adjacentColumn.width = adjacentColumnNewWidth;
14888
+ }
14889
+ else if (!this.service.draggedGroupColumn && column.parent && this.service.adjacentColumn.parent) {
14890
+ adjacentColumnNewWidth = column.width + this.service.adjacentColumn.width - width;
14891
+ this.service.adjacentColumn.width = adjacentColumnNewWidth;
14892
+ const filteredColumns = this.service.adjacentColumn.parent.children.filter(c => c !== this.service.adjacentColumn);
14893
+ const filteredColumnsWidth = filteredColumns.reduce((acc, c) => acc + c.width, 0);
14894
+ this.service.adjacentColumn.parent.width = adjacentColumnNewWidth + filteredColumnsWidth;
14895
+ this.setGroupWidths(this.service.adjacentColumn.parent);
14896
+ }
14897
+ else if (adjacentColumnNewWidth > this.service.adjacentColumn.minResizableWidth) {
14898
+ this.service.adjacentColumn.width = adjacentColumnNewWidth;
14899
+ }
14900
+ }
14901
+ calcNewColumnWidth(newWidth) {
14902
+ let maxAllowedResizableWidth;
14903
+ if (!this.service.adjacentColumn.parent) {
14904
+ maxAllowedResizableWidth = this.column.width + this.service.adjacentColumn.width - this.service.adjacentColumn.minResizableWidth;
14905
+ if (!this.column.parent) {
14906
+ maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.minResizableWidth;
14907
+ if (this.service.adjacentColumn.maxResizableWidth) {
14908
+ const minResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.maxResizableWidth;
14909
+ maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.minResizableWidth;
14910
+ this.column.minResizableWidth = minResizableWidth;
14911
+ this.column.maxResizableWidth = maxAllowedResizableWidth;
14912
+ }
14913
+ }
14914
+ }
14915
+ else {
14916
+ maxAllowedResizableWidth = this.column.width + this.service.adjacentColumn.width;
14917
+ newWidth = Math.min(newWidth, maxAllowedResizableWidth);
14918
+ this.minWidthTotal = 0;
14919
+ const minResizableWidth = this.minAdjacentColumnWidth(this.service.adjacentColumn);
14920
+ maxAllowedResizableWidth -= minResizableWidth;
14921
+ }
14922
+ return Math.min(newWidth, maxAllowedResizableWidth - 1);
14923
+ }
14924
+ setAdjacentColumn() {
14925
+ const columnsForLevel = this.columnsForLevel(this.column.level);
14926
+ if (this.column.parent) {
14927
+ if (this.column.isReordered) {
14928
+ this.service.adjacentColumn = columnsForLevel.find(c => c.orderIndex === this.column.orderIndex + 1);
14929
+ this.service.adjacentColumn.resizeStartWidth = this.service.adjacentColumn.width;
14930
+ }
14931
+ else {
14932
+ const columnIndex = columnsForLevel.indexOf(this.column);
14933
+ this.service.adjacentColumn = columnsForLevel[columnIndex + 1];
14934
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14935
+ const parentColumnChildren = Array.from(this.column.parent.children);
14936
+ const indexOfCurrentColumn = parentColumnChildren.indexOf(this.column);
14937
+ let adjacentColumn;
14938
+ if (indexOfCurrentColumn + 1 <= parentColumnChildren.length - 1) {
14939
+ adjacentColumn = parentColumnChildren[indexOfCurrentColumn + 1];
14940
+ if (adjacentColumn?.isColumnGroup) {
14941
+ this.service.adjacentColumn = adjacentColumn;
14942
+ }
14943
+ }
14944
+ }
14945
+ if (this.service.adjacentColumn.isColumnGroup) {
14946
+ this.foundColumn = null;
14947
+ this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
14948
+ }
14949
+ if (this.column.isColumnGroup) {
14950
+ this.service.draggedGroupColumn = this.column;
14951
+ }
14952
+ }
14953
+ else if (this.column.isColumnGroup) {
14954
+ if (this.column.isReordered) {
14955
+ this.service.adjacentColumn = columnsForLevel.find(c => c.orderIndex === this.column.orderIndex + 1);
14956
+ }
14957
+ else {
14958
+ this.service.adjacentColumn = columnsForLevel[columnsForLevel.indexOf(this.column) + 1];
14959
+ }
14960
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14961
+ if (this.service.adjacentColumn.isColumnGroup) {
14962
+ this.foundColumn = null;
14963
+ this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
14964
+ }
14965
+ this.service.adjacentColumn.resizeStartWidth = this.service.adjacentColumn.width;
14966
+ this.service.draggedGroupColumn = this.column;
14967
+ }
14968
+ else {
14969
+ if (this.column.isReordered) {
14970
+ this.service.adjacentColumn = columnsForLevel.find(col => col.orderIndex === this.column.orderIndex + 1);
14971
+ }
14972
+ else {
14973
+ let adjacentColumn = columnsForLevel.find(c => c.leafIndex === this.column.leafIndex + 1);
14974
+ if (!adjacentColumn) {
14975
+ const indexOfCurrentColumn = columnsForLevel.indexOf(this.column);
14976
+ adjacentColumn = columnsForLevel[indexOfCurrentColumn + 1];
14977
+ }
14978
+ this.service.adjacentColumn = adjacentColumn;
14979
+ }
14980
+ if (!this.service.adjacentColumn.parent) {
14981
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
14982
+ }
14983
+ if (this.service.adjacentColumn.isColumnGroup) {
14984
+ this.foundColumn = null;
14985
+ this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
14986
+ const rowIndex = this.service.adjacentColumn.level + 1;
14987
+ const colIndex = this.service.adjacentColumn.leafIndex + 1;
14988
+ this.service.adjacentColumn.resizeStartWidth = adjacentColumnInGroupWidth(this.element, rowIndex, colIndex);
14989
+ }
14990
+ }
14991
+ this.service.resizedColumn({
14992
+ column: this.service.adjacentColumn,
14993
+ oldWidth: this.service.adjacentColumn.resizeStartWidth
14994
+ });
14995
+ }
14996
+ firstGroupChild(column) {
14997
+ Array.from(column.children).sort((a, b) => a.orderIndex - b.orderIndex).forEach((c, idx) => {
14998
+ if (idx === 0 && !c.isColumnGroup) {
14999
+ if (!this.foundColumn) {
15000
+ this.foundColumn = c;
15001
+ }
15002
+ }
15003
+ else if (c.isColumnGroup) {
15004
+ this.firstGroupChild(c);
15005
+ }
15006
+ });
15007
+ return this.foundColumn;
15008
+ }
15009
+ setGroupWidths(column) {
15010
+ const childrenWidths = column.children.reduce((acc, c) => acc + c.width, 0);
15011
+ column.width = childrenWidths;
15012
+ column.children.forEach(c => {
15013
+ if (c.isColumnGroup) {
15014
+ this.setGroupWidths(c);
15015
+ }
15016
+ });
15017
+ }
15018
+ updateWidthOfDraggedColumn(column, width) {
15019
+ this.totalChildrenSum = 0;
15020
+ this.childrenColumns = [];
15021
+ this.calcChildrenWidth(this.service.draggedGroupColumn);
15022
+ const childrenWidthNotIncludingColumn = this.childrenColumns.reduce((acc, col) => {
15023
+ return col !== column ? acc + col.width : acc;
15024
+ }, 0);
15025
+ this.service.draggedGroupColumn.width = childrenWidthNotIncludingColumn + width;
15026
+ if (this.service.adjacentColumn.minResizableWidth <= this.totalChildrenSum + this.service.adjacentColumn.resizeStartWidth - width - childrenWidthNotIncludingColumn) {
15027
+ this.service.adjacentColumn.width = this.totalChildrenSum + this.service.adjacentColumn.resizeStartWidth - width - childrenWidthNotIncludingColumn;
15028
+ }
15029
+ }
15030
+ calcChildrenWidth(column) {
15031
+ const columnChildren = Array.from(column.children);
15032
+ const childrenNoGroups = columnChildren.filter(c => !c.isColumnGroup);
15033
+ const childrenGroups = columnChildren.filter(c => c.isColumnGroup);
15034
+ childrenNoGroups.forEach(col => {
15035
+ if (this.childrenColumns.indexOf(col) === -1) {
15036
+ this.childrenColumns.push(col);
15037
+ }
15038
+ });
15039
+ this.totalChildrenSum += childrenNoGroups.reduce((acc, col) => acc + col.resizeStartWidth, 0);
15040
+ childrenGroups.forEach((col) => {
15041
+ this.calcChildrenWidth(col);
15042
+ });
15043
+ }
14831
15044
  columnsForLevel(level) {
14832
15045
  return columnsToRender(this.columns ? this.columns.filter(column => column.level === level) : []);
14833
15046
  }
15047
+ minAdjacentColumnWidth(column) {
15048
+ if (column.isColumnGroup) {
15049
+ Array.from(column.children).forEach(c => {
15050
+ this.minAdjacentColumnWidth(c);
15051
+ });
15052
+ }
15053
+ else {
15054
+ this.minWidthTotal += column.minResizableWidth;
15055
+ if (column.width < column.minResizableWidth) {
15056
+ column.width = column.minResizableWidth;
15057
+ }
15058
+ }
15059
+ return this.minWidthTotal;
15060
+ }
14834
15061
  getTableDelta(newWidth, delta) {
14835
15062
  const minWidth = this.column.minResizableWidth;
14836
15063
  const maxWidth = this.column.maxResizableWidth;
@@ -14855,6 +15082,18 @@ class ColumnHandleDirective {
14855
15082
  event.stopPropagation();
14856
15083
  event.preventDefault();
14857
15084
  };
15085
+ isLastInGroup(column) {
15086
+ if (column.parent) {
15087
+ const groupChildren = Array.from(column.parent.children);
15088
+ const indexOfCurrentColumn = groupChildren.indexOf(column);
15089
+ if (column.isReordered || column.orderIndex > 0 || (column.isReordered && column.orderIndex === 0)) {
15090
+ return (column.orderIndex - groupChildren[0].orderIndex) === groupChildren.length - 1;
15091
+ }
15092
+ else {
15093
+ return indexOfCurrentColumn === groupChildren.length - 1;
15094
+ }
15095
+ }
15096
+ }
14858
15097
  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
15098
  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
15099
  }
@@ -16275,9 +16514,6 @@ class HeaderComponent {
16275
16514
  isCheckboxColumn(column) {
16276
16515
  return isCheckboxColumn(column) && !column.templateRef;
16277
16516
  }
16278
- trackByIndex(index) {
16279
- return index;
16280
- }
16281
16517
  addStickyStyles(column) {
16282
16518
  const stickyStyles = this.columnInfoService.stickyColumnsStyles(column);
16283
16519
  return { ...column.headerStyle, ...stickyStyles };
@@ -16416,7 +16652,7 @@ class HeaderComponent {
16416
16652
  *ngIf="detailTemplate?.templateRef"
16417
16653
  >
16418
16654
  </th>
16419
- <ng-container *ngFor="let column of columnsForLevel(levelIndex); trackBy: trackByIndex; let columnIndex = index; let last = last;">
16655
+ <ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
16420
16656
  <th *ngIf="!isColumnGroupComponent(column)"
16421
16657
  kendoGridLogicalCell
16422
16658
  [logicalRowIndex]="levelIndex"
@@ -16643,7 +16879,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
16643
16879
  *ngIf="detailTemplate?.templateRef"
16644
16880
  >
16645
16881
  </th>
16646
- <ng-container *ngFor="let column of columnsForLevel(levelIndex); trackBy: trackByIndex; let columnIndex = index; let last = last;">
16882
+ <ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
16647
16883
  <th *ngIf="!isColumnGroupComponent(column)"
16648
16884
  kendoGridLogicalCell
16649
16885
  [logicalRowIndex]="levelIndex"
@@ -19480,8 +19716,8 @@ const packageMetadata = {
19480
19716
  productName: 'Kendo UI for Angular',
19481
19717
  productCode: 'KENDOUIANGULAR',
19482
19718
  productCodes: ['KENDOUIANGULAR'],
19483
- publishDate: 1738337486,
19484
- version: '18.1.0-develop.8',
19719
+ publishDate: 1739287277,
19720
+ version: '18.1.0',
19485
19721
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
19486
19722
  };
19487
19723
 
@@ -21441,7 +21677,7 @@ class TableDirective {
21441
21677
  const constrainedModeNoShift = this.ctx.grid?.resizable === 'constrained' && !this.service.isShiftPressed;
21442
21678
  const unconstrainedModeShift = (this.ctx.grid?.resizable === true || this.ctx.grid?.resizable === 'unconstrained') && this.service.isShiftPressed;
21443
21679
  const isConstrainedMode = constrainedModeNoShift || unconstrainedModeShift;
21444
- if (isConstrainedMode) {
21680
+ if (isConstrainedMode && !this.service.autoFitResize) {
21445
21681
  this.renderer.setStyle(this.element.nativeElement, 'width', this.service.originalWidth + 'px');
21446
21682
  }
21447
21683
  else {
@@ -23470,6 +23706,11 @@ class GridComponent {
23470
23706
  * @default false
23471
23707
  */
23472
23708
  groupable = false;
23709
+ /**
23710
+ * Determines whether the Grid can be resized.
23711
+ * @default false
23712
+ */
23713
+ gridResizable = false;
23473
23714
  /**
23474
23715
  * Enables the [row reordering]({% slug reordering_rows_grid %}) of the Grid.
23475
23716
  * @default false
@@ -23807,6 +24048,21 @@ class GridComponent {
23807
24048
  get noScrollbarClass() {
23808
24049
  return this.scrollbarWidth === 0;
23809
24050
  }
24051
+ get isResizable() {
24052
+ return Boolean(this.gridResizable);
24053
+ }
24054
+ get minWidth() {
24055
+ return this.gridResizable.minWidth;
24056
+ }
24057
+ get maxWidth() {
24058
+ return this.gridResizable.maxWidth;
24059
+ }
24060
+ get minHeight() {
24061
+ return this.gridResizable.minHeight;
24062
+ }
24063
+ get maxHeight() {
24064
+ return this.gridResizable.maxHeight;
24065
+ }
23810
24066
  detailTemplateChildren;
23811
24067
  get detailTemplate() {
23812
24068
  if (this._customDetailTemplate) {
@@ -24766,16 +25022,19 @@ class GridComponent {
24766
25022
  }
24767
25023
  else if (column === source) {
24768
25024
  i += toSkip;
25025
+ column.isReordered = true;
24769
25026
  continue;
24770
25027
  }
24771
25028
  else {
24772
25029
  column.orderIndex = nextIndex;
24773
25030
  }
25031
+ column.isReordered = true;
24774
25032
  nextIndex++;
24775
25033
  i++;
24776
25034
  }
24777
25035
  for (i = sourceColumnIndex; i < sourceColumnIndex + toSkip; i++) {
24778
25036
  expandedColumns[i].orderIndex = nextSourceIndex++;
25037
+ expandedColumns[i].isReordered = true;
24779
25038
  }
24780
25039
  this.updateIndicesForLevel(source.level + 1);
24781
25040
  this.columnResizingService.areColumnsReordered = true;
@@ -24788,7 +25047,11 @@ class GridComponent {
24788
25047
  colsForLevel.push(...c.childrenArray.sort((a, b) => a.orderIndex - b.orderIndex));
24789
25048
  }
24790
25049
  });
24791
- expandColumnsWithSpan(colsForLevel).map((c, i) => c.orderIndex = i);
25050
+ expandColumnsWithSpan(colsForLevel).map((c, i) => {
25051
+ c.orderIndex = i;
25052
+ c.isReordered = true;
25053
+ return c;
25054
+ });
24792
25055
  if (level < this.columnList.totalColumnLevels()) {
24793
25056
  this.updateIndicesForLevel(level + 1);
24794
25057
  }
@@ -25106,8 +25369,8 @@ class GridComponent {
25106
25369
  .filter(item => isTruthy(item.column.resizable) && !item.column.isColumnGroup)
25107
25370
  .map(item => ({
25108
25371
  column: item.column,
25109
- newWidth: item.column.width,
25110
- oldWidth: item.oldWidth
25372
+ newWidth: roundDown(item.column.width),
25373
+ oldWidth: roundDown(item.oldWidth)
25111
25374
  }));
25112
25375
  this.columnResize.emit(args);
25113
25376
  }
@@ -25228,7 +25491,7 @@ class GridComponent {
25228
25491
  this.dropTargetContainer?.notify();
25229
25492
  }
25230
25493
  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: [
25494
+ 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
25495
  BrowserSupportService,
25233
25496
  LocalizationService,
25234
25497
  ColumnInfoService,
@@ -26685,6 +26948,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
26685
26948
  type: Input
26686
26949
  }], groupable: [{
26687
26950
  type: Input
26951
+ }], gridResizable: [{
26952
+ type: Input
26688
26953
  }], rowReorderable: [{
26689
26954
  type: Input
26690
26955
  }], navigable: [{
@@ -26791,6 +27056,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
26791
27056
  }], noScrollbarClass: [{
26792
27057
  type: HostBinding,
26793
27058
  args: ['class.k-grid-no-scrollbar']
27059
+ }], isResizable: [{
27060
+ type: HostBinding,
27061
+ args: ['class.k-grid-resizable']
27062
+ }], minWidth: [{
27063
+ type: HostBinding,
27064
+ args: ['style.minWidth']
27065
+ }], maxWidth: [{
27066
+ type: HostBinding,
27067
+ args: ['style.maxWidth']
27068
+ }], minHeight: [{
27069
+ type: HostBinding,
27070
+ args: ['style.minHeight']
27071
+ }], maxHeight: [{
27072
+ type: HostBinding,
27073
+ args: ['style.maxHeight']
26794
27074
  }], detailTemplateChildren: [{
26795
27075
  type: ContentChildren,
26796
27076
  args: [DetailTemplateDirective]