@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.
- package/column-resizing/column-handle.directive.d.ts +13 -0
- package/column-resizing/column-resizing.service.d.ts +5 -1
- package/columns/column-base.d.ts +12 -0
- package/columns/column.component.d.ts +3 -2
- package/common/resizable-settings.d.ts +25 -0
- package/esm2022/column-resizing/column-handle.directive.mjs +217 -36
- package/esm2022/column-resizing/column-resizing.service.mjs +16 -1
- package/esm2022/column-resizing/table.directive.mjs +1 -1
- package/esm2022/columns/column-base.mjs +12 -0
- package/esm2022/columns/column.component.mjs +4 -0
- package/esm2022/common/resizable-settings.mjs +8 -0
- package/esm2022/grid.component.mjs +49 -5
- package/esm2022/navigation/navigation.service.mjs +20 -3
- package/esm2022/package-metadata.mjs +2 -2
- package/esm2022/rendering/header/header.component.mjs +2 -5
- package/esm2022/utils.mjs +4 -0
- package/fesm2022/progress-kendo-angular-grid.mjs +326 -52
- package/grid.component.d.ts +12 -1
- package/index.d.ts +1 -0
- package/package.json +20 -20
- package/rendering/header/header.component.d.ts +0 -1
- package/schematics/ngAdd/index.js +4 -4
- package/utils.d.ts +4 -0
|
@@ -29,6 +29,10 @@ export declare class ColumnHandleDirective implements OnInit, OnDestroy {
|
|
|
29
29
|
private get isConstrainedMode();
|
|
30
30
|
private subscriptions;
|
|
31
31
|
private rtl;
|
|
32
|
+
private totalChildrenSum;
|
|
33
|
+
private childrenColumns;
|
|
34
|
+
private minWidthTotal;
|
|
35
|
+
private foundColumn;
|
|
32
36
|
autoFit(): void;
|
|
33
37
|
constructor(draggable: DraggableDirective, element: ElementRef, service: ColumnResizingService, zone: NgZone, cdr: ChangeDetectorRef, ctx: ContextService, columnInfoService: ColumnInfoService);
|
|
34
38
|
ngOnInit(): void;
|
|
@@ -39,9 +43,18 @@ export declare class ColumnHandleDirective implements OnInit, OnDestroy {
|
|
|
39
43
|
private resize;
|
|
40
44
|
private sizeToFit;
|
|
41
45
|
private updateWidth;
|
|
46
|
+
private updateWidthsOfResizedColumns;
|
|
47
|
+
private calcNewColumnWidth;
|
|
48
|
+
private setAdjacentColumn;
|
|
49
|
+
private firstGroupChild;
|
|
50
|
+
private setGroupWidths;
|
|
51
|
+
private updateWidthOfDraggedColumn;
|
|
52
|
+
private calcChildrenWidth;
|
|
42
53
|
private columnsForLevel;
|
|
54
|
+
private minAdjacentColumnWidth;
|
|
43
55
|
private getTableDelta;
|
|
44
56
|
private stopPropagation;
|
|
57
|
+
private isLastInGroup;
|
|
45
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<ColumnHandleDirective, [{ host: true; }, null, null, null, null, null, null]>;
|
|
46
59
|
static ɵdir: i0.ɵɵDirectiveDeclaration<ColumnHandleDirective, "[kendoGridColumnHandle]", never, { "isLast": { "alias": "isLast"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "column": { "alias": "column"; "required": false; }; }, {}, never, never, true, never>;
|
|
47
60
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { EventEmitter } from '@angular/core';
|
|
6
6
|
import { ColumnBase } from '../columns/column-base';
|
|
7
7
|
import { ColumnResizeAction, ColumnResizeArgs, AutoFitFn } from './column-resize.interface';
|
|
8
|
+
import { ColumnGroupComponent } from '../columns/column-group.component';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
10
|
/**
|
|
10
11
|
* @hidden
|
|
@@ -15,8 +16,10 @@ export declare class ColumnResizingService {
|
|
|
15
16
|
areColumnsReordered: boolean;
|
|
16
17
|
isShiftPressed: boolean;
|
|
17
18
|
originalWidth: number;
|
|
19
|
+
draggedGroupColumn: ColumnGroupComponent;
|
|
20
|
+
resizedColumns: Array<ColumnResizeArgs>;
|
|
21
|
+
autoFitResize: boolean;
|
|
18
22
|
private column;
|
|
19
|
-
private resizedColumns;
|
|
20
23
|
private tables;
|
|
21
24
|
private batch;
|
|
22
25
|
start(column: ColumnBase): void;
|
|
@@ -33,6 +36,7 @@ export declare class ColumnResizingService {
|
|
|
33
36
|
private trackColumns;
|
|
34
37
|
private autoFitStart;
|
|
35
38
|
private autoFitBatch;
|
|
39
|
+
private restoreInitialMaxMinWidths;
|
|
36
40
|
static ɵfac: i0.ɵɵFactoryDeclaration<ColumnResizingService, never>;
|
|
37
41
|
static ɵprov: i0.ɵɵInjectableDeclaration<ColumnResizingService>;
|
|
38
42
|
}
|
package/columns/column-base.d.ts
CHANGED
|
@@ -26,6 +26,18 @@ export declare const isRowReorderColumn: (column: any) => any;
|
|
|
26
26
|
*/
|
|
27
27
|
export declare class ColumnBase {
|
|
28
28
|
parent?: ColumnBase;
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
isReordered: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
initialMaxResizableWidth: number;
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
initialMinResizableWidth: number;
|
|
29
41
|
/**
|
|
30
42
|
* @hidden
|
|
31
43
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { TemplateRef } from '@angular/core';
|
|
5
|
+
import { TemplateRef, AfterViewInit } from '@angular/core';
|
|
6
6
|
import { CellTemplateDirective } from '../rendering/cell-template.directive';
|
|
7
7
|
import { GroupHeaderTemplateDirective } from '../grouping/group-header-template.directive';
|
|
8
8
|
import { GroupHeaderColumnTemplateDirective } from '../grouping/group-header-column-template.directive';
|
|
@@ -30,7 +30,7 @@ export declare function isColumnComponent(column: any): column is ColumnComponen
|
|
|
30
30
|
* </kendo-grid>
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export declare class ColumnComponent extends ColumnBase {
|
|
33
|
+
export declare class ColumnComponent extends ColumnBase implements AfterViewInit {
|
|
34
34
|
/**
|
|
35
35
|
* The field to which the column is bound.
|
|
36
36
|
*/
|
|
@@ -94,6 +94,7 @@ export declare class ColumnComponent extends ColumnBase {
|
|
|
94
94
|
get filterCellTemplateRef(): TemplateRef<any>;
|
|
95
95
|
get filterMenuTemplateRef(): TemplateRef<any>;
|
|
96
96
|
get displayTitle(): string;
|
|
97
|
+
ngAfterViewInit(): void;
|
|
97
98
|
static ɵfac: i0.ɵɵFactoryDeclaration<ColumnComponent, [{ optional: true; host: true; skipSelf: true; }, { optional: true; }]>;
|
|
98
99
|
static ɵcmp: i0.ɵɵComponentDeclaration<ColumnComponent, "kendo-grid-column", never, { "field": { "alias": "field"; "required": false; }; "format": { "alias": "format"; "required": false; }; "sortable": { "alias": "sortable"; "required": false; }; "groupable": { "alias": "groupable"; "required": false; }; "editor": { "alias": "editor"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "filterable": { "alias": "filterable"; "required": false; }; "editable": { "alias": "editable"; "required": false; }; }, {}, ["template", "groupHeaderTemplate", "groupHeaderColumnTemplate", "groupFooterTemplate", "editTemplate", "filterCellTemplate", "filterMenuTemplate"], never, true, never>;
|
|
99
100
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* The size restrictions that will be applied to the resizable Grid.
|
|
7
|
+
*/
|
|
8
|
+
export interface GridResizableSettings {
|
|
9
|
+
/**
|
|
10
|
+
* Specifies the maximum width of the resizable Grid. Accepts all applicable string values for [`max-width`](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width).
|
|
11
|
+
*/
|
|
12
|
+
maxWidth?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specifies the maximum height of the resizable Grid. Accepts all applicable string values for [`max-height`](https://developer.mozilla.org/en-US/docs/Web/CSS/max-height).
|
|
15
|
+
*/
|
|
16
|
+
maxHeight?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Specifies the minimum width of the resizable Grid. Accepts all applicable string values for [`min-width`](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width).
|
|
19
|
+
*/
|
|
20
|
+
minWidth?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies the minimum height of the resizable Grid. Accepts all applicable string values for [`min-height`](https://developer.mozilla.org/en-US/docs/Web/CSS/min-height).
|
|
23
|
+
*/
|
|
24
|
+
minHeight?: string;
|
|
25
|
+
}
|
|
@@ -31,11 +31,20 @@ const toPercentage = (value, whole) => (value / whole) * 100;
|
|
|
31
31
|
/**
|
|
32
32
|
* @hidden
|
|
33
33
|
*/
|
|
34
|
-
const headerWidth = (handle) => handle.nativeElement.parentElement.
|
|
34
|
+
const headerWidth = (handle) => handle.nativeElement.parentElement.getBoundingClientRect().width;
|
|
35
35
|
/**
|
|
36
36
|
* @hidden
|
|
37
37
|
*/
|
|
38
|
-
const adjacentColumnWidth = (handle) => handle.nativeElement.parentElement.nextElementSibling?.
|
|
38
|
+
const adjacentColumnWidth = (handle) => handle.nativeElement.parentElement.nextElementSibling?.getBoundingClientRect().width;
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
const adjacentColumnInGroupWidth = (handle, rowIndex, colIndex) => {
|
|
43
|
+
const tableElement = handle.nativeElement.closest('.k-grid-header-table');
|
|
44
|
+
const selector = (rowAttribute) => `tr[${rowAttribute}="${rowIndex}"] th[aria-colindex="${colIndex}"]`;
|
|
45
|
+
const thElement = tableElement.querySelector([selector('aria-rowindex'), selector('data-kendo-grid-row-index')]);
|
|
46
|
+
return thElement.getBoundingClientRect().width;
|
|
47
|
+
};
|
|
39
48
|
/**
|
|
40
49
|
* @hidden
|
|
41
50
|
*/
|
|
@@ -95,7 +104,7 @@ export class ColumnHandleDirective {
|
|
|
95
104
|
columns = [];
|
|
96
105
|
column;
|
|
97
106
|
get visible() {
|
|
98
|
-
if (this.isConstrainedMode && this.isLast) {
|
|
107
|
+
if (this.isConstrainedMode && (this.isLast || this.isLastInGroup(this.column))) {
|
|
99
108
|
return 'none';
|
|
100
109
|
}
|
|
101
110
|
return this.column.resizable ? 'block' : 'none';
|
|
@@ -115,7 +124,12 @@ export class ColumnHandleDirective {
|
|
|
115
124
|
}
|
|
116
125
|
subscriptions = new Subscription();
|
|
117
126
|
rtl = false;
|
|
127
|
+
totalChildrenSum = 0;
|
|
128
|
+
childrenColumns = [];
|
|
129
|
+
minWidthTotal = 0;
|
|
130
|
+
foundColumn;
|
|
118
131
|
autoFit() {
|
|
132
|
+
this.service.autoFitResize = true;
|
|
119
133
|
const allLeafs = allLeafColumns(this.columns);
|
|
120
134
|
const currentLeafs = leafColumns([this.column]).filter(column => isTruthy(column.resizable));
|
|
121
135
|
const columnInfo = currentLeafs.map(column => {
|
|
@@ -173,35 +187,19 @@ export class ColumnHandleDirective {
|
|
|
173
187
|
}
|
|
174
188
|
shouldUpdate() {
|
|
175
189
|
return !allLeafColumns(this.columns)
|
|
176
|
-
.map(column => column.width)
|
|
190
|
+
.map(column => column.width || (this.isConstrainedMode && !column.width && column.implicitWidth))
|
|
177
191
|
.some(isBlank);
|
|
178
192
|
}
|
|
179
193
|
initColumnWidth() {
|
|
180
194
|
this.column.width = headerWidth(this.element);
|
|
195
|
+
if (this.isConstrainedMode) {
|
|
196
|
+
this.column.resizeStartWidth = this.column.width;
|
|
197
|
+
}
|
|
181
198
|
}
|
|
182
199
|
initState() {
|
|
183
200
|
this.column.resizeStartWidth = headerWidth(this.element);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
columns = Array.from(this.ctx.grid?.columns) || [];
|
|
187
|
-
}
|
|
188
|
-
if (this.isConstrainedMode) {
|
|
189
|
-
if (this.service.areColumnsReordered) {
|
|
190
|
-
this.service.adjacentColumn = columns.find(c => c.orderIndex === this.column.orderIndex + 1);
|
|
191
|
-
this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
|
|
192
|
-
this.service.resizedColumn({
|
|
193
|
-
column: this.service.adjacentColumn,
|
|
194
|
-
oldWidth: this.service.adjacentColumn.resizeStartWidth
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
this.service.adjacentColumn = columns[this.column.leafIndex + 1];
|
|
199
|
-
this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
|
|
200
|
-
this.service.resizedColumn({
|
|
201
|
-
column: this.service.adjacentColumn,
|
|
202
|
-
oldWidth: this.service.adjacentColumn.resizeStartWidth
|
|
203
|
-
});
|
|
204
|
-
}
|
|
201
|
+
if (this.isConstrainedMode && !this.service.adjacentColumn) {
|
|
202
|
+
this.setAdjacentColumn();
|
|
205
203
|
}
|
|
206
204
|
this.service.resizedColumn({
|
|
207
205
|
column: this.column,
|
|
@@ -218,12 +216,7 @@ export class ColumnHandleDirective {
|
|
|
218
216
|
newWidth = Math.min(newWidth, this.column.maxResizableWidth);
|
|
219
217
|
}
|
|
220
218
|
if (this.isConstrainedMode) {
|
|
221
|
-
|
|
222
|
-
newWidth = Math.min(newWidth, maxAllowedResizableWidth);
|
|
223
|
-
}
|
|
224
|
-
if (this.isConstrainedMode && isPresent(this.service.adjacentColumn.maxResizableWidth)) {
|
|
225
|
-
const maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.maxResizableWidth;
|
|
226
|
-
newWidth = Math.max(newWidth, maxAllowedResizableWidth);
|
|
219
|
+
newWidth = this.calcNewColumnWidth(newWidth);
|
|
227
220
|
}
|
|
228
221
|
const tableDelta = this.getTableDelta(newWidth, delta);
|
|
229
222
|
this.updateWidth(this.column, newWidth);
|
|
@@ -237,11 +230,8 @@ export class ColumnHandleDirective {
|
|
|
237
230
|
this.service.resizeTable(this.column, tableDelta);
|
|
238
231
|
}
|
|
239
232
|
updateWidth(column, width) {
|
|
240
|
-
if (this.isConstrainedMode && this.service.adjacentColumn) {
|
|
241
|
-
|
|
242
|
-
if (adjacentColumnNewWidth < (column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth)) {
|
|
243
|
-
this.service.adjacentColumn.width = adjacentColumnNewWidth;
|
|
244
|
-
}
|
|
233
|
+
if (this.isConstrainedMode && this.service.adjacentColumn && !this.service.autoFitResize) {
|
|
234
|
+
this.updateWidthsOfResizedColumns(column, width);
|
|
245
235
|
}
|
|
246
236
|
column.width = width;
|
|
247
237
|
this.columnInfoService.hiddenColumns.forEach((col) => {
|
|
@@ -253,9 +243,188 @@ export class ColumnHandleDirective {
|
|
|
253
243
|
});
|
|
254
244
|
this.cdr.markForCheck(); //force CD cycle
|
|
255
245
|
}
|
|
246
|
+
updateWidthsOfResizedColumns(column, width) {
|
|
247
|
+
let adjacentColumnNewWidth = column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - width;
|
|
248
|
+
if (this.service.draggedGroupColumn && column.parent) {
|
|
249
|
+
this.updateWidthOfDraggedColumn(column, width);
|
|
250
|
+
this.setGroupWidths(this.service.draggedGroupColumn);
|
|
251
|
+
}
|
|
252
|
+
else if (!this.service.draggedGroupColumn && !column.parent && this.service.adjacentColumn.parent) {
|
|
253
|
+
this.service.adjacentColumn.parent.width = column.width + this.service.adjacentColumn.parent.width - width;
|
|
254
|
+
this.service.adjacentColumn.width = adjacentColumnNewWidth;
|
|
255
|
+
}
|
|
256
|
+
else if (!this.service.draggedGroupColumn && column.parent && this.service.adjacentColumn.parent) {
|
|
257
|
+
adjacentColumnNewWidth = column.width + this.service.adjacentColumn.width - width;
|
|
258
|
+
this.service.adjacentColumn.width = adjacentColumnNewWidth;
|
|
259
|
+
const filteredColumns = this.service.adjacentColumn.parent.children.filter(c => c !== this.service.adjacentColumn);
|
|
260
|
+
const filteredColumnsWidth = filteredColumns.reduce((acc, c) => acc + c.width, 0);
|
|
261
|
+
this.service.adjacentColumn.parent.width = adjacentColumnNewWidth + filteredColumnsWidth;
|
|
262
|
+
this.setGroupWidths(this.service.adjacentColumn.parent);
|
|
263
|
+
}
|
|
264
|
+
else if (adjacentColumnNewWidth > this.service.adjacentColumn.minResizableWidth) {
|
|
265
|
+
this.service.adjacentColumn.width = adjacentColumnNewWidth;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
calcNewColumnWidth(newWidth) {
|
|
269
|
+
let maxAllowedResizableWidth;
|
|
270
|
+
if (!this.service.adjacentColumn.parent) {
|
|
271
|
+
maxAllowedResizableWidth = this.column.width + this.service.adjacentColumn.width - this.service.adjacentColumn.minResizableWidth;
|
|
272
|
+
if (!this.column.parent) {
|
|
273
|
+
maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.minResizableWidth;
|
|
274
|
+
if (this.service.adjacentColumn.maxResizableWidth) {
|
|
275
|
+
const minResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.maxResizableWidth;
|
|
276
|
+
maxAllowedResizableWidth = this.column.resizeStartWidth + this.service.adjacentColumn.resizeStartWidth - this.service.adjacentColumn.minResizableWidth;
|
|
277
|
+
this.column.minResizableWidth = minResizableWidth;
|
|
278
|
+
this.column.maxResizableWidth = maxAllowedResizableWidth;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
maxAllowedResizableWidth = this.column.width + this.service.adjacentColumn.width;
|
|
284
|
+
newWidth = Math.min(newWidth, maxAllowedResizableWidth);
|
|
285
|
+
this.minWidthTotal = 0;
|
|
286
|
+
const minResizableWidth = this.minAdjacentColumnWidth(this.service.adjacentColumn);
|
|
287
|
+
maxAllowedResizableWidth -= minResizableWidth;
|
|
288
|
+
}
|
|
289
|
+
return Math.min(newWidth, maxAllowedResizableWidth - 1);
|
|
290
|
+
}
|
|
291
|
+
setAdjacentColumn() {
|
|
292
|
+
const columnsForLevel = this.columnsForLevel(this.column.level);
|
|
293
|
+
if (this.column.parent) {
|
|
294
|
+
if (this.column.isReordered) {
|
|
295
|
+
this.service.adjacentColumn = columnsForLevel.find(c => c.orderIndex === this.column.orderIndex + 1);
|
|
296
|
+
this.service.adjacentColumn.resizeStartWidth = this.service.adjacentColumn.width;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
const columnIndex = columnsForLevel.indexOf(this.column);
|
|
300
|
+
this.service.adjacentColumn = columnsForLevel[columnIndex + 1];
|
|
301
|
+
this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
|
|
302
|
+
const parentColumnChildren = Array.from(this.column.parent.children);
|
|
303
|
+
const indexOfCurrentColumn = parentColumnChildren.indexOf(this.column);
|
|
304
|
+
let adjacentColumn;
|
|
305
|
+
if (indexOfCurrentColumn + 1 <= parentColumnChildren.length - 1) {
|
|
306
|
+
adjacentColumn = parentColumnChildren[indexOfCurrentColumn + 1];
|
|
307
|
+
if (adjacentColumn?.isColumnGroup) {
|
|
308
|
+
this.service.adjacentColumn = adjacentColumn;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (this.service.adjacentColumn.isColumnGroup) {
|
|
313
|
+
this.foundColumn = null;
|
|
314
|
+
this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
|
|
315
|
+
}
|
|
316
|
+
if (this.column.isColumnGroup) {
|
|
317
|
+
this.service.draggedGroupColumn = this.column;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
else if (this.column.isColumnGroup) {
|
|
321
|
+
if (this.column.isReordered) {
|
|
322
|
+
this.service.adjacentColumn = columnsForLevel.find(c => c.orderIndex === this.column.orderIndex + 1);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
this.service.adjacentColumn = columnsForLevel[columnsForLevel.indexOf(this.column) + 1];
|
|
326
|
+
}
|
|
327
|
+
this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
|
|
328
|
+
if (this.service.adjacentColumn.isColumnGroup) {
|
|
329
|
+
this.foundColumn = null;
|
|
330
|
+
this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
|
|
331
|
+
}
|
|
332
|
+
this.service.adjacentColumn.resizeStartWidth = this.service.adjacentColumn.width;
|
|
333
|
+
this.service.draggedGroupColumn = this.column;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
if (this.column.isReordered) {
|
|
337
|
+
this.service.adjacentColumn = columnsForLevel.find(col => col.orderIndex === this.column.orderIndex + 1);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
let adjacentColumn = columnsForLevel.find(c => c.leafIndex === this.column.leafIndex + 1);
|
|
341
|
+
if (!adjacentColumn) {
|
|
342
|
+
const indexOfCurrentColumn = columnsForLevel.indexOf(this.column);
|
|
343
|
+
adjacentColumn = columnsForLevel[indexOfCurrentColumn + 1];
|
|
344
|
+
}
|
|
345
|
+
this.service.adjacentColumn = adjacentColumn;
|
|
346
|
+
}
|
|
347
|
+
if (!this.service.adjacentColumn.parent) {
|
|
348
|
+
this.service.adjacentColumn.resizeStartWidth = adjacentColumnWidth(this.element);
|
|
349
|
+
}
|
|
350
|
+
if (this.service.adjacentColumn.isColumnGroup) {
|
|
351
|
+
this.foundColumn = null;
|
|
352
|
+
this.service.adjacentColumn = this.firstGroupChild(this.service.adjacentColumn);
|
|
353
|
+
const rowIndex = this.service.adjacentColumn.level + 1;
|
|
354
|
+
const colIndex = this.service.adjacentColumn.leafIndex + 1;
|
|
355
|
+
this.service.adjacentColumn.resizeStartWidth = adjacentColumnInGroupWidth(this.element, rowIndex, colIndex);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
this.service.resizedColumn({
|
|
359
|
+
column: this.service.adjacentColumn,
|
|
360
|
+
oldWidth: this.service.adjacentColumn.resizeStartWidth
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
firstGroupChild(column) {
|
|
364
|
+
Array.from(column.children).sort((a, b) => a.orderIndex - b.orderIndex).forEach((c, idx) => {
|
|
365
|
+
if (idx === 0 && !c.isColumnGroup) {
|
|
366
|
+
if (!this.foundColumn) {
|
|
367
|
+
this.foundColumn = c;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else if (c.isColumnGroup) {
|
|
371
|
+
this.firstGroupChild(c);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
return this.foundColumn;
|
|
375
|
+
}
|
|
376
|
+
setGroupWidths(column) {
|
|
377
|
+
const childrenWidths = column.children.reduce((acc, c) => acc + c.width, 0);
|
|
378
|
+
column.width = childrenWidths;
|
|
379
|
+
column.children.forEach(c => {
|
|
380
|
+
if (c.isColumnGroup) {
|
|
381
|
+
this.setGroupWidths(c);
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
updateWidthOfDraggedColumn(column, width) {
|
|
386
|
+
this.totalChildrenSum = 0;
|
|
387
|
+
this.childrenColumns = [];
|
|
388
|
+
this.calcChildrenWidth(this.service.draggedGroupColumn);
|
|
389
|
+
const childrenWidthNotIncludingColumn = this.childrenColumns.reduce((acc, col) => {
|
|
390
|
+
return col !== column ? acc + col.width : acc;
|
|
391
|
+
}, 0);
|
|
392
|
+
this.service.draggedGroupColumn.width = childrenWidthNotIncludingColumn + width;
|
|
393
|
+
if (this.service.adjacentColumn.minResizableWidth <= this.totalChildrenSum + this.service.adjacentColumn.resizeStartWidth - width - childrenWidthNotIncludingColumn) {
|
|
394
|
+
this.service.adjacentColumn.width = this.totalChildrenSum + this.service.adjacentColumn.resizeStartWidth - width - childrenWidthNotIncludingColumn;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
calcChildrenWidth(column) {
|
|
398
|
+
const columnChildren = Array.from(column.children);
|
|
399
|
+
const childrenNoGroups = columnChildren.filter(c => !c.isColumnGroup);
|
|
400
|
+
const childrenGroups = columnChildren.filter(c => c.isColumnGroup);
|
|
401
|
+
childrenNoGroups.forEach(col => {
|
|
402
|
+
if (this.childrenColumns.indexOf(col) === -1) {
|
|
403
|
+
this.childrenColumns.push(col);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
this.totalChildrenSum += childrenNoGroups.reduce((acc, col) => acc + col.resizeStartWidth, 0);
|
|
407
|
+
childrenGroups.forEach((col) => {
|
|
408
|
+
this.calcChildrenWidth(col);
|
|
409
|
+
});
|
|
410
|
+
}
|
|
256
411
|
columnsForLevel(level) {
|
|
257
412
|
return columnsToRender(this.columns ? this.columns.filter(column => column.level === level) : []);
|
|
258
413
|
}
|
|
414
|
+
minAdjacentColumnWidth(column) {
|
|
415
|
+
if (column.isColumnGroup) {
|
|
416
|
+
Array.from(column.children).forEach(c => {
|
|
417
|
+
this.minAdjacentColumnWidth(c);
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
this.minWidthTotal += column.minResizableWidth;
|
|
422
|
+
if (column.width < column.minResizableWidth) {
|
|
423
|
+
column.width = column.minResizableWidth;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return this.minWidthTotal;
|
|
427
|
+
}
|
|
259
428
|
getTableDelta(newWidth, delta) {
|
|
260
429
|
const minWidth = this.column.minResizableWidth;
|
|
261
430
|
const maxWidth = this.column.maxResizableWidth;
|
|
@@ -280,6 +449,18 @@ export class ColumnHandleDirective {
|
|
|
280
449
|
event.stopPropagation();
|
|
281
450
|
event.preventDefault();
|
|
282
451
|
};
|
|
452
|
+
isLastInGroup(column) {
|
|
453
|
+
if (column.parent) {
|
|
454
|
+
const groupChildren = Array.from(column.parent.children);
|
|
455
|
+
const indexOfCurrentColumn = groupChildren.indexOf(column);
|
|
456
|
+
if (column.isReordered || column.orderIndex > 0 || (column.isReordered && column.orderIndex === 0)) {
|
|
457
|
+
return (column.orderIndex - groupChildren[0].orderIndex) === groupChildren.length - 1;
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
return indexOfCurrentColumn === groupChildren.length - 1;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
283
464
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnHandleDirective, deps: [{ token: i1.DraggableDirective, host: true }, { token: i0.ElementRef }, { token: i2.ColumnResizingService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i3.ContextService }, { token: i4.ColumnInfoService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
284
465
|
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 });
|
|
285
466
|
}
|
|
@@ -27,8 +27,10 @@ export class ColumnResizingService {
|
|
|
27
27
|
areColumnsReordered = false;
|
|
28
28
|
isShiftPressed = false;
|
|
29
29
|
originalWidth;
|
|
30
|
-
|
|
30
|
+
draggedGroupColumn;
|
|
31
31
|
resizedColumns;
|
|
32
|
+
autoFitResize = false;
|
|
33
|
+
column;
|
|
32
34
|
tables = [];
|
|
33
35
|
batch = null;
|
|
34
36
|
start(column) {
|
|
@@ -64,7 +66,10 @@ export class ColumnResizingService {
|
|
|
64
66
|
resizedColumns: this.resizedColumns,
|
|
65
67
|
type: 'end'
|
|
66
68
|
});
|
|
69
|
+
this.restoreInitialMaxMinWidths();
|
|
67
70
|
this.adjacentColumn = null;
|
|
71
|
+
this.draggedGroupColumn = null;
|
|
72
|
+
this.autoFitResize = false;
|
|
68
73
|
}
|
|
69
74
|
registerTable(tableMetadata) {
|
|
70
75
|
this.tables.push(tableMetadata);
|
|
@@ -137,6 +142,16 @@ export class ColumnResizingService {
|
|
|
137
142
|
});
|
|
138
143
|
this.batch = null;
|
|
139
144
|
}
|
|
145
|
+
restoreInitialMaxMinWidths() {
|
|
146
|
+
if (this.adjacentColumn) {
|
|
147
|
+
this.adjacentColumn.maxResizableWidth = this.adjacentColumn.initialMaxResizableWidth;
|
|
148
|
+
this.adjacentColumn.minResizableWidth = this.adjacentColumn.initialMinResizableWidth;
|
|
149
|
+
}
|
|
150
|
+
if (this.column) {
|
|
151
|
+
this.column.maxResizableWidth = this.column.initialMaxResizableWidth;
|
|
152
|
+
this.column.minResizableWidth = this.column.initialMinResizableWidth;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
140
155
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnResizingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
141
156
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnResizingService });
|
|
142
157
|
}
|
|
@@ -91,7 +91,7 @@ export class TableDirective {
|
|
|
91
91
|
const constrainedModeNoShift = this.ctx.grid?.resizable === 'constrained' && !this.service.isShiftPressed;
|
|
92
92
|
const unconstrainedModeShift = (this.ctx.grid?.resizable === true || this.ctx.grid?.resizable === 'unconstrained') && this.service.isShiftPressed;
|
|
93
93
|
const isConstrainedMode = constrainedModeNoShift || unconstrainedModeShift;
|
|
94
|
-
if (isConstrainedMode) {
|
|
94
|
+
if (isConstrainedMode && !this.service.autoFitResize) {
|
|
95
95
|
this.renderer.setStyle(this.element.nativeElement, 'width', this.service.originalWidth + 'px');
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
@@ -28,6 +28,18 @@ const isColumnContainer = column => column.isColumnGroup || isSpanColumn(column)
|
|
|
28
28
|
*/
|
|
29
29
|
export class ColumnBase {
|
|
30
30
|
parent;
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
isReordered;
|
|
35
|
+
/**
|
|
36
|
+
* @hidden
|
|
37
|
+
*/
|
|
38
|
+
initialMaxResizableWidth;
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
initialMinResizableWidth;
|
|
31
43
|
/**
|
|
32
44
|
* @hidden
|
|
33
45
|
*/
|
|
@@ -116,6 +116,10 @@ export class ColumnComponent extends ColumnBase {
|
|
|
116
116
|
get displayTitle() {
|
|
117
117
|
return this.title === undefined ? this.field : this.title;
|
|
118
118
|
}
|
|
119
|
+
ngAfterViewInit() {
|
|
120
|
+
this.initialMaxResizableWidth = this.maxResizableWidth;
|
|
121
|
+
this.initialMinResizableWidth = this.minResizableWidth;
|
|
122
|
+
}
|
|
119
123
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnComponent, deps: [{ token: i1.ColumnBase, host: true, optional: true, skipSelf: true }, { token: i2.IdService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
120
124
|
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: [
|
|
121
125
|
{
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* The size restrictions that will be applied to the resizable Grid.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|