@progress/kendo-angular-grid 6.1.1-dev.202203111449 → 6.1.2-dev.202203221325

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.
@@ -12,6 +12,7 @@ import { expandColumns, leafColumns, columnsToRender } from '../columns/column-c
12
12
  import { DraggableDirective } from '@progress/kendo-angular-common';
13
13
  import { ColumnResizingService } from './column-resizing.service';
14
14
  import { delay, takeUntil, filter, take, tap, switchMap, map } from 'rxjs/operators';
15
+ import { ColumnInfoService } from '../common/column-info.service';
15
16
  // TODO
16
17
  // tslint:disable:rxjs-no-unsafe-takeuntil
17
18
  /**
@@ -101,13 +102,14 @@ var ɵ8 = indexOf;
101
102
  * @hidden
102
103
  */
103
104
  var ColumnHandleDirective = /** @class */ (function () {
104
- function ColumnHandleDirective(draggable, element, service, zone, cdr, localization) {
105
+ function ColumnHandleDirective(draggable, element, service, zone, cdr, localization, columnInfoService) {
105
106
  this.draggable = draggable;
106
107
  this.element = element;
107
108
  this.service = service;
108
109
  this.zone = zone;
109
110
  this.cdr = cdr;
110
111
  this.localization = localization;
112
+ this.columnInfoService = columnInfoService;
111
113
  this.columns = [];
112
114
  this.subscriptions = new Subscription();
113
115
  this.rtl = false;
@@ -155,6 +157,9 @@ var ColumnHandleDirective = /** @class */ (function () {
155
157
  };
156
158
  ColumnHandleDirective.prototype.ngOnInit = function () {
157
159
  var _this = this;
160
+ if (isBlank(this.column.width)) {
161
+ this.column.implicitWidth = headerWidth(this.element);
162
+ }
158
163
  var service = this.service.changes.pipe(filter(function () { return _this.column.resizable; }), filter(function (e) { return isPresent(e.columns.find(function (column) { return column === _this.column; })); }));
159
164
  this.subscriptions.add(service.pipe(filter(function (e) { return e.type === 'start'; }))
160
165
  .subscribe(this.initState.bind(this)));
@@ -222,6 +227,13 @@ var ColumnHandleDirective = /** @class */ (function () {
222
227
  };
223
228
  ColumnHandleDirective.prototype.updateWidth = function (column, width) {
224
229
  column.width = width;
230
+ this.columnInfoService.hiddenColumns.forEach(function (col) {
231
+ if (isBlank(col.width) && isPresent(col.implicitWidth)) {
232
+ // Resize hidden columns to their implicit width so they
233
+ // can be displayed with the same width if made visible.
234
+ col.width = col.implicitWidth;
235
+ }
236
+ });
225
237
  this.cdr.markForCheck(); //force CD cycle
226
238
  };
227
239
  ColumnHandleDirective.prototype.columnsForLevel = function (level) {
@@ -266,7 +278,8 @@ var ColumnHandleDirective = /** @class */ (function () {
266
278
  ColumnResizingService,
267
279
  NgZone,
268
280
  ChangeDetectorRef,
269
- LocalizationService])
281
+ LocalizationService,
282
+ ColumnInfoService])
270
283
  ], ColumnHandleDirective);
271
284
  return ColumnHandleDirective;
272
285
  }());
@@ -3,10 +3,11 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
- import { Input, ContentChild, ContentChildren, QueryList } from '@angular/core';
6
+ import { Input, ContentChild, ContentChildren, QueryList, isDevMode } from '@angular/core';
7
7
  import { HeaderTemplateDirective } from '../rendering/header/header-template.directive';
8
8
  import { FooterTemplateDirective } from '../rendering/footer/footer-template.directive';
9
9
  import { ColumnMenuTemplateDirective } from '../column-menu/column-menu-template.directive';
10
+ import { isPresent } from '../utils';
10
11
  /**
11
12
  * @hidden
12
13
  */
@@ -144,7 +145,10 @@ var ColumnBase = /** @class */ (function () {
144
145
  * The width of the column (in pixels).
145
146
  */
146
147
  set: function (value) {
147
- this._width = parseInt(value, 10);
148
+ if (isDevMode() && isPresent(value) && typeof value !== 'number') {
149
+ throw new Error('The "width" option accepts numeric values only.');
150
+ }
151
+ this._width = typeof value === 'string' ? parseInt(value, 10) : value;
148
152
  },
149
153
  enumerable: true,
150
154
  configurable: true
@@ -47,6 +47,16 @@ var ColumnInfoService = /** @class */ (function () {
47
47
  enumerable: true,
48
48
  configurable: true
49
49
  });
50
+ Object.defineProperty(ColumnInfoService.prototype, "hiddenColumns", {
51
+ get: function () {
52
+ if (!this.list) {
53
+ return [];
54
+ }
55
+ return this.list().filter(function (column) { return !column.isVisible; });
56
+ },
57
+ enumerable: true,
58
+ configurable: true
59
+ });
50
60
  Object.defineProperty(ColumnInfoService.prototype, "leafNamedColumns", {
51
61
  get: function () {
52
62
  var columns = expandColumns(this.list().filterSort(function (column) { return !column.isColumnGroup; }))
@@ -9,7 +9,7 @@ export var packageMetadata = {
9
9
  name: '@progress/kendo-angular-grid',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1647009706,
12
+ publishDate: 1647955042,
13
13
  version: '',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
15
  };
@@ -7,6 +7,7 @@ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
7
  import { ColumnBase } from '../columns/column-base';
8
8
  import { DraggableDirective } from '@progress/kendo-angular-common';
9
9
  import { ColumnResizingService } from './column-resizing.service';
10
+ import { ColumnInfoService } from '../common/column-info.service';
10
11
  /**
11
12
  * @hidden
12
13
  */
@@ -17,6 +18,7 @@ export declare class ColumnHandleDirective implements OnInit, OnDestroy {
17
18
  private zone;
18
19
  private cdr;
19
20
  private localization;
21
+ private columnInfoService;
20
22
  columns: Array<ColumnBase>;
21
23
  column: ColumnBase;
22
24
  readonly visible: string;
@@ -25,7 +27,7 @@ export declare class ColumnHandleDirective implements OnInit, OnDestroy {
25
27
  private subscriptions;
26
28
  private rtl;
27
29
  autoFit(): void;
28
- constructor(draggable: DraggableDirective, element: ElementRef, service: ColumnResizingService, zone: NgZone, cdr: ChangeDetectorRef, localization: LocalizationService);
30
+ constructor(draggable: DraggableDirective, element: ElementRef, service: ColumnResizingService, zone: NgZone, cdr: ChangeDetectorRef, localization: LocalizationService, columnInfoService: ColumnInfoService);
29
31
  ngOnInit(): void;
30
32
  ngOnDestroy(): void;
31
33
  private shouldUpdate;
@@ -12,6 +12,7 @@ import { expandColumns, leafColumns, columnsToRender } from '../columns/column-c
12
12
  import { DraggableDirective } from '@progress/kendo-angular-common';
13
13
  import { ColumnResizingService } from './column-resizing.service';
14
14
  import { delay, takeUntil, filter, take, tap, switchMap, map } from 'rxjs/operators';
15
+ import { ColumnInfoService } from '../common/column-info.service';
15
16
  // TODO
16
17
  // tslint:disable:rxjs-no-unsafe-takeuntil
17
18
  /**
@@ -93,13 +94,14 @@ const ɵ8 = indexOf;
93
94
  * @hidden
94
95
  */
95
96
  let ColumnHandleDirective = class ColumnHandleDirective {
96
- constructor(draggable, element, service, zone, cdr, localization) {
97
+ constructor(draggable, element, service, zone, cdr, localization, columnInfoService) {
97
98
  this.draggable = draggable;
98
99
  this.element = element;
99
100
  this.service = service;
100
101
  this.zone = zone;
101
102
  this.cdr = cdr;
102
103
  this.localization = localization;
104
+ this.columnInfoService = columnInfoService;
103
105
  this.columns = [];
104
106
  this.subscriptions = new Subscription();
105
107
  this.rtl = false;
@@ -133,6 +135,9 @@ let ColumnHandleDirective = class ColumnHandleDirective {
133
135
  this.service.measureColumns(columnInfo);
134
136
  }
135
137
  ngOnInit() {
138
+ if (isBlank(this.column.width)) {
139
+ this.column.implicitWidth = headerWidth(this.element);
140
+ }
136
141
  const service = this.service.changes.pipe(filter(() => this.column.resizable), filter(e => isPresent(e.columns.find(column => column === this.column))));
137
142
  this.subscriptions.add(service.pipe(filter(e => e.type === 'start'))
138
143
  .subscribe(this.initState.bind(this)));
@@ -192,6 +197,13 @@ let ColumnHandleDirective = class ColumnHandleDirective {
192
197
  }
193
198
  updateWidth(column, width) {
194
199
  column.width = width;
200
+ this.columnInfoService.hiddenColumns.forEach((col) => {
201
+ if (isBlank(col.width) && isPresent(col.implicitWidth)) {
202
+ // Resize hidden columns to their implicit width so they
203
+ // can be displayed with the same width if made visible.
204
+ col.width = col.implicitWidth;
205
+ }
206
+ });
195
207
  this.cdr.markForCheck(); //force CD cycle
196
208
  }
197
209
  columnsForLevel(level) {
@@ -237,7 +249,8 @@ ColumnHandleDirective = tslib_1.__decorate([
237
249
  ColumnResizingService,
238
250
  NgZone,
239
251
  ChangeDetectorRef,
240
- LocalizationService])
252
+ LocalizationService,
253
+ ColumnInfoService])
241
254
  ], ColumnHandleDirective);
242
255
  export { ColumnHandleDirective };
243
256
  export { ɵ0, ɵ1, ɵ2, ɵ3, ɵ4, ɵ5, ɵ6, ɵ7, ɵ8 };
@@ -563,6 +563,10 @@ export declare class ColumnBase {
563
563
  * @hidden
564
564
  */
565
565
  idService: IdService;
566
+ /**
567
+ * @hidden
568
+ */
569
+ implicitWidth: number;
566
570
  /**
567
571
  * @hidden
568
572
  */
@@ -3,10 +3,11 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
- import { Input, ContentChild, ContentChildren, QueryList } from '@angular/core';
6
+ import { Input, ContentChild, ContentChildren, QueryList, isDevMode } from '@angular/core';
7
7
  import { HeaderTemplateDirective } from '../rendering/header/header-template.directive';
8
8
  import { FooterTemplateDirective } from '../rendering/footer/footer-template.directive';
9
9
  import { ColumnMenuTemplateDirective } from '../column-menu/column-menu-template.directive';
10
+ import { isPresent } from '../utils';
10
11
  /**
11
12
  * @hidden
12
13
  */
@@ -142,7 +143,10 @@ export class ColumnBase {
142
143
  * The width of the column (in pixels).
143
144
  */
144
145
  set width(value) {
145
- this._width = parseInt(value, 10);
146
+ if (isDevMode() && isPresent(value) && typeof value !== 'number') {
147
+ throw new Error('The "width" option accepts numeric values only.');
148
+ }
149
+ this._width = typeof value === 'string' ? parseInt(value, 10) : value;
146
150
  }
147
151
  get width() { return this._width; }
148
152
  /**
@@ -21,6 +21,7 @@ export declare class ColumnInfoService {
21
21
  readonly nonLockedLeafColumns: QueryList<ColumnBase>;
22
22
  readonly isLocked: boolean;
23
23
  readonly totalLevels: number;
24
+ readonly hiddenColumns: ColumnBase[];
24
25
  readonly leafNamedColumns: ColumnBase[];
25
26
  readonly unlockedRootCount: number;
26
27
  stickyColumnsStyles(column: ColumnBase): {
@@ -34,6 +34,12 @@ let ColumnInfoService = class ColumnInfoService {
34
34
  get totalLevels() {
35
35
  return this.columnsContainer.totalLevels;
36
36
  }
37
+ get hiddenColumns() {
38
+ if (!this.list) {
39
+ return [];
40
+ }
41
+ return this.list().filter(column => !column.isVisible);
42
+ }
37
43
  get leafNamedColumns() {
38
44
  const columns = expandColumns(this.list().filterSort(column => !column.isColumnGroup))
39
45
  .filter(column => column.matchesMedia && column.displayTitle);