Skip to content

Commit 7f7d8d5

Browse files
Merge branch '19.2.x' into ganastasov/fix-15808-19.2
2 parents 8fc5566 + a2d1d38 commit 7f7d8d5

File tree

7 files changed

+96
-16
lines changed

7 files changed

+96
-16
lines changed

projects/igniteui-angular/src/lib/core/styles/components/drop-down/_drop-down-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
-webkit-overflow-scrolling: touch;
244244
position: relative;
245245

246-
igx-display-container {
246+
.igx-display-container--scrollbar {
247247
padding-inline-end: var(--vhelper-scrollbar-size);
248248
}
249249
}

projects/igniteui-angular/src/lib/core/styles/components/query-builder/_query-builder-theme.scss

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@
114114
%advanced-filter {
115115
@include sizable();
116116

117+
--tree-scrollbar-gutter: #{rem(16px)};
118+
119+
@if $variant == 'bootstrap' {
120+
--query-builder-outer-padding: #{rem(16px)};
121+
} @else {
122+
--query-builder-outer-padding: #{rem(24px)};
123+
}
124+
117125
width: auto;
118126
min-width: rem(660px);
119127
background-color: var-get($theme, 'background');
@@ -122,11 +130,19 @@
122130
overflow: hidden;
123131

124132
&:has(:not(igx-query-builder-header)) {
125-
padding-block-start: if($variant != 'bootstrap', rem(24px), rem(16px))
133+
padding-block-start: var(--query-builder-outer-padding);
134+
135+
%query-level-0 {
136+
padding-block: 0 var(--query-builder-outer-padding);
137+
}
126138
}
127139

128140
&:has(igx-query-builder-header) {
129141
padding-block-start: 0;
142+
143+
%query-level-0 {
144+
padding-block: if($variant != 'bootstrap', 0, rem(16px)) var(--query-builder-outer-padding);
145+
}
130146
}
131147

132148
.igx-chip__ghost {
@@ -145,10 +161,8 @@
145161
%query-level-0 {
146162
display: block;
147163
width: 100%;
148-
padding-inline: if($variant != 'bootstrap', rem(24px), rem(16px));
149-
padding-block:
150-
if($variant != 'bootstrap', 0, rem(16px))
151-
if($variant != 'bootstrap', rem(24px), rem(16px));
164+
165+
padding-inline: var(--query-builder-outer-padding);
152166

153167
> %advanced-filter__main {
154168
gap: rem(16px);
@@ -159,7 +173,7 @@
159173
max-height: rem(570px);
160174
overflow-y: auto;
161175
overflow-x: hidden;
162-
padding-inline-end: rem(16px);
176+
padding-inline-end: var(--tree-scrollbar-gutter);
163177
}
164178
}
165179
}
@@ -230,8 +244,8 @@
230244
margin-bottom: 0;
231245
border-block-end: rem(1px) solid var-get($theme, 'header-border');
232246

233-
padding-inline: if($variant != 'bootstrap', rem(24px), rem(16px));
234-
padding-block: if($variant != 'bootstrap', rem(24px), rem(16px)) rem(16px);
247+
padding-inline: var(--query-builder-outer-padding);
248+
padding-block: var(--query-builder-outer-padding) rem(16px);
235249
}
236250

237251
%advanced-filter__title {

projects/igniteui-angular/src/lib/directives/for-of/base.helper.component.ts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ import {
66
Directive,
77
AfterViewInit,
88
Inject,
9-
NgZone
9+
NgZone,
10+
Renderer2,
11+
PLATFORM_ID,
12+
inject
1013
} from '@angular/core';
1114
import { DOCUMENT } from '@angular/common';
1215
import { Subject } from 'rxjs';
1316
import { takeUntil, throttleTime } from 'rxjs/operators';
1417
import { resizeObservable, PlatformUtil } from '../../core/utils';
18+
import { isPlatformBrowser } from '@angular/common';
1519

1620
@Directive({
1721
selector: '[igxVirtualHelperBase]',
@@ -27,13 +31,16 @@ export class VirtualHelperBaseDirective implements OnDestroy, AfterViewInit {
2731
private _afterViewInit = false;
2832
private _scrollNativeSize: number;
2933
private _detached = false;
34+
protected renderer = inject(Renderer2);
35+
protected platformId = inject(PLATFORM_ID);
36+
protected ngZone = inject(NgZone);
3037

3138
constructor(
3239
public elementRef: ElementRef<HTMLElement>,
3340
public cdr: ChangeDetectorRef,
3441
protected _zone: NgZone,
3542
@Inject(DOCUMENT) public document: any,
36-
protected platformUtil: PlatformUtil,
43+
protected platformUtil: PlatformUtil
3744
) {
3845
this._scrollNativeSize = this.calculateScrollNativeSize();
3946
}
@@ -104,6 +111,34 @@ export class VirtualHelperBaseDirective implements OnDestroy, AfterViewInit {
104111
return this.document.body.contains(this.nativeElement);
105112
}
106113

114+
private toggleClass(element: HTMLElement, className: string, shouldHaveClass: boolean): void {
115+
if (shouldHaveClass) {
116+
this.renderer.addClass(element, className);
117+
} else {
118+
this.renderer.removeClass(element, className);
119+
}
120+
}
121+
122+
private updateScrollbarClass() {
123+
if (!isPlatformBrowser(this.platformId)) {
124+
return;
125+
}
126+
127+
this.ngZone.runOutsideAngular(() => {
128+
requestAnimationFrame(() => {
129+
const el = this.nativeElement;
130+
const hasScrollbar = el.scrollHeight > el.clientHeight;
131+
const prevSibling = el.previousElementSibling as HTMLElement | null;
132+
const scrollbarClass = 'igx-display-container--scrollbar';
133+
134+
if (prevSibling?.tagName.toLowerCase() === 'igx-display-container') {
135+
this.toggleClass(prevSibling, scrollbarClass, hasScrollbar);
136+
}
137+
});
138+
});
139+
}
140+
141+
107142
protected handleMutations(event) {
108143
const hasSize = !(event[0].contentRect.height === 0 && event[0].contentRect.width === 0);
109144
if (!hasSize && !this.isAttachedToDom) {
@@ -113,6 +148,8 @@ export class VirtualHelperBaseDirective implements OnDestroy, AfterViewInit {
113148
// attached back now.
114149
this.restoreScroll();
115150
}
151+
152+
this.updateScrollbarClass();
116153
}
117154

118155
protected restoreScroll() {}

projects/igniteui-angular/src/lib/directives/for-of/horizontal.virtual.helper.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ export class HVirtualHelperComponent extends VirtualHelperBaseDirective {
1919
@HostBinding('class')
2020
public cssClasses = 'igx-vhelper--horizontal';
2121

22-
constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, zone: NgZone, @Inject(DOCUMENT) document, platformUtil: PlatformUtil) {
22+
constructor(
23+
elementRef: ElementRef,
24+
cdr: ChangeDetectorRef,
25+
zone: NgZone,
26+
@Inject(DOCUMENT) document: any,
27+
platformUtil: PlatformUtil
28+
) {
2329
super(elementRef, cdr, zone, document, platformUtil);
2430
}
2531

projects/igniteui-angular/src/lib/directives/for-of/virtual.helper.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, ElementRef, HostBinding, Input, ViewChild, ViewContainerRef,
2-
ChangeDetectorRef, OnDestroy, OnInit, Inject, NgZone } from '@angular/core';
2+
ChangeDetectorRef, OnDestroy, OnInit, Inject, NgZone} from '@angular/core';
33
import { VirtualHelperBaseDirective } from './base.helper.component';
44
import { DOCUMENT } from '@angular/common';
55
import { PlatformUtil } from '../../core/utils';
@@ -21,7 +21,13 @@ export class VirtualHelperComponent extends VirtualHelperBaseDirective implement
2121
@HostBinding('class')
2222
public cssClasses = 'igx-vhelper--vertical';
2323

24-
constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, zone: NgZone, @Inject(DOCUMENT) document, platformUtil: PlatformUtil) {
24+
constructor(
25+
elementRef: ElementRef,
26+
cdr: ChangeDetectorRef,
27+
zone: NgZone,
28+
@Inject(DOCUMENT) document: any,
29+
platformUtil: PlatformUtil,
30+
) {
2531
super(elementRef, cdr, zone, document, platformUtil);
2632
}
2733

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {
1+
import { useAnimation } from '@angular/animations';
2+
import {
23
ChangeDetectionStrategy,
34
ChangeDetectorRef,
45
Component,
@@ -52,6 +53,7 @@ import { IgxFocusDirective } from '../directives/focus/focus.directive';
5253
import { IgxInputDirective } from '../directives/input/input.directive';
5354
import { IgxInputGroupComponent } from '../input-group/input-group.component';
5455
import { IgxChipComponent } from '../chips/chip.component';
56+
import { fadeOut, scaleInCenter } from 'igniteui-angular/animations';
5557

5658
/**
5759
* Providing reference to `IgxGridCellComponent`:
@@ -883,7 +885,9 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
883885
modal: false,
884886
positionStrategy: new AutoPositionStrategy({
885887
horizontalStartPoint: HorizontalAlignment.Center,
886-
horizontalDirection: HorizontalAlignment.Center
888+
horizontalDirection: HorizontalAlignment.Center,
889+
openAnimation: useAnimation(scaleInCenter, { params: { duration: '150ms' } }),
890+
closeAnimation: useAnimation(fadeOut, { params: { duration: '75ms' } })
887891
})
888892
}
889893
);

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { UIInteractions } from '../../test-utils/ui-interactions.spec';
1717
import { IGridFormGroupCreatedEventArgs } from '../common/grid.interface';
1818
import { IgxTreeGridComponent } from '../tree-grid/tree-grid.component';
1919
import { IgxGridComponent } from './grid.component';
20+
import { AutoPositionStrategy, HorizontalAlignment, IgxOverlayService, VerticalAlignment } from '../../services/public_api';
2021

2122
describe('IgxGrid - Validation #grid', () => {
2223

@@ -187,6 +188,18 @@ describe('IgxGrid - Validation #grid', () => {
187188
const erorrMessage = cell.errorTooltip.first.elementRef.nativeElement.children[0].textContent;
188189
expect(erorrMessage).toEqual(' Entry should be at least 4 character(s) long ');
189190

191+
const overlayService = TestBed.inject(IgxOverlayService);
192+
const info = overlayService.getOverlayById(cell.errorTooltip.first.overlayId);
193+
const positionSettings = info.settings.positionStrategy.settings;
194+
195+
expect(info.settings.positionStrategy instanceof AutoPositionStrategy).toBe(true);
196+
expect(positionSettings.horizontalStartPoint).toEqual(HorizontalAlignment.Center);
197+
expect(positionSettings.horizontalDirection).toEqual(HorizontalAlignment.Center);
198+
expect(positionSettings.verticalStartPoint).toEqual(VerticalAlignment.Bottom);
199+
expect(positionSettings.verticalDirection).toEqual(VerticalAlignment.Bottom);
200+
expect(positionSettings.openAnimation.options.params).toEqual({ duration: '150ms' });
201+
expect(positionSettings.closeAnimation.options.params).toEqual({ duration: '75ms' });
202+
190203
cell.errorTooltip.first.close();
191204
tick();
192205
fixture.detectChanges();

0 commit comments

Comments
 (0)