@progress/kendo-angular-grid 18.1.0-develop.10 → 18.1.0-develop.12
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/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/grid.component.mjs +11 -4
- 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 +288 -51
- package/package.json +19 -19
- 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
|
}
|
|
@@ -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
|
{
|
|
@@ -14,7 +14,7 @@ import { isSpanColumnComponent } from './columns/span-column.component';
|
|
|
14
14
|
import { isColumnGroupComponent, ColumnGroupComponent } from './columns/column-group.component';
|
|
15
15
|
import { DetailTemplateDirective } from './rendering/details/detail-template.directive';
|
|
16
16
|
import { normalize } from './common/pager-settings';
|
|
17
|
-
import { isArray, anyChanged, isChanged, isPresent, isUniversal, observe, isTruthy, createPromise, hasObservers } from './utils';
|
|
17
|
+
import { isArray, anyChanged, isChanged, isPresent, isUniversal, observe, isTruthy, createPromise, hasObservers, roundDown } from './utils';
|
|
18
18
|
import { BrowserSupportService } from './layout/browser-support.service';
|
|
19
19
|
import { DataResultIterator, DataCollection } from './data/data.collection';
|
|
20
20
|
import { SelectionService } from './selection/selection.service';
|
|
@@ -1707,16 +1707,19 @@ export class GridComponent {
|
|
|
1707
1707
|
}
|
|
1708
1708
|
else if (column === source) {
|
|
1709
1709
|
i += toSkip;
|
|
1710
|
+
column.isReordered = true;
|
|
1710
1711
|
continue;
|
|
1711
1712
|
}
|
|
1712
1713
|
else {
|
|
1713
1714
|
column.orderIndex = nextIndex;
|
|
1714
1715
|
}
|
|
1716
|
+
column.isReordered = true;
|
|
1715
1717
|
nextIndex++;
|
|
1716
1718
|
i++;
|
|
1717
1719
|
}
|
|
1718
1720
|
for (i = sourceColumnIndex; i < sourceColumnIndex + toSkip; i++) {
|
|
1719
1721
|
expandedColumns[i].orderIndex = nextSourceIndex++;
|
|
1722
|
+
expandedColumns[i].isReordered = true;
|
|
1720
1723
|
}
|
|
1721
1724
|
this.updateIndicesForLevel(source.level + 1);
|
|
1722
1725
|
this.columnResizingService.areColumnsReordered = true;
|
|
@@ -1729,7 +1732,11 @@ export class GridComponent {
|
|
|
1729
1732
|
colsForLevel.push(...c.childrenArray.sort((a, b) => a.orderIndex - b.orderIndex));
|
|
1730
1733
|
}
|
|
1731
1734
|
});
|
|
1732
|
-
expandColumnsWithSpan(colsForLevel).map((c, i) =>
|
|
1735
|
+
expandColumnsWithSpan(colsForLevel).map((c, i) => {
|
|
1736
|
+
c.orderIndex = i;
|
|
1737
|
+
c.isReordered = true;
|
|
1738
|
+
return c;
|
|
1739
|
+
});
|
|
1733
1740
|
if (level < this.columnList.totalColumnLevels()) {
|
|
1734
1741
|
this.updateIndicesForLevel(level + 1);
|
|
1735
1742
|
}
|
|
@@ -2047,8 +2054,8 @@ export class GridComponent {
|
|
|
2047
2054
|
.filter(item => isTruthy(item.column.resizable) && !item.column.isColumnGroup)
|
|
2048
2055
|
.map(item => ({
|
|
2049
2056
|
column: item.column,
|
|
2050
|
-
newWidth: item.column.width,
|
|
2051
|
-
oldWidth: item.oldWidth
|
|
2057
|
+
newWidth: roundDown(item.column.width),
|
|
2058
|
+
oldWidth: roundDown(item.oldWidth)
|
|
2052
2059
|
}));
|
|
2053
2060
|
this.columnResize.emit(args);
|
|
2054
2061
|
}
|
|
@@ -135,7 +135,25 @@ export class NavigationService {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
get isColumnResizable() {
|
|
138
|
-
|
|
138
|
+
const allColumns = Array.from(this.ctx.grid.columnsContainer.allColumns);
|
|
139
|
+
const column = allColumns.find((col) => col.level === this.activeCell.rowIndex && col.leafIndex === this.activeCell.colIndex);
|
|
140
|
+
if (!column.parent) {
|
|
141
|
+
if (column.isColumnGroup) {
|
|
142
|
+
return this.activeCell.colIndex + this.activeCell.colSpan !== this.ctx.grid.columnsContainer.leafColumnsToRender.length;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return this.activeCell.colIndex !== this.ctx.grid.columnsContainer.leafColumnsToRender.length - 1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const columnGroup = column.parent;
|
|
150
|
+
const columnGroupChildren = Array.from(columnGroup.children).sort((a, b) => a.orderIndex - b.orderIndex);
|
|
151
|
+
const columnIndexInsideGroup = columnGroupChildren.indexOf(column);
|
|
152
|
+
if (column.isReordered || column.orderIndex > 0 || (column.isReordered && column.orderIndex === 0)) {
|
|
153
|
+
return (column.orderIndex - columnGroupChildren[0]['orderIndex']) !== columnGroupChildren.length - 1;
|
|
154
|
+
}
|
|
155
|
+
return columnIndexInsideGroup !== columnGroupChildren.length - 1;
|
|
156
|
+
}
|
|
139
157
|
}
|
|
140
158
|
viewport;
|
|
141
159
|
columnViewport;
|
|
@@ -577,8 +595,7 @@ export class NavigationService {
|
|
|
577
595
|
}
|
|
578
596
|
}
|
|
579
597
|
columnResize(onRightArrow) {
|
|
580
|
-
const column = this.ctx.grid.columnsContainer.
|
|
581
|
-
column.resizeStartWidth = Array.from(this.ctx.grid.wrapper.nativeElement.querySelectorAll('.k-grid-header th.k-header'))[this.activeCell.colIndex]['offsetWidth'];
|
|
598
|
+
const column = this.ctx.grid.columnsContainer.allColumns.find((col) => col.level === this.activeCell.rowIndex && col.leafIndex === this.activeCell.colIndex);
|
|
582
599
|
this.resizeService.start(column);
|
|
583
600
|
this.resizeService.resizeColumns(onRightArrow ? resizeStep : -1 * resizeStep);
|
|
584
601
|
if (this.resizeService.resizeColumns.length > 0) {
|
|
@@ -10,7 +10,7 @@ export const packageMetadata = {
|
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCode: 'KENDOUIANGULAR',
|
|
12
12
|
productCodes: ['KENDOUIANGULAR'],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: '18.1.0-develop.
|
|
13
|
+
publishDate: 1738675585,
|
|
14
|
+
version: '18.1.0-develop.12',
|
|
15
15
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
16
16
|
};
|
|
@@ -368,9 +368,6 @@ export class HeaderComponent {
|
|
|
368
368
|
isCheckboxColumn(column) {
|
|
369
369
|
return isCheckboxColumn(column) && !column.templateRef;
|
|
370
370
|
}
|
|
371
|
-
trackByIndex(index) {
|
|
372
|
-
return index;
|
|
373
|
-
}
|
|
374
371
|
addStickyStyles(column) {
|
|
375
372
|
const stickyStyles = this.columnInfoService.stickyColumnsStyles(column);
|
|
376
373
|
return { ...column.headerStyle, ...stickyStyles };
|
|
@@ -509,7 +506,7 @@ export class HeaderComponent {
|
|
|
509
506
|
*ngIf="detailTemplate?.templateRef"
|
|
510
507
|
>
|
|
511
508
|
</th>
|
|
512
|
-
<ng-container *ngFor="let column of columnsForLevel(levelIndex);
|
|
509
|
+
<ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
|
|
513
510
|
<th *ngIf="!isColumnGroupComponent(column)"
|
|
514
511
|
kendoGridLogicalCell
|
|
515
512
|
[logicalRowIndex]="levelIndex"
|
|
@@ -736,7 +733,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
736
733
|
*ngIf="detailTemplate?.templateRef"
|
|
737
734
|
>
|
|
738
735
|
</th>
|
|
739
|
-
<ng-container *ngFor="let column of columnsForLevel(levelIndex);
|
|
736
|
+
<ng-container *ngFor="let column of columnsForLevel(levelIndex); let columnIndex = index; let last = last;">
|
|
740
737
|
<th *ngIf="!isColumnGroupComponent(column)"
|
|
741
738
|
kendoGridLogicalCell
|
|
742
739
|
[logicalRowIndex]="levelIndex"
|
package/esm2022/utils.mjs
CHANGED
|
@@ -139,3 +139,7 @@ export const recursiveFlatMap = (item) => isGroupResult(item) ? item.items.flatM
|
|
|
139
139
|
export const isGroupResult = (obj) => {
|
|
140
140
|
return 'aggregates' in obj && 'items' in obj && 'field' in obj && 'value' in obj;
|
|
141
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* @hidden
|
|
144
|
+
*/
|
|
145
|
+
export const roundDown = (value) => Math.floor(value * 100) / 100;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
14661
|
+
const headerWidth = (handle) => handle.nativeElement.parentElement.getBoundingClientRect().width;
|
|
14610
14662
|
/**
|
|
14611
14663
|
* @hidden
|
|
14612
14664
|
*/
|
|
14613
|
-
const adjacentColumnWidth = (handle) => handle.nativeElement.parentElement.nextElementSibling?.
|
|
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
|
-
|
|
14760
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);
|
|
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);
|
|
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:
|
|
19484
|
-
version: '18.1.0-develop.
|
|
19713
|
+
publishDate: 1738675585,
|
|
19714
|
+
version: '18.1.0-develop.12',
|
|
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 {
|
|
@@ -24766,16 +24996,19 @@ class GridComponent {
|
|
|
24766
24996
|
}
|
|
24767
24997
|
else if (column === source) {
|
|
24768
24998
|
i += toSkip;
|
|
24999
|
+
column.isReordered = true;
|
|
24769
25000
|
continue;
|
|
24770
25001
|
}
|
|
24771
25002
|
else {
|
|
24772
25003
|
column.orderIndex = nextIndex;
|
|
24773
25004
|
}
|
|
25005
|
+
column.isReordered = true;
|
|
24774
25006
|
nextIndex++;
|
|
24775
25007
|
i++;
|
|
24776
25008
|
}
|
|
24777
25009
|
for (i = sourceColumnIndex; i < sourceColumnIndex + toSkip; i++) {
|
|
24778
25010
|
expandedColumns[i].orderIndex = nextSourceIndex++;
|
|
25011
|
+
expandedColumns[i].isReordered = true;
|
|
24779
25012
|
}
|
|
24780
25013
|
this.updateIndicesForLevel(source.level + 1);
|
|
24781
25014
|
this.columnResizingService.areColumnsReordered = true;
|
|
@@ -24788,7 +25021,11 @@ class GridComponent {
|
|
|
24788
25021
|
colsForLevel.push(...c.childrenArray.sort((a, b) => a.orderIndex - b.orderIndex));
|
|
24789
25022
|
}
|
|
24790
25023
|
});
|
|
24791
|
-
expandColumnsWithSpan(colsForLevel).map((c, i) =>
|
|
25024
|
+
expandColumnsWithSpan(colsForLevel).map((c, i) => {
|
|
25025
|
+
c.orderIndex = i;
|
|
25026
|
+
c.isReordered = true;
|
|
25027
|
+
return c;
|
|
25028
|
+
});
|
|
24792
25029
|
if (level < this.columnList.totalColumnLevels()) {
|
|
24793
25030
|
this.updateIndicesForLevel(level + 1);
|
|
24794
25031
|
}
|
|
@@ -25106,8 +25343,8 @@ class GridComponent {
|
|
|
25106
25343
|
.filter(item => isTruthy(item.column.resizable) && !item.column.isColumnGroup)
|
|
25107
25344
|
.map(item => ({
|
|
25108
25345
|
column: item.column,
|
|
25109
|
-
newWidth: item.column.width,
|
|
25110
|
-
oldWidth: item.oldWidth
|
|
25346
|
+
newWidth: roundDown(item.column.width),
|
|
25347
|
+
oldWidth: roundDown(item.oldWidth)
|
|
25111
25348
|
}));
|
|
25112
25349
|
this.columnResize.emit(args);
|
|
25113
25350
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-angular-grid",
|
|
3
|
-
"version": "18.1.0-develop.
|
|
3
|
+
"version": "18.1.0-develop.12",
|
|
4
4
|
"description": "Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Progress",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"package": {
|
|
27
27
|
"productName": "Kendo UI for Angular",
|
|
28
28
|
"productCode": "KENDOUIANGULAR",
|
|
29
|
-
"publishDate":
|
|
29
|
+
"publishDate": 1738675585,
|
|
30
30
|
"licensingDocsUrl": "https://www.telerik.com/kendo-angular-ui/my-license/"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
@@ -39,27 +39,27 @@
|
|
|
39
39
|
"@progress/kendo-data-query": "^1.0.0",
|
|
40
40
|
"@progress/kendo-drawing": "^1.21.0",
|
|
41
41
|
"@progress/kendo-licensing": "^1.0.2",
|
|
42
|
-
"@progress/kendo-angular-buttons": "18.1.0-develop.
|
|
43
|
-
"@progress/kendo-angular-common": "18.1.0-develop.
|
|
44
|
-
"@progress/kendo-angular-dateinputs": "18.1.0-develop.
|
|
45
|
-
"@progress/kendo-angular-layout": "18.1.0-develop.
|
|
46
|
-
"@progress/kendo-angular-dropdowns": "18.1.0-develop.
|
|
47
|
-
"@progress/kendo-angular-excel-export": "18.1.0-develop.
|
|
48
|
-
"@progress/kendo-angular-icons": "18.1.0-develop.
|
|
49
|
-
"@progress/kendo-angular-inputs": "18.1.0-develop.
|
|
50
|
-
"@progress/kendo-angular-intl": "18.1.0-develop.
|
|
51
|
-
"@progress/kendo-angular-l10n": "18.1.0-develop.
|
|
52
|
-
"@progress/kendo-angular-label": "18.1.0-develop.
|
|
53
|
-
"@progress/kendo-angular-pager": "18.1.0-develop.
|
|
54
|
-
"@progress/kendo-angular-pdf-export": "18.1.0-develop.
|
|
55
|
-
"@progress/kendo-angular-popup": "18.1.0-develop.
|
|
56
|
-
"@progress/kendo-angular-toolbar": "18.1.0-develop.
|
|
57
|
-
"@progress/kendo-angular-utils": "18.1.0-develop.
|
|
42
|
+
"@progress/kendo-angular-buttons": "18.1.0-develop.12",
|
|
43
|
+
"@progress/kendo-angular-common": "18.1.0-develop.12",
|
|
44
|
+
"@progress/kendo-angular-dateinputs": "18.1.0-develop.12",
|
|
45
|
+
"@progress/kendo-angular-layout": "18.1.0-develop.12",
|
|
46
|
+
"@progress/kendo-angular-dropdowns": "18.1.0-develop.12",
|
|
47
|
+
"@progress/kendo-angular-excel-export": "18.1.0-develop.12",
|
|
48
|
+
"@progress/kendo-angular-icons": "18.1.0-develop.12",
|
|
49
|
+
"@progress/kendo-angular-inputs": "18.1.0-develop.12",
|
|
50
|
+
"@progress/kendo-angular-intl": "18.1.0-develop.12",
|
|
51
|
+
"@progress/kendo-angular-l10n": "18.1.0-develop.12",
|
|
52
|
+
"@progress/kendo-angular-label": "18.1.0-develop.12",
|
|
53
|
+
"@progress/kendo-angular-pager": "18.1.0-develop.12",
|
|
54
|
+
"@progress/kendo-angular-pdf-export": "18.1.0-develop.12",
|
|
55
|
+
"@progress/kendo-angular-popup": "18.1.0-develop.12",
|
|
56
|
+
"@progress/kendo-angular-toolbar": "18.1.0-develop.12",
|
|
57
|
+
"@progress/kendo-angular-utils": "18.1.0-develop.12",
|
|
58
58
|
"rxjs": "^6.5.3 || ^7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"tslib": "^2.3.1",
|
|
62
|
-
"@progress/kendo-angular-schematics": "18.1.0-develop.
|
|
62
|
+
"@progress/kendo-angular-schematics": "18.1.0-develop.12",
|
|
63
63
|
"@progress/kendo-common": "^1.0.1",
|
|
64
64
|
"@progress/kendo-file-saver": "^1.0.0"
|
|
65
65
|
},
|
|
@@ -119,7 +119,6 @@ export declare class HeaderComponent implements AfterViewInit, OnInit, OnChanges
|
|
|
119
119
|
shouldActivate(column: ColumnBase): boolean;
|
|
120
120
|
isInteractive(column: ColumnComponent, prop: string): boolean;
|
|
121
121
|
isCheckboxColumn(column: any): boolean;
|
|
122
|
-
trackByIndex(index: number): number;
|
|
123
122
|
addStickyStyles(column: ColumnBase): {
|
|
124
123
|
[key: string]: any;
|
|
125
124
|
};
|
|
@@ -4,14 +4,14 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
4
4
|
function default_1(options) {
|
|
5
5
|
const finalOptions = Object.assign(Object.assign({}, options), { mainNgModule: 'GridModule', package: 'grid', peerDependencies: {
|
|
6
6
|
// peer deps of the dropdowns
|
|
7
|
-
'@progress/kendo-angular-treeview': '18.1.0-develop.
|
|
8
|
-
'@progress/kendo-angular-navigation': '18.1.0-develop.
|
|
7
|
+
'@progress/kendo-angular-treeview': '18.1.0-develop.12',
|
|
8
|
+
'@progress/kendo-angular-navigation': '18.1.0-develop.12',
|
|
9
9
|
// peer dependency of kendo-angular-inputs
|
|
10
|
-
'@progress/kendo-angular-dialog': '18.1.0-develop.
|
|
10
|
+
'@progress/kendo-angular-dialog': '18.1.0-develop.12',
|
|
11
11
|
// peer dependency of kendo-angular-icons
|
|
12
12
|
'@progress/kendo-svg-icons': '^4.0.0',
|
|
13
13
|
// peer dependency of kendo-angular-layout
|
|
14
|
-
'@progress/kendo-angular-progressbar': '18.1.0-develop.
|
|
14
|
+
'@progress/kendo-angular-progressbar': '18.1.0-develop.12'
|
|
15
15
|
} });
|
|
16
16
|
return (0, schematics_1.externalSchematic)('@progress/kendo-angular-schematics', 'ng-add', finalOptions);
|
|
17
17
|
}
|