Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destroy dropdown panel on close #286

Merged
merged 23 commits into from
Feb 26, 2018
Merged

destroy dropdown panel on close #286

merged 23 commits into from
Feb 26, 2018

Conversation

anjmao
Copy link
Member

@anjmao anjmao commented Feb 23, 2018

With this PR dropdown panel will be added to the DOM only when dropdown is opened.

@coveralls
Copy link

coveralls commented Feb 23, 2018

Coverage Status

Coverage decreased (-1.8%) to 89.003% when pulling c4f4b69 on destroy-dropdown into 713b20a on master.

@anjmao anjmao changed the title Destroy dropdown Destroy dropdown panel on close Feb 23, 2018
@anjmao anjmao changed the title Destroy dropdown panel on close feat: destroy dropdown panel on close Feb 23, 2018
@anjmao anjmao changed the title feat: destroy dropdown panel on close destroy dropdown panel on close Feb 23, 2018
(empty && this._isTypeahead && this.filterValue && !this.isLoading);
return ((empty && !this._isTypeahead && !this.loading) ||
(empty && this._isTypeahead && this.filterValue && !this.isLoading)) &&
!this.showAddTag();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test for this case

@@ -422,6 +406,13 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie
}
}

focusSearchInput() {
setTimeout(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is timeout needed?

@@ -0,0 +1,279 @@
import {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name it ng-dropdown-panel or just ng-dropdown since all such files have ng prefix

private _zone: NgZone,
private _virtualScrollService: VirtualScrollService
) {
this._inputElementRef = _ngSelect.elementRef;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it ng-select elementRef?

@Output() positionChange = new EventEmitter();

@ViewChild('content', { read: ElementRef }) contentElementRef: ElementRef;
@ViewChild('scroll', { read: ElementRef }) scrollElementRef: ElementRef;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add scrollEnd event and lazy loading example from #267 pr

}
}

ngOnChanges(changes: SimpleChanges) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method isn't tested

}

refresh() {
if (IS_TEST) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can anything else can be done here?

import { WindowService } from './window.service';

@Component({
providers: [VirtualScrollService],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here each component instance will have separate instance of VirtualScrollService, not sure if this is a good idea

const IS_TEST = process.env.NODE_ENV === 'TEST';

@Component({
providers: [VirtualScrollService],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here each component instance will have separate VirtualScrollService instance, not sure if it is good idea

@varnastadeus
Copy link
Member

Looks nice, great job!

@anjmao anjmao merged commit 14e1da5 into master Feb 26, 2018
@varnastadeus varnastadeus deleted the destroy-dropdown branch February 26, 2018 15:41
jakemdunn pushed a commit to jakemdunn/ng-select that referenced this pull request Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants