npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gmrs/window-menu-gmr

v0.0.6

Published

ventana de menu con N niveles

Downloads

2

Readme

Window-menu-gmr

Ventana de menu aplicable a cualquier etiqueta html con N niveles de ventanas para angular 7 en adelante

Installation

Esta version requiere de Node.js v4+ para correr.

Instale las dependencias e inicie el servidor.

$ cd <tuProyecto>
$ npm install @gmrs/window-menu-gmr
$ ng serve

Modelos e Interfaces

Los modelos son clases que contiene la libreria

export class WindowMenuModel {
  //Variable que contiene la lista de opciones para el menu
  private items: WindowItemModel[];

  //metodo que agrega una opcion nueva al menu con su funcion Clic
  addItemWithFunction
  (btnName: string, functionClick: (btnName?: string) => void)
  : WindowMenuModel;
  
  //metodo que agrega una opcion nueva al menu que al dar clic abrira otro nuevo menu
  addItemWithNewMenu(btnName: string): WindowMenuModel;

  //metodo que retorna la posicion de la ventana buscandolo por su nombre
  getItemMenuModelName(btnName: string): WindowMenuModel;

  //metodo que agrega una lista de WindowItemModel
  set setWindowItemsModel(items: WindowItemModel[]);

  //metodo que retorna toda la lista de WindowItemModel 
  get getWindowItemsModel();
}

interface WindowModel { windowMenuModel: WindowMenuModel; }

interface FunctionModel { function: (btnName?: string) => void; }

export interface WindowItemModel {
  btnName: string;
  clickEvent: FunctionModel | WindowModel;
}

Inputs y Outputs

A continuacion se describen los inputs y outputs de la librería

| Inputs | Descripción | | ------ | ------ | | @Input() windowMenuModel: WindowMenuModel | Es obligatorio mandar la lista de menus para que se puedan ver con el modelo WindowMenuModel |

| Outputs | Descripción | | ------ | ------ | | n/a | ... |

Como usar

Import => import { WindowMenuGmrModule } from '@gmrs/window-menu-gmr';

Implementar el modulo WindowMenuGmrModule dentro de tu modulo principal y en en el HTML poner la etiqueta window-menu-gmr

<window-menu-gmr></window-menu-gmr>

en el TS generar la lista para crear el menu como en el ejemplo:

  • Vertebrates
    • Fishes
      • Baikal oilfish
      • Bala shark
      • Ballan wrasse
      • Bamboo shark
      • Banded killifish
    • Amphibians
      • Sonoran desert toad
      • Western toad
      • Arroyo toad
      • Yosemite toad
  • Invertebrates
    • Insects
    • Molluscs
    • Crustaceans
    • Corals
    • Arachnids
    • Velvet worms
    • Horseshoe crabs
this.windowMenuModel = new WindowMenuModel();
    windowMenuModel.addItemWithNewMenu('Vertebrates')
      .addItemWithNewMenu('Fishes')
      .addItemWithFunction('Baikal oilfish', this.clickEvent)
      .addItemWithFunction('Bala shark', this.clickEvent)
      .addItemWithFunction('Ballan wrasse', this.clickEvent)
      .addItemWithFunction('Bamboo shark', this.clickEvent)
      .addItemWithFunction('Banded killifish', this.clickEvent);

    windowMenuModel.getItemMenuModelName('Vertebrates')
      .addItemWithNewMenu('Amphibians')
      .addItemWithFunction('Sonoran desert toad', this.clickEvent)
      .addItemWithFunction('Western toad', this.clickEvent)
      .addItemWithFunction('Arroyo toad', this.clickEvent)
      .addItemWithFunction('Yosemite toad', this.clickEvent);
      
    windowMenuModel.addItemWithNewMenu('Invertebrates')
      .addItemWithFunction('Insects', this.clickEvent)
      .addItemWithFunction('Molluscs', this.clickEvent)
      .addItemWithFunction('Crustaceans', this.clickEvent)
      .addItemWithFunction('Corals', this.clickEvent)
      .addItemWithFunction('Arachnids', this.clickEvent)
      .addItemWithFunction('Velvet worms', this.clickEvent)
      .addItemWithFunction('Horseshoe crabs', this.clickEvent);
      
    //generar una funcion para prueba
    clickEvent(btnName: string) {
        console.log(btnName);
    }

agregar la variable windowMenuModel con la lista creada al input de la etiqueta window-menu-gmr y asignarle una variable a la etiqueta con el #. Donde se va a usar el menu al dar clic se tiene que agregar como input matMenuTriggerFor y pasarle el parentMenu de window-menu-gmr para que este funcione.

<window-menu-gmr [windowMenuModel]="windowMenuModel" #appWindowMenu></window-menu-gmr>

<button [matMenuTriggerFor]="appWindowMenu.parentMenu"> click</button>

nota: si trae errores al compilar, agregar en su modulo del proyecto el MatMenuModule.