-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Feature : Add virtual scroll on Tree Select Component #13771
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c1f8afc
Add virtual scroll inputs to tree select
GaetanRouzies a829b9b
Improve TreeSelect Virtual Scroll doc
GaetanRouzies c9a5a6b
Add css when treeselect has virtual scroll enabled
GaetanRouzies 7bd96a5
Remove unused @Input()
GaetanRouzies 26725b6
Merge branch 'master' into master
GaetanRouzies 0f8e514
Clean getDynamicTreeNodes function and fix virtual scroll item size
GaetanRouzies 3e6a4fb
Update treeselect.css
cetincakiroglu 250509e
Update treeselect.ts
cetincakiroglu 82a18b1
Update virtualscrolldoc.ts
cetincakiroglu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { Code } from '../../domain/code'; | ||
import { NodeService } from '../../service/nodeservice'; | ||
|
||
@Component({ | ||
selector: 'virtual-scroll-doc', | ||
template: ` <section class="py-3"> | ||
<app-docsectiontext [title]="title" [id]="id"> | ||
<p>VirtualScrolling is an efficient way of rendering the options by displaying a small subset of data in the viewport at any time. When dealing with huge number of options, it is suggested to enable VirtualScrolling to avoid performance | ||
issues. Usage is simple as setting <i>virtualScroll</i> property to true and defining <i>virtualScrollItemSize</i> to specify the height of an item.</p> | ||
</app-docsectiontext> | ||
<div class="card flex justify-content-center"> | ||
<p-treeSelect class="w-full md:w-20rem" containerStyleClass="w-full" [(ngModel)]="selectedNodes" [options]="nodes" display="chip" [metaKeySelection]="false" selectionMode="checkbox" placeholder="Select Item" | ||
[virtualScroll]="true" [virtualScrollItemSize]="46" [virtualScrollOptions]="{ scrollHeight: '200px' }"></p-treeSelect> | ||
</div> | ||
<app-code [code]="code" selector="tree-select-virtual-scroll-demo"></app-code> | ||
</section>` | ||
}) | ||
export class VirtualScrollDoc { | ||
@Input() id: string; | ||
|
||
@Input() title: string; | ||
|
||
nodes!: any[]; | ||
|
||
selectedNodes: any; | ||
|
||
constructor(private nodeService: NodeService) { | ||
this.nodeService.getLargeTreeNodes().then((files) => (this.nodes = files)); | ||
} | ||
|
||
code: Code = { | ||
basic: `<p-treeSelect class="w-full md:w-20rem" containerStyleClass="w-full" [(ngModel)]="selectedNodes" [options]="nodes" display="chip" [metaKeySelection]="false" selectionMode="checkbox" placeholder="Select Item" [virtualScroll]="true" [virtualScrollItemSize]="46" [virtualScrollOptions]="{scrollHeight: '200px'}"></p-treeSelect>`, | ||
html: ` | ||
<div class="card flex justify-content-center"> | ||
<p-treeSelect class="w-full md:w-20rem" containerStyleClass="w-full" [(ngModel)]="selectedNodes" [options]="nodes" display="chip" [metaKeySelection]="false" selectionMode="checkbox" placeholder="Select Item" [virtualScroll]="true" [virtualScrollItemSize]="46" [virtualScrollOptions]="{scrollHeight: '200px'}"></p-treeSelect> | ||
</div>`, | ||
typescript: ` | ||
import { Component } from '@angular/core'; | ||
import { NodeService } from '../../service/nodeservice'; | ||
|
||
@Component({ | ||
selector: 'tree-select-virtual-scroll-demo', | ||
templateUrl: './tree-select-virtual-scroll-demo.html' | ||
}) | ||
export class TreeSelectVirtualScrollDemo { | ||
nodes!: any[]; | ||
|
||
selectedNodes: any; | ||
|
||
constructor(private nodeService: NodeService) { | ||
this.nodeService.getLargeTreeNodes().then((files) => (this.nodes = files)); | ||
} | ||
}`, | ||
|
||
service: ['NodeService'], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not wrong this styles themes should be in
primeng-sass-theme
project: https://github.com/primefaces/primeng-sass-theme/Maybe @cetincakiroglu can confirm you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can i have a confirmation ?