-
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(context-menu): add scroll strategy provider (#541)
- Loading branch information
Igor Milly
authored and
GitHub Enterprise
committed
Mar 14, 2022
1 parent
7eb4634
commit 10d6c2d
Showing
7 changed files
with
110 additions
and
11 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.
14 changes: 14 additions & 0 deletions
14
.../context-menu-scroll-strategy-provider/context-menu-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,14 @@ | ||
<nx-context-menu #menu="nxContextMenu"> | ||
<button nxContextMenuItem type="button">Settings</button> | ||
<button nxContextMenuItem type="button">Download</button> | ||
<button nxContextMenuItem type="button">Help</button> | ||
</nx-context-menu> | ||
|
||
<button | ||
nxIconButton="tertiary small" | ||
[nxContextMenuTriggerFor]="menu" | ||
aria-label="Open menu" | ||
type="button" | ||
> | ||
<nx-icon aria-hidden="true" name="ellipsis-h"></nx-icon> | ||
</button> |
24 changes: 24 additions & 0 deletions
24
...nu/context-menu-scroll-strategy-provider/context-menu-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_CONTEXT_MENU_SCROLL_STRATEGY } from '@aposin/ng-aquila/context-menu'; | ||
|
||
function scrollStrategyFactory(overlay: Overlay): () => ScrollStrategy { | ||
return () => overlay.scrollStrategies.close({ threshold: 100 }); | ||
} | ||
|
||
/** | ||
* @title Scroll Strategy Provider Example | ||
*/ | ||
@Component({ | ||
selector: 'context-menu-scroll-strategy-provider-example', | ||
templateUrl: './context-menu-scroll-strategy-provider-example.html', | ||
styleUrls: ['./context-menu-scroll-strategy-provider-example.css'], | ||
providers: [ | ||
{ | ||
provide: NX_CONTEXT_MENU_SCROLL_STRATEGY, | ||
useFactory: scrollStrategyFactory, | ||
deps: [Overlay], | ||
}, | ||
], | ||
}) | ||
export class ContextMenuScrollStrategyProviderExampleComponent {} |
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