Skip to content

Commit ac1d77f

Browse files
authored
Merge branch 'master' into skrastev/fix-9158
2 parents 848131e + 3ac3c5b commit ac1d77f

File tree

11 files changed

+717
-4
lines changed

11 files changed

+717
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6081,13 +6081,42 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
60816081
const columnWidthCombined = parseInt(this._columnWidth, 10) * (column.colEnd ? column.colEnd - column.colStart : 1);
60826082
column.defaultWidth = columnWidthCombined + 'px';
60836083
} else {
6084-
column.defaultWidth = this._columnWidth;
6084+
// D.K. March 29th, 2021 #9145 Consider min/max width when setting defaultWidth property
6085+
column.defaultWidth = this.getExtremumBasedColWidth(column);
60856086
column.resetCaches();
60866087
}
60876088
});
60886089
this.resetCachedWidths();
60896090
}
60906091

6092+
/**
6093+
* @hidden
6094+
* @internal
6095+
*/
6096+
protected getExtremumBasedColWidth(column: IgxColumnComponent): string {
6097+
let width = this._columnWidth;
6098+
if (width && typeof width !== 'string') {
6099+
width = String(width);
6100+
}
6101+
const minWidth = width.indexOf('%') === -1 ? column.minWidthPx : column.minWidthPercent;
6102+
const maxWidth = width.indexOf('%') === -1 ? column.maxWidthPx : column.maxWidthPercent;
6103+
if (column.hidden) {
6104+
return width;
6105+
}
6106+
6107+
if (minWidth > parseFloat(width)) {
6108+
width = String(column.minWidth);
6109+
} else if (maxWidth < parseFloat(width)) {
6110+
width = String(column.maxWidth);
6111+
}
6112+
6113+
// if no px or % are defined in maxWidth/minWidth consider it px
6114+
if (width.indexOf('%') === -1 && width.indexOf('px') === -1) {
6115+
width += 'px';
6116+
}
6117+
return width;
6118+
}
6119+
60916120
protected resetNotifyChanges() {
60926121
this._cdrRequestRepaint = false;
60936122
this._cdrRequests = false;

src/app/app.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ export class AppComponent implements OnInit {
268268
icon: 'view_column',
269269
name: 'Grid FinJS'
270270
},
271+
{
272+
link: '/gridUpdates',
273+
icon: 'view_column',
274+
name: 'Grid Nested Props Update'
275+
},
271276
{
272277
link: '/gridRemoteVirtualization',
273278
icon: 'view_column',

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ import { MainComponent } from './grid-finjs/main.component';
144144
import { ControllerComponent } from './grid-finjs/controllers.component';
145145
import { CommonModule } from '@angular/common';
146146
import { GridEventsComponent } from './grid-events/grid-events.component';
147+
import { GridUpdatesComponent } from './grid-updates-test/grid-updates.component';
147148

148149
const components = [
149150
ActionStripSampleComponent,
@@ -260,6 +261,7 @@ const components = [
260261
GridEventsComponent,
261262
GridFilteringComponent,
262263
GridFinJSComponent,
264+
GridUpdatesComponent,
263265
MainComponent,
264266
ControllerComponent,
265267
GridExternalFilteringComponent,

src/app/app.routing.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import { AnimationsSampleComponent } from './styleguide/animations/animations.sa
8585
import { GridFormattingComponent } from './grid-formatting/grid-formatting.component';
8686
import { MainComponent } from './grid-finjs/main.component';
8787
import { GridEventsComponent } from './grid-events/grid-events.component';
88+
import { GridUpdatesComponent } from './grid-updates-test/grid-updates.component';
8889

8990
const appRoutes = [
9091
{
@@ -405,6 +406,10 @@ const appRoutes = [
405406
path: 'gridEvents',
406407
component: GridEventsComponent
407408
},
409+
{
410+
path: 'gridUpdates',
411+
component: GridUpdatesComponent
412+
},
408413
];
409414

410415
export const routing = RouterModule.forRoot(appRoutes);

src/app/grid-finjs/grid-finjs.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
</div>
5858
</ng-template>
5959
</igx-column>
60+
61+
<igx-column [field]="'Obj.Price'" [width]="'120px'"></igx-column>
62+
6063
<igx-column [field]="'Chart'" [width]="'60px'" [hidden]="false" [filterable]='false'>
6164
<ng-template igxCell let-cell="cell" class="center-text">
6265
<button class="button-icon" igxButton="icon" igxRipple [igxRippleCentered]="true" tabindex="-1">

src/app/grid-finjs/grid-finjs.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import {
44
ViewChild } from '@angular/core';
55
import {
66
DefaultSortingStrategy,
7+
GridSelectionMode,
8+
IGroupingExpression,
79
IgxGridComponent,
810
SortingDirection
911
} from 'igniteui-angular';
1012
import { Contract, REGIONS } from '../shared/financialData';
1113

12-
const GROUPING_EXPRESSIONS = [{
14+
const GROUPING_EXPRESSIONS: IGroupingExpression[] = [{
1315
dir: SortingDirection.Desc,
1416
fieldName: 'Category',
1517
ignoreCase: false,
@@ -40,12 +42,12 @@ export class GridFinJSComponent {
4042
@Input()
4143
public data: any;
4244

43-
public selectionMode = 'multiple';
45+
public selectionMode: GridSelectionMode = GridSelectionMode.multiple;
4446
public contracts = Contract;
4547
public regions = REGIONS;
4648
public columnFormat = { digitsInfo: '1.3-3'};
4749
public showToolbar = true;
48-
public groupingExpressions = GROUPING_EXPRESSIONS;
50+
public groupingExpressions: IGroupingExpression[] = GROUPING_EXPRESSIONS;
4951

5052
constructor() { }
5153

0 commit comments

Comments
 (0)