Skip to content

Commit a40b313

Browse files
authored
Merge branch '19.2.x' into apetrov/fix-bootstrap-border-19.2.x
2 parents afff9b3 + d3b8a65 commit a40b313

File tree

8 files changed

+169
-24
lines changed

8 files changed

+169
-24
lines changed

projects/igniteui-angular/src/lib/directives/tooltip/tooltip-target.directive.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
199199
public override onClick() {
200200
if (!this.target.collapsed) {
201201
this.target.forceClose(this.mergedOverlaySettings);
202+
} else if (this.target.toBeShown) {
203+
clearTimeout(this.target.timeoutId);
204+
this.target.toBeShown = false;
202205
}
203206
}
204207

projects/igniteui-angular/src/lib/directives/tooltip/tooltip.directive.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,21 @@ describe('IgxTooltip', () => {
258258
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, false);
259259
}));
260260

261+
it('IgxTooltip should not be shown if the target is clicked - #16145', fakeAsync(() => {
262+
tooltipTarget.showDelay = 500;
263+
fix.detectChanges();
264+
265+
hoverElement(button);
266+
tick(300);
267+
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, false);
268+
269+
UIInteractions.simulateClickAndSelectEvent(button);
270+
fix.detectChanges();
271+
272+
tick(300);
273+
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, false);
274+
}));
275+
261276
it('IgxTooltip hides on pressing \'escape\' key', fakeAsync(() => {
262277
tooltipTarget.showTooltip();
263278
flush();

projects/igniteui-angular/src/lib/grids/columns/column.component.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -967,8 +967,9 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
967967
*/
968968
public get minWidthPx() {
969969
const gridAvailableSize = this.grid.calcWidth;
970-
const isPercentageWidth = this.minWidth && typeof this.minWidth === 'string' && this.minWidth.indexOf('%') !== -1;
971-
return isPercentageWidth ? parseFloat(this.minWidth) / 100 * gridAvailableSize : parseFloat(this.minWidth);
970+
const minWidth = this.minWidth || this.defaultMinWidth;
971+
const isPercentageWidth = minWidth && typeof minWidth === 'string' && minWidth.indexOf('%') !== -1;
972+
return isPercentageWidth ? parseFloat(minWidth) / 100 * gridAvailableSize : parseFloat(minWidth);
972973
}
973974

974975
/**
@@ -985,8 +986,9 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
985986
*/
986987
public get minWidthPercent() {
987988
const gridAvailableSize = this.grid.calcWidth;
988-
const isPercentageWidth = this.minWidth && typeof this.minWidth === 'string' && this.minWidth.indexOf('%') !== -1;
989-
return isPercentageWidth ? parseFloat(this.minWidth) : parseFloat(this.minWidth) / gridAvailableSize * 100;
989+
const minWidth = this.minWidth || this.defaultMinWidth;
990+
const isPercentageWidth = minWidth && typeof minWidth === 'string' && minWidth.indexOf('%') !== -1;
991+
return isPercentageWidth ? parseFloat(minWidth) : parseFloat(minWidth) / gridAvailableSize * 100;
990992
}
991993

992994

@@ -1014,7 +1016,7 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
10141016
this.grid.notifyChanges(true);
10151017
}
10161018
public get minWidth(): string {
1017-
return !this._defaultMinWidth ? this.defaultMinWidth : this._defaultMinWidth;
1019+
return this._defaultMinWidth;
10181020
}
10191021

10201022
/** @hidden @internal **/
@@ -2646,8 +2648,15 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
26462648
const currentCalcWidth = this.defaultWidth || this.grid.getPossibleColumnWidth();
26472649
this._calcWidth = this.getConstrainedSizePx(currentCalcWidth);
26482650
} else {
2649-
const currentCalcWidth = parseFloat(this.width);
2650-
this._calcWidth =this.getConstrainedSizePx(currentCalcWidth);
2651+
let possibleColumnWidth = '';
2652+
if (!this.widthSetByUser && this.userSetMinWidthPx && this.userSetMinWidthPx < this.grid.minColumnWidth) {
2653+
possibleColumnWidth = this.defaultWidth = this.grid.getPossibleColumnWidth(null, this.userSetMinWidthPx);
2654+
} else {
2655+
possibleColumnWidth = this.width;
2656+
}
2657+
2658+
const currentCalcWidth = parseFloat(possibleColumnWidth);
2659+
this._calcWidth = this.getConstrainedSizePx(currentCalcWidth);
26512660
}
26522661
this.calcPixelWidth = parseFloat(this._calcWidth);
26532662
}

projects/igniteui-angular/src/lib/grids/common/grid.interface.ts

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,19 +295,63 @@ export interface RowType {
295295
*/
296296
unpin?: () => void;
297297
}
298-
298+
/**
299+
* Describes a field that can be used in the Grid and QueryBuilder components.
300+
*/
299301
export interface FieldType {
302+
/**
303+
* Display label for the field.
304+
*/
300305
label?: string;
306+
307+
/**
308+
* The internal field name, used in expressions and queries.
309+
*/
301310
field: string;
311+
312+
/**
313+
* Optional column header for UI display purposes.
314+
*/
302315
header?: string;
316+
317+
/**
318+
* The data type of the field.
319+
*/
303320
/* alternateType: GridColumnDataType */
304321
dataType: DataType;
322+
323+
/**
324+
* Options for the editor associated with this field.
325+
*/
305326
editorOptions?: IFieldEditorOptions;
327+
328+
/**
329+
* Optional filtering operands that apply to this field.
330+
*/
306331
filters?: IgxFilteringOperand;
332+
333+
/**
334+
* Optional arguments for any pipe applied to the field.
335+
*/
307336
pipeArgs?: IFieldPipeArgs;
337+
338+
/**
339+
* Default time format for Date/Time fields.
340+
*/
308341
defaultTimeFormat?: string;
342+
343+
/**
344+
* Default date/time format for Date/Time fields.
345+
*/
309346
defaultDateTimeFormat?: string;
310347

348+
/**
349+
* Optional formatter function to transform the value before display.
350+
*
351+
* @param value - The value of the field.
352+
* @param rowData - Optional row data that contains this field.
353+
* @returns The formatted value.
354+
*/
311355
formatter?(value: any, rowData?: any): any;
312356
}
313357

@@ -1156,7 +1200,7 @@ export interface GridType extends IGridDataBindable {
11561200
refreshSearch(): void;
11571201
getDefaultExpandState(record: any): boolean;
11581202
trackColumnChanges(index: number, column: any): any;
1159-
getPossibleColumnWidth(): string;
1203+
getPossibleColumnWidth(baseWidth?: number, minColumnWidth?: number): string;
11601204
resetHorizontalVirtualization(): void;
11611205
hasVerticalScroll(): boolean;
11621206
getVisibleContentHeight(): number;
@@ -1492,10 +1536,24 @@ export interface IClipboardOptions {
14921536
}
14931537

14941538
/**
1495-
* An interface describing entity
1539+
* Describes an entity in the QueryBuilder.
1540+
* An entity represents a logical grouping of fields and can have nested child entities.
14961541
*/
14971542
export interface EntityType {
1543+
/**
1544+
* The name of the entity.
1545+
* Typically used as an identifier in expressions.
1546+
*/
14981547
name: string;
1548+
1549+
/**
1550+
* The list of fields that belong to this entity.
1551+
*/
14991552
fields: FieldType[];
1553+
1554+
/**
1555+
* Optional child entities.
1556+
* This allows building hierarchical or nested query structures.
1557+
*/
15001558
childEntities?: EntityType[];
15011559
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5451,7 +5451,7 @@ export abstract class IgxGridBaseDirective implements GridType,
54515451
/**
54525452
* @hidden @internal
54535453
*/
5454-
public getPossibleColumnWidth(baseWidth: number = null) {
5454+
public getPossibleColumnWidth(baseWidth: number = null, minColumnWidth: number = null) {
54555455
let computedWidth;
54565456
if (baseWidth !== null) {
54575457
computedWidth = baseWidth;
@@ -5500,9 +5500,11 @@ export abstract class IgxGridBaseDirective implements GridType,
55005500
}
55015501
computedWidth -= this.featureColumnsWidth();
55025502

5503+
const minColWidth = minColumnWidth || this.minColumnWidth;
5504+
55035505
const columnWidth = !Number.isFinite(sumExistingWidths) ?
5504-
Math.max(computedWidth / columnsToSize, this.minColumnWidth) :
5505-
Math.max((computedWidth - sumExistingWidths) / columnsToSize, this.minColumnWidth);
5506+
Math.max(computedWidth / columnsToSize, minColWidth) :
5507+
Math.max((computedWidth - sumExistingWidths) / columnsToSize, minColWidth);
55065508

55075509
return columnWidth + 'px';
55085510
}

projects/igniteui-angular/src/lib/grids/grid/column-resizing.spec.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
2929
GridFeaturesComponent,
3030
LargePinnedColGridComponent,
3131
NullColumnsComponent,
32+
MinWidthColumnsComponent,
3233
ColGridComponent,
3334
ColPercentageGridComponent
3435
]
@@ -898,6 +899,18 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
898899
expect(headers[headers.length - 1].nativeElement.innerText).toEqual("ReleaseDate");
899900
expect(firstRowCells.length).toEqual(11);
900901
}));
902+
903+
it('should use user-provided `minWidth` as default min column width to size columns - #16057.', fakeAsync(() => {
904+
const fixture = TestBed.createComponent(MinWidthColumnsComponent);
905+
fixture.detectChanges();
906+
907+
const grid = fixture.componentInstance.grid;
908+
909+
expect(grid.columnList.get(0).width).toEqual('130px');
910+
expect(grid.columnList.get(1).width).toEqual('90px');
911+
expect(grid.columnList.get(2).width).toEqual('90px');
912+
expect(grid.columnList.get(3).width).toEqual('90px');
913+
}));
901914
});
902915

903916
describe('Resizer tests: ', () => {
@@ -1056,6 +1069,23 @@ export class NullColumnsComponent implements OnInit {
10561069
}
10571070
}
10581071

1072+
@Component({
1073+
template: GridTemplateStrings.declareGrid(`width="400px" height="200px"`, ``, `<igx-column [field]="'ID'" [width]="'130px'" [resizable]="true"></igx-column>
1074+
<igx-column [field]="'CompanyName'" [minWidth]="'50px'" [resizable]="true"></igx-column>
1075+
<igx-column [field]="'ContactName'" [minWidth]="'50px'" [resizable]="true"></igx-column>
1076+
<igx-column [field]="'ContactTitle'" [minWidth]="'50px'" [resizable]="true"></igx-column>`),
1077+
imports: [IgxGridComponent, IgxColumnComponent]
1078+
})
1079+
export class MinWidthColumnsComponent implements OnInit {
1080+
@ViewChild(IgxGridComponent, { static: true }) public grid: IgxGridComponent;
1081+
1082+
public data = [];
1083+
1084+
public ngOnInit(): void {
1085+
this.data = SampleTestData.contactInfoData();
1086+
}
1087+
}
1088+
10591089
@Component({
10601090
template: GridTemplateStrings.declareGrid(`width="400px" height="600px" [allowFiltering]="true"`, ``, `<igx-column [field]="'Items'" [width]="'40px'" dataType="string" [filterable]="true"></igx-column>
10611091
<igx-column [field]="'ID'" [width]="'50px'" [header]="'ID'" [filterable]="true"></igx-column>

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
531531
expect(pivotGrid.gridSize).toBe(Size.Small);
532532
const dimensionContents = fixture.debugElement.queryAll(By.css('.igx-grid__tbody-pivot-dimension'));
533533
let rowHeaders = dimensionContents[0].queryAll(By.directive(IgxPivotRowDimensionHeaderGroupComponent));
534-
expect(rowHeaders[0].componentInstance.column.minWidth).toBe(minWidthSupercompact);
534+
expect(rowHeaders[0].componentInstance.column.defaultMinWidth).toBe(minWidthSupercompact);
535535
expect(pivotGrid.rowList.first.cells.first.nativeElement.offsetHeight).toBe(cellHeightSuperCompact);
536536

537537
pivotGrid.superCompactMode = false;
@@ -543,7 +543,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
543543

544544
expect(pivotGrid.gridSize).toBe(Size.Large);
545545
rowHeaders = dimensionContents[0].queryAll(By.directive(IgxPivotRowDimensionHeaderGroupComponent));
546-
expect(rowHeaders[0].componentInstance.column.minWidth).toBe(minWidthComf);
546+
expect(rowHeaders[0].componentInstance.column.defaultMinWidth).toBe(minWidthComf);
547547
expect(pivotGrid.rowList.first.cells.first.nativeElement.offsetHeight).toBe(cellHeightComf);
548548
}));
549549

@@ -2411,7 +2411,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
24112411
fixture.detectChanges();
24122412

24132413
rowHeaders = dimensionContents[0].queryAll(By.directive(IgxPivotRowDimensionHeaderGroupComponent));
2414-
const minWdith = parseFloat(rowHeaders[0].componentInstance.column.minWidth);
2414+
const minWdith = parseFloat(rowHeaders[0].componentInstance.column.defaultMinWidth);
24152415
expect(parseFloat(rowHeaders[0].componentInstance.column.width)).toEqual(minWdith);
24162416
expect(parseFloat(rowHeaders[3].componentInstance.column.width)).toEqual(minWdith);
24172417

projects/igniteui-angular/src/lib/query-builder/query-builder.component.ts

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,40 @@ export class IgxQueryBuilderComponent implements OnDestroy {
5151
public showEntityChangeDialog = true;
5252

5353
/**
54-
* Returns the entities.
55-
* @hidden
54+
* Gets the list of entities available for the IgxQueryBuilderComponent.
55+
*
56+
* Each entity describes a logical group of fields that can be used in queries.
57+
* An entity can optionally have child entities, allowing nested sub-queries.
58+
*
59+
* @returns An array of {@link EntityType} objects.
5660
*/
5761
public get entities(): EntityType[] {
5862
return this._entities;
5963
}
6064

6165
/**
62-
* Sets the entities.
63-
* @hidden
66+
* Sets the list of entities for the IgxQueryBuilderComponent.
67+
* If the `expressionTree` is defined, it will be recreated with the new entities.
68+
*
69+
* Each entity should be an {@link EntityType} object describing the fields and optionally child entities.
70+
*
71+
* Example:
72+
* ```ts
73+
* [
74+
* {
75+
* name: 'Orders',
76+
* fields: [{ field: 'OrderID', dataType: 'number' }],
77+
* childEntities: [
78+
* {
79+
* name: 'OrderDetails',
80+
* fields: [{ field: 'ProductID', dataType: 'number' }]
81+
* }
82+
* ]
83+
* }
84+
* ]
85+
* ```
86+
*
87+
* @param entities - The array of entities to set.
6488
*/
6589
@Input()
6690
public set entities(entities: EntityType[]) {
@@ -73,18 +97,22 @@ export class IgxQueryBuilderComponent implements OnDestroy {
7397
}
7498

7599
/**
76-
* Returns the fields.
100+
* Gets the list of fields for the QueryBuilder.
101+
*
102+
* @deprecated since version 19.1.0. Use the `entities` property instead.
77103
* @hidden
78-
* @deprecated in version 19.1.0. Use the `entities` property instead.
79104
*/
80105
public get fields(): FieldType[] {
81106
return this._fields;
82107
}
83108

84109
/**
85-
* Sets the fields.
110+
* Sets the list of fields for the QueryBuilder.
111+
* Automatically wraps them into a single entity to maintain backward compatibility.
112+
*
113+
* @param fields - The array of fields to set.
114+
* @deprecated since version 19.1.0. Use the `entities` property instead.
86115
* @hidden
87-
* @deprecated in version 19.1.0. Use the `entities` property instead.
88116
*/
89117
@Input()
90118
public set fields(fields: FieldType[]) {

0 commit comments

Comments
 (0)