All Projects → msarsha → ng2-right-click-menu

msarsha / ng2-right-click-menu

Licence: other
Right click context menu for Angular 2+

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to ng2-right-click-menu

ctxmenu
Tiny and customizable context menu generator
Stars: ✭ 20 (-60.78%)
Mutual labels:  contextmenu, context-menu, right-click
rctx-contextmenu
✨ Context menu for React
Stars: ✭ 23 (-54.9%)
Mutual labels:  contextmenu, context-menu, right-click
vue3-context-menu
A very simple context menu component for Vue3 一个简洁美观简单的Vue3右键菜单组件
Stars: ✭ 74 (+45.1%)
Mutual labels:  contextmenu, context-menu
VirusTotalScanner
Scan suspicious applications with over 60 different anti-viruses with a mere two clicks and five seconds!
Stars: ✭ 18 (-64.71%)
Mutual labels:  contextmenu, context-menu
Open in Windows Terminal
No description or website provided.
Stars: ✭ 24 (-52.94%)
Mutual labels:  contextmenu, context-menu
xMenuTools
Extended context menu tools for Windows
Stars: ✭ 56 (+9.8%)
Mutual labels:  context-menu, right-click
Pie-Context-Menu
A Pie Context Menu for Web pages
Stars: ✭ 20 (-60.78%)
Mutual labels:  context-menu, right-click
awesome-angular
💖 A list of awesome Angular (2️⃣➕) resources
Stars: ✭ 61 (+19.61%)
Mutual labels:  angular2, angular2-directive
Context Menu.ios
You can easily add awesome animated context menu to your app.
Stars: ✭ 1,854 (+3535.29%)
Mutual labels:  contextmenu, context-menu
Ngcontextmenu
Handcraft your very own context menus for a richer UX!
Stars: ✭ 81 (+58.82%)
Mutual labels:  contextmenu, context-menu
ContextMenuSwift
A better version of iOS 13 Context Menu
Stars: ✭ 162 (+217.65%)
Mutual labels:  contextmenu, context-menu
JonContextMenu
A beautiful and minimalist arc menu like the Pinterest one, written in Swift
Stars: ✭ 60 (+17.65%)
Mutual labels:  contextmenu, context-menu
elm-contextmenu
Flexible context menu for Elm
Stars: ✭ 16 (-68.63%)
Mutual labels:  contextmenu, context-menu
ShellAnything
ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.
Stars: ✭ 103 (+101.96%)
Mutual labels:  contextmenu, context-menu
ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (-72.55%)
Mutual labels:  context-menu, right-click
ic-datepicker
Angular (2+) datepicker component
Stars: ✭ 27 (-47.06%)
Mutual labels:  angular2
angular-2-admin
An Angular 2 Admin Dashboard built using the Angular-CLI.
Stars: ✭ 65 (+27.45%)
Mutual labels:  angular2
UXsyncNow
UXstorm's ServiceNow file synchronizer / development tool
Stars: ✭ 23 (-54.9%)
Mutual labels:  angular2
cloud-speech-and-vision-demos
A set of demo applications that make use of google speech, nlp and vision apis based in angular2
Stars: ✭ 35 (-31.37%)
Mutual labels:  angular2
tech1-temple-javascript
JavaScript Proofs of Concepts repository. No Longer Supported
Stars: ✭ 61 (+19.61%)
Mutual labels:  angular2

ng2-right-click-menu

Right click context menu for Angular 2+

DEMO https://msarsha.github.io/ng2-right-click-menu/

Dependencies

@angular/cdk

@angular/cdk/overlay-prebuilt.css

Setup

npm install --save ng2-right-click-menu @angular/cdk

import ShContextMenuModule

import {ShContextMenuModule} from 'ng2-right-click-menu'

@NgModule({
  //...
  imports: [ShContextMenuModule]
  //...
})

import css file in your styles.css:

  @import "~@angular/cdk/overlay-prebuilt.css";

Usage

Defining a Basic Menu Template

The menu template is built using the sh-context-menu component as the menu wrapper, and nested ng-template with the shContextMenuItem directive for every menu item:

The shContextMenuItem directive provide a template variable (let-data) that gives you access to the data object attached to the menu.

<sh-context-menu #menu>
  <ng-template shContextMenuItem let-data (click)="onClick($event)">
    <div>
      Menu Item - {{data.label}}
    </div>
  </ng-template>
</sh-context-menu>

Attaching Menu To An Element

Attaching works by using the shAttachMenu directive and providing the #menu (from the above example) template variable:

The object provided to the [shMenuData] input will be available as a template variable inside ng-templates with shContextMenuItem

<div [shAttachMenu]="menu" [shMenuData]="data">Right Click Me</div>

Sub Menus

Sub menu is attached to the shContextMenuItem directive using the [subMenu] input.

The [subMenu] input is provided with a sh-context-menu's template variable (just like attaching a menu to an element).

<sh-context-menu #menu>
  <ng-template shContextMenuItem let-data [subMenu]="#nestedMenu">
    <div>
      Menu Item - {{data.label}}
    </div>
  </ng-template>
  <sh-context-menu #nestedMenu>
    <ng-template shContextMenuItem let-data>
      <div>
        Menu Item - {{data.label}}
      </div>
    </ng-template>
  </sh-context-menu>
</sh-context-menu>

API

sh-context-menu (component)

Name Type Default Description
[this] any null the this context for input callbacks (visible) - typically the menu's host component

shContextMenuItem (directive)

Name Type Default Description
[subMenu] ShContextMenuComponent null sub menu
[divider] boolean false render a divider
[closeOnClick] boolean true should the menu close on click
[visible] (event: ShContextMenuClickEvent) => boolean null function to determine if a item is visible
(click) (event: ShContextMenuClickEvent) => void null click handler

shAttachMenu (directive)

Name Type Default Description
[shAttachMenu] ShContextMenuComponent null the menu that will be attached to the element
[shMenuTriggers] string[] null list of event names that will trigger the menu
[shMenuData] any null the data object that will be injected to the menu item's template

Setting up development env

npm start to run the demo application

develop the library under /lib

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].