Skip to content

Commit

Permalink
Disable combo checkbox animations on scroll (#3304)
Browse files Browse the repository at this point in the history
* fix(igx-combo): disable checkbox animations on scroll #3243

* refactor(igx-combo): remove bind, move prop #3243

* refactor(igx-cobmo): refactor method signiture #3243

* refactor(igx-combo): revert prev move of property #3243
  • Loading branch information
Lipata authored and rkaraivanov committed Dec 6, 2018
1 parent d8a4fa7 commit d615d5f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
ChangeDetectorRef, Component, ContentChild,
ElementRef, forwardRef, Inject, QueryList, EventEmitter, OnDestroy
ElementRef, forwardRef, Inject, QueryList, EventEmitter, OnDestroy, AfterViewInit
} from '@angular/core';
import { takeUntil, take } from 'rxjs/operators';
import { IgxComboItemComponent } from './combo-item.component';
Expand All @@ -18,7 +18,7 @@ import { Navigate } from '../drop-down/drop-down.common';
templateUrl: '../drop-down/drop-down.component.html',
providers: [{ provide: IgxDropDownBase, useExisting: IgxComboDropDownComponent }]
})
export class IgxComboDropDownComponent extends IgxDropDownBase implements OnDestroy {
export class IgxComboDropDownComponent extends IgxDropDownBase implements AfterViewInit, OnDestroy {
private _children: QueryList<IgxDropDownItemBase>;
private _scrollPosition = 0;
private destroy$ = new Subject<boolean>();
Expand Down Expand Up @@ -331,6 +331,14 @@ export class IgxComboDropDownComponent extends IgxDropDownBase implements OnDest
}

protected scrollToHiddenItem(newItem: any): void {}

/**
* @hidden
*/
protected scrollHandler = () => {
this.disableTransitions = true;
}

/**
* @hidden
*/
Expand Down Expand Up @@ -377,10 +385,15 @@ export class IgxComboDropDownComponent extends IgxDropDownBase implements OnDest
this.verticalScrollContainer.getVerticalScroll().scrollTop = this._scrollPosition;
}

public ngAfterViewInit() {
this.verticalScrollContainer.getVerticalScroll().addEventListener('scroll', this.scrollHandler);
}

/**
*@hidden
*/
public ngOnDestroy(): void {
this.verticalScrollContainer.getVerticalScroll().removeEventListener('scroll', this.scrollHandler);
this.destroy$.next(true);
this.destroy$.complete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class IgxComboItemComponent extends IgxDropDownItemBase {
*/
@HostListener('click', ['$event'])
clicked(event) {
this.dropDown.disableTransitions = false;
if (this.disabled || this.isHeader) {
const focusedItem = this.dropDown.focusedItem;
if (focusedItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
(onChunkPreload)="dataLoading($event)" #virtualScrollContainer>
<igx-combo-item [value]="item" isHeader={{item.isHeader}} role="option">
<ng-container *ngIf="!item.isHeader">
<igx-checkbox [checked]="isItemSelected(item)" disableRipple="true" disabled="true" class="igx-combo__checkbox"></igx-checkbox>
<igx-checkbox [checked]="isItemSelected(item)" disableRipple="true" [disableTransitions]="dropdown.disableTransitions" disabled="true" class="igx-combo__checkbox"></igx-checkbox>
</ng-container>
<ng-container *ngIf="item.isHeader">
<ng-container *ngTemplateOutlet="headerItemTemplate ? headerItemTemplate : headerItemBase; context: {$implicit: item, data: data, valueKey: valueKey, groupKey: groupKey, displayKey: displayKey}"></ng-container>
Expand Down
6 changes: 6 additions & 0 deletions projects/igniteui-angular/src/lib/drop-down/drop-down.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ export abstract class IgxDropDownBase implements OnInit, IToggleView {
return this.elementRef.nativeElement;
}

/**
* @hidden
* @internal
*/
public disableTransitions = false;

/**
* Get dropdown's html element of it scroll container
*/
Expand Down

0 comments on commit d615d5f

Please sign in to comment.