-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dropdown): add scroll strategy provider (#533)
- Loading branch information
Igor Milly
authored and
GitHub Enterprise
committed
Mar 14, 2022
1 parent
3861518
commit bc1ae19
Showing
8 changed files
with
80 additions
and
2 deletions.
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
Empty file.
13 changes: 13 additions & 0 deletions
13
...dropdown/dropdown-scroll-strategy-provider/dropdown-scroll-strategy-provider-example.html
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,13 @@ | ||
<div nxLayout="grid"> | ||
<div nxRow> | ||
<div nxCol="12, 12, 6"> | ||
<nx-formfield nxLabel="Fruit"> | ||
<nx-dropdown> | ||
<nx-dropdown-item nxValue="Apple"></nx-dropdown-item> | ||
<nx-dropdown-item nxValue="Orange"></nx-dropdown-item> | ||
<nx-dropdown-item nxValue="Pear"></nx-dropdown-item> | ||
</nx-dropdown> | ||
</nx-formfield> | ||
</div> | ||
</div> | ||
</div> |
24 changes: 24 additions & 0 deletions
24
...s/dropdown/dropdown-scroll-strategy-provider/dropdown-scroll-strategy-provider-example.ts
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,24 @@ | ||
import { Overlay, ScrollStrategy } from '@angular/cdk/overlay'; | ||
import { Component } from '@angular/core'; | ||
import { NX_DROPDOWN_SCROLL_STRATEGY } from '@aposin/ng-aquila/dropdown'; | ||
|
||
function scrollStrategyFactory(overlay: Overlay): () => ScrollStrategy { | ||
return () => overlay.scrollStrategies.close({ threshold: 100 }); | ||
} | ||
|
||
/** | ||
* @title Scroll Strategy Provider Example | ||
*/ | ||
@Component({ | ||
selector: 'dropdown-scroll-strategy-provider-example', | ||
templateUrl: './dropdown-scroll-strategy-provider-example.html', | ||
styleUrls: ['./dropdown-scroll-strategy-provider-example.css'], | ||
providers: [ | ||
{ | ||
provide: NX_DROPDOWN_SCROLL_STRATEGY, | ||
useFactory: scrollStrategyFactory, | ||
deps: [Overlay], | ||
}, | ||
], | ||
}) | ||
export class DropdownScrollStrategyProviderExampleComponent {} |
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