Skip to content

Commit bf1f93d

Browse files
authored
Merge branch '19.0.x' into gedinakova/fix-clear-filter-15193-19.0
2 parents c62c02c + a89d3da commit bf1f93d

File tree

8 files changed

+55
-32
lines changed

8 files changed

+55
-32
lines changed

projects/igniteui-angular/src/lib/core/styles/components/chip/_chip-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@
386386
}
387387

388388
@if $variant == 'indigo' {
389-
%igx-icon-display {
389+
igx-icon {
390390
--size: #{sizable(rem(14px), rem(14px), rem(16px))}
391391
}
392392
}

projects/igniteui-angular/src/lib/core/styles/components/combo/_combo-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@
174174
// The wrapping element here is needed
175175
// in order to override the !important rule of .igx-icon--inactive.
176176
%igx-combo__case-icon {
177-
.igx-icon {
177+
igx-icon {
178178
// Important is needed since the .igx-icon--inactive has !important
179179
color: color($color: 'gray', $variant: 600) !important;
180180
}
181181
}
182182

183183
%igx-combo__case-icon--active {
184-
.igx-icon {
184+
igx-icon {
185185
color: color($color: 'primary')
186186
}
187187
}

projects/igniteui-angular/src/lib/core/styles/components/grid/_excel-filtering-theme.scss

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,9 @@
9999
}
100100
}
101101

102-
igx-icon {
103-
@if $variant == 'indigo' {
104-
--component-size: 2;
105-
} @else {
106-
width: var(--igx-icon-size, #{rem(15px)});
107-
height: var(--igx-icon-size, #{rem(15px)});
108-
font-size: var(--igx-icon-size, #{rem(15px)});
102+
@if $variant != 'indigo' {
103+
igx-icon {
104+
--size: var(--igx-icon-size, #{rem(15px)});
109105
}
110106
}
111107
}

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@
12061206
} @else {
12071207
padding-inline: pad-inline(rem(8px), rem(12px), rem(16px));
12081208

1209-
%igx-icon-display {
1209+
igx-icon {
12101210
opacity: if($theme-variant == 'light', .75, .85);
12111211

12121212
&:hover {
@@ -1460,12 +1460,12 @@
14601460
} @else {
14611461
padding-inline: pad-inline(rem(8px), rem(12px), rem(16px));
14621462

1463-
%igx-icon-display {
1463+
igx-icon {
14641464
opacity: if($theme-variant == 'light', .75, .85);
14651465
}
14661466

14671467
&:hover {
1468-
%igx-icon-display {
1468+
igx-icon {
14691469
opacity: 1;
14701470
}
14711471
}
@@ -2037,13 +2037,10 @@
20372037
position: relative;
20382038
display: flex;
20392039

2040-
igx-icon {
2041-
@if $variant == 'indigo' {
2042-
--component-size: 2;
2043-
} @else {
2044-
width: var(--igx-icon-size, #{rem(15px)});
2045-
height: var(--igx-icon-size, #{rem(15px)});
2046-
font-size: var(--igx-icon-size, #{rem(15px)});
2040+
2041+
@if $variant != 'indigo' {
2042+
igx-icon {
2043+
--size: var(--igx-icon-size, #{rem(15px)});
20472044
}
20482045
}
20492046

@@ -2149,15 +2146,15 @@
21492146
%grid-excel-icon {
21502147
color: var-get($theme, 'header-selected-text-color');
21512148

2152-
%igx-icon-display {
2149+
igx-icon {
21532150
color: var-get($theme, 'header-selected-text-color');
21542151
}
21552152

21562153
&:focus,
21572154
&:hover {
21582155
color: var-get($theme, 'header-selected-text-color');
21592156

2160-
%igx-icon-display {
2157+
igx-icon {
21612158
color: var-get($theme, 'header-selected-text-color');
21622159
}
21632160
}
@@ -2501,7 +2498,7 @@
25012498
}
25022499

25032500
%igx-group-label__icon {
2504-
&.igx-icon {
2501+
@at-root igx-icon#{&} {
25052502
--component-size: #{if($variant == 'indigo', 2, 1)};
25062503

25072504
color: var-get($theme, 'group-label-icon');
@@ -3449,10 +3446,9 @@
34493446
}
34503447

34513448
@if $variant == 'indigo' {
3452-
%igx-icon-display {
3449+
igx-icon {
34533450
opacity: if($theme-variant == 'light', .75, .85);
34543451

3455-
34563452
&:hover {
34573453
opacity: 1;
34583454
cursor: pointer;

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { IgxAvatarComponent } from '../../avatar/avatar.component';
1616
import { IColumnResizeEventArgs, IgxColumnComponent } from '../public_api';
1717
import { Size } from "../common/enums";
1818
import { setElementSize } from '../../test-utils/helper-utils.spec';
19+
import { IgxColumnResizerDirective } from '../resizing/resizer.directive';
1920

2021
describe('IgxGrid - Deferred Column Resizing #grid', () => {
2122

@@ -133,6 +134,27 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
133134
expect(grid.columnList.get(1).width).toEqual('70px');
134135
}));
135136

137+
it('should calculate correctly resizer position and column width when grid is scaled and zoomed', fakeAsync(() => {
138+
grid.nativeElement.style.transform = 'scale(1.2)';
139+
grid.nativeElement.style.setProperty('zoom', '1.05');
140+
fixture.detectChanges();
141+
headerResArea = GridFunctions.getHeaderResizeArea(headers[1]).nativeElement;
142+
UIInteractions.simulateMouseEvent('mousedown', headerResArea, 153, 0);
143+
tick(200);
144+
fixture.detectChanges();
145+
146+
const resizer = GridFunctions.getResizer(fixture);
147+
const resizerDirective = resizer.componentInstance.resizer as IgxColumnResizerDirective;
148+
const leftSetterSpy = spyOnProperty(resizerDirective, 'left', 'set').and.callThrough();
149+
UIInteractions.simulateMouseEvent('mousemove', resizer.nativeElement, 200, 5);
150+
UIInteractions.simulateMouseEvent('mouseup', resizer.nativeElement, 200, 5);
151+
fixture.detectChanges();
152+
153+
expect(leftSetterSpy).toHaveBeenCalled();
154+
expect(parseInt(leftSetterSpy.calls.mostRecent().args[0].toFixed(0))).toEqual(200);
155+
expect(parseInt(grid.columnList.get(1).headerCell.nativeElement.getBoundingClientRect().width.toFixed(0))).toEqual(173);
156+
}));
157+
136158
it('should be able to resize column to the minWidth < defaultMinWidth', fakeAsync(() => {
137159
const column = grid.getColumnByName('ID');
138160
column.minWidth = 'a';

projects/igniteui-angular/src/lib/grids/resizing/resizer.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
[restrictHResizeMax]="colResizingService.restrictResizeMax"
55
[restrictHResizeMin]="colResizingService.restrictResizeMin"
66
[restrictResizerTop]="restrictResizerTop"
7-
(resizeEnd)="colResizingService.resizeColumn($event)">
7+
(resizeEnd)="colResizingService.resizeColumn($event, resizer.ratio)">
88
</div>

projects/igniteui-angular/src/lib/grids/resizing/resizer.directive.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ export class IgxColumnResizerDirective implements OnInit, OnDestroy {
4141
@Output() public resize = new Subject<any>();
4242

4343
private _left: number;
44+
private _ratio: number = 1;
4445
private _destroy = new Subject<boolean>();
4546

47+
public get ratio(): number {
48+
return this._ratio;
49+
}
50+
4651
constructor(
4752
public element: ElementRef<HTMLElement>,
4853
@Inject(DOCUMENT) public document,
@@ -56,7 +61,7 @@ export class IgxColumnResizerDirective implements OnInit, OnDestroy {
5661
.pipe(
5762
takeUntil(this._destroy),
5863
takeUntil<MouseEvent>(this.resizeEnd),
59-
map((event) => event.clientX - offset),
64+
map((event) => (event.clientX - offset) / (this._ratio)),
6065
))
6166
)
6267
.subscribe((pos) => {
@@ -113,8 +118,12 @@ export class IgxColumnResizerDirective implements OnInit, OnDestroy {
113118
public onMousedown(event: MouseEvent) {
114119
event.preventDefault();
115120
const parent = this.element.nativeElement.parentElement.parentElement;
116-
117-
this.left = this._left = event.clientX - parent.getBoundingClientRect().left;
121+
const parentRectWidth = parent.getBoundingClientRect().width;
122+
const parentComputedWidth = parseFloat(window.getComputedStyle(parent).width);
123+
if (Math.abs(parentRectWidth - parentComputedWidth) > 1) {
124+
this._ratio = parentRectWidth / parentComputedWidth;
125+
}
126+
this.left = this._left = (event.clientX - parent.getBoundingClientRect().left) / this._ratio;
118127
this.top = (event.target as HTMLElement).getBoundingClientRect().top - parent.getBoundingClientRect().top;
119128

120129
this.resizeStart.next(event);

projects/igniteui-angular/src/lib/grids/resizing/resizing.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class IgxColumnResizingService {
3535
* @hidden
3636
*/
3737
public getColumnHeaderRenderedWidth() {
38-
return this.column.headerCell.nativeElement.getBoundingClientRect().width;
38+
return parseFloat(window.getComputedStyle(this.column.headerCell.nativeElement).width);
3939
}
4040

4141
/**
@@ -101,9 +101,9 @@ export class IgxColumnResizingService {
101101
/**
102102
* Resizes the column regaridng to the column minWidth and maxWidth.
103103
*/
104-
public resizeColumn(event: MouseEvent) {
104+
public resizeColumn(event: MouseEvent, ratio: number = 1) {
105105
this.showResizer = false;
106-
const diff = event.clientX - this.startResizePos;
106+
const diff = (event.clientX - this.startResizePos) / ratio;
107107

108108
const colWidth = this.column.width;
109109
const isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth.indexOf('%') !== -1;

0 commit comments

Comments
 (0)