Skip to content

Commit

Permalink
Merge branch 'master' into gedinakova/fix-clear-filter-15193
Browse files Browse the repository at this point in the history
  • Loading branch information
gedinakova authored Jan 10, 2025
2 parents 1f26189 + 06959f3 commit 4253fb3
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
flex-flow: row nowrap;
align-items: center;
outline-style: none;
cursor: pointer;
}

%cbx-display--disabled {
Expand Down Expand Up @@ -211,7 +212,6 @@
%cbx-composite {
position: relative;
display: inline-block;
cursor: pointer;
width: $size;
height: $size;
min-width: $size;
Expand Down Expand Up @@ -500,7 +500,6 @@
%cbx-label {
display: inline-block;
color: var-get($theme, 'label-color');
cursor: pointer;
user-select: none;
word-wrap: break-all;
transition: color .2s $ease-out-quad;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
}

@if $variant == 'indigo' {
%igx-icon-display {
igx-icon {
--size: #{sizable(rem(14px), rem(14px), rem(16px))}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@
// The wrapping element here is needed
// in order to override the !important rule of .igx-icon--inactive.
%igx-combo__case-icon {
.igx-icon {
igx-icon {
// Important is needed since the .igx-icon--inactive has !important
color: color($color: 'gray', $variant: 600) !important;
}
}

%igx-combo__case-icon--active {
.igx-icon {
igx-icon {
color: color($color: 'primary')
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,9 @@
}
}

igx-icon {
@if $variant == 'indigo' {
--component-size: 2;
} @else {
width: var(--igx-icon-size, #{rem(15px)});
height: var(--igx-icon-size, #{rem(15px)});
font-size: var(--igx-icon-size, #{rem(15px)});
@if $variant != 'indigo' {
igx-icon {
--size: var(--igx-icon-size, #{rem(15px)});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@
} @else {
padding-inline: pad-inline(rem(8px), rem(12px), rem(16px));

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

&:hover {
Expand Down Expand Up @@ -1458,12 +1458,12 @@
} @else {
padding-inline: pad-inline(rem(8px), rem(12px), rem(16px));

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

&:hover {
%igx-icon-display {
igx-icon {
opacity: 1;
}
}
Expand Down Expand Up @@ -2035,13 +2035,10 @@
position: relative;
display: flex;

igx-icon {
@if $variant == 'indigo' {
--component-size: 2;
} @else {
width: var(--igx-icon-size, #{rem(15px)});
height: var(--igx-icon-size, #{rem(15px)});
font-size: var(--igx-icon-size, #{rem(15px)});

@if $variant != 'indigo' {
igx-icon {
--size: var(--igx-icon-size, #{rem(15px)});
}
}

Expand Down Expand Up @@ -2147,15 +2144,15 @@
%grid-excel-icon {
color: var-get($theme, 'header-selected-text-color');

%igx-icon-display {
igx-icon {
color: var-get($theme, 'header-selected-text-color');
}

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

%igx-icon-display {
igx-icon {
color: var-get($theme, 'header-selected-text-color');
}
}
Expand Down Expand Up @@ -2499,7 +2496,7 @@
}

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

color: var-get($theme, 'group-label-icon');
Expand Down Expand Up @@ -3447,10 +3444,9 @@
}

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


&:hover {
opacity: 1;
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@
height: $size;
min-width: $size;
line-height: $size;
cursor: pointer;
color: var-get($theme, 'label-color');
user-select: none;

Expand Down Expand Up @@ -400,7 +399,6 @@

%radio-label {
color: var-get($theme, 'label-color');
cursor: pointer;
user-select: none;
word-wrap: break-all;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@
border: rem(1px) solid var-get($theme, 'border-color');
border-radius: var-get($theme, 'border-radius-track');
background: var-get($theme, 'track-off-color');
cursor: pointer;
user-select: none;
transition: $input-transition;

Expand Down Expand Up @@ -557,7 +556,6 @@
%switch-label {
display: inline-block;
color: var-get($theme, 'label-color');
cursor: pointer;
user-select: none;
word-wrap: break-all;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { IgxAvatarComponent } from '../../avatar/avatar.component';
import { IColumnResizeEventArgs, IgxColumnComponent } from '../public_api';
import { Size } from "../common/enums";
import { setElementSize } from '../../test-utils/helper-utils.spec';
import { IgxColumnResizerDirective } from '../resizing/resizer.directive';

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

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

it('should calculate correctly resizer position and column width when grid is scaled and zoomed', fakeAsync(() => {
grid.nativeElement.style.transform = 'scale(1.2)';
grid.nativeElement.style.setProperty('zoom', '1.05');
fixture.detectChanges();
headerResArea = GridFunctions.getHeaderResizeArea(headers[1]).nativeElement;
UIInteractions.simulateMouseEvent('mousedown', headerResArea, 153, 0);
tick(200);
fixture.detectChanges();

const resizer = GridFunctions.getResizer(fixture);
const resizerDirective = resizer.componentInstance.resizer as IgxColumnResizerDirective;
const leftSetterSpy = spyOnProperty(resizerDirective, 'left', 'set').and.callThrough();
UIInteractions.simulateMouseEvent('mousemove', resizer.nativeElement, 200, 5);
UIInteractions.simulateMouseEvent('mouseup', resizer.nativeElement, 200, 5);
fixture.detectChanges();

expect(leftSetterSpy).toHaveBeenCalled();
expect(parseInt(leftSetterSpy.calls.mostRecent().args[0].toFixed(0))).toEqual(200);
expect(parseInt(grid.columnList.get(1).headerCell.nativeElement.getBoundingClientRect().width.toFixed(0))).toEqual(173);
}));

it('should be able to resize column to the minWidth < defaultMinWidth', fakeAsync(() => {
const column = grid.getColumnByName('ID');
column.minWidth = 'a';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
[restrictHResizeMax]="colResizingService.restrictResizeMax"
[restrictHResizeMin]="colResizingService.restrictResizeMin"
[restrictResizerTop]="restrictResizerTop"
(resizeEnd)="colResizingService.resizeColumn($event)">
(resizeEnd)="colResizingService.resizeColumn($event, resizer.ratio)">
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ export class IgxColumnResizerDirective implements OnInit, OnDestroy {
@Output() public resize = new Subject<any>();

private _left: number;
private _ratio: number = 1;
private _destroy = new Subject<boolean>();

public get ratio(): number {
return this._ratio;
}

constructor(
public element: ElementRef<HTMLElement>,
@Inject(DOCUMENT) public document,
Expand All @@ -56,7 +61,7 @@ export class IgxColumnResizerDirective implements OnInit, OnDestroy {
.pipe(
takeUntil(this._destroy),
takeUntil<MouseEvent>(this.resizeEnd),
map((event) => event.clientX - offset),
map((event) => (event.clientX - offset) / (this._ratio)),
))
)
.subscribe((pos) => {
Expand Down Expand Up @@ -113,8 +118,12 @@ export class IgxColumnResizerDirective implements OnInit, OnDestroy {
public onMousedown(event: MouseEvent) {
event.preventDefault();
const parent = this.element.nativeElement.parentElement.parentElement;

this.left = this._left = event.clientX - parent.getBoundingClientRect().left;
const parentRectWidth = parent.getBoundingClientRect().width;
const parentComputedWidth = parseFloat(window.getComputedStyle(parent).width);
if (Math.abs(parentRectWidth - parentComputedWidth) > 1) {
this._ratio = parentRectWidth / parentComputedWidth;
}
this.left = this._left = (event.clientX - parent.getBoundingClientRect().left) / this._ratio;
this.top = (event.target as HTMLElement).getBoundingClientRect().top - parent.getBoundingClientRect().top;

this.resizeStart.next(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class IgxColumnResizingService {
* @hidden
*/
public getColumnHeaderRenderedWidth() {
return this.column.headerCell.nativeElement.getBoundingClientRect().width;
return parseFloat(window.getComputedStyle(this.column.headerCell.nativeElement).width);
}

/**
Expand Down Expand Up @@ -101,9 +101,9 @@ export class IgxColumnResizingService {
/**
* Resizes the column regaridng to the column minWidth and maxWidth.
*/
public resizeColumn(event: MouseEvent) {
public resizeColumn(event: MouseEvent, ratio: number = 1) {
this.showResizer = false;
const diff = event.clientX - this.startResizePos;
const diff = (event.clientX - this.startResizePos) / ratio;

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

0 comments on commit 4253fb3

Please sign in to comment.