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

ngp-modal

v0.0.67

Published

- install

Downloads

212

Readme

ngp-modal

required

  • install
  npm i ngp-modal ngp-core bootstrap
  • bootstrap

insert in angular.json

            "styles": [
              "src/styles.css",
              "./node_modules/bootstrap/dist/css/bootstrap.min.css"
            ]

insert in your app.module.ts

    imports: [
  BrowserModule,
  AppRoutingModule,
  NgpModalModule,
  NgpCoreModule
]

Modal template builder

  • ngp-event: button close modal when clicked (shape cross if in ngp-header)
  • ngp-header: part of header
  • ngp-footer: part of footer
  • ngp-title: part of modal-title
  • ng-template in header/footer

Modal opener/closer

controller

ViewChild

export class ModalValidatorComponent implements OnInit {
  @ViewChild('modal')
  private modal?: ModalController;
  
  open(){ this.modal?.open() }
  close(){ this.modal?.close() }
}
<ngp-modal #modal></ngp-modal>

listener

import {BehaviorSubject} from 'rxjs';
import {ModalEventType} from './modal-event-type';

export class ModalValidatorComponent implements OnInit {
  listen = new BehaviorSubject<ModalEventType.OPEN | ModalEventType.CLOSE>(ModalEventType.CLOSE);

  open() {
    this.listen.next(ModalEventType.OPEN);
  }

  close() {
    this.listen.next(ModalEventType.CLOSE);
  }
}
<ngp-modal [listen]="listen"></ngp-modal>

validator

function load

  load(Observable)
  loading(boolean)

Modal

create modal dialog bootstrap

<ngp-modal footer-enable="false" close-enable="false" [listen]="observableOpenClose">
  <ng-container ngp-header>
    <div class="modal-title">
      title modal
    </div>
    <button (ngp-event)="closing($event)"></button> <!-- cross close -->
  </ng-container>
  any element insert in body
</ngp-modal>
<ngp-modal footer-enable="false" [listen]="observableOpenClose">
  <div ngp-title>title modal</div>
  any element insert in body
</ngp-modal>

modal-example.png

Modal validator

expose your request with 3 possibility accept/refuse/ignored

<ngp-modal-validator accept="Accept" refuse="Refused" (accepted)="receiveAccept($event)" (canceled)="receiveCancel($event)"
                     [listen]="observableOpenClose" ignored-enable="false">
  validator body
</ngp-modal-validator>

modal-validator-example.png

Modal Reducer

modal reducer, when reduce remove backdrop

<ngp-modal-reducer [listen]="observableOpenClose" [header-reduce]="headerReduce">
</ngp-modal-reducer>

<ng-template #headerReduce>
  modal header reduce
</ng-template>

modal-reduce-explode.png modal-reduce-reducing.png

Modal loader

open loader bootstrap round or circle

<ngp-loader></ngp-loader>

Event

type

  • OPEN => modal open
  • CLOSE => modal close
  • IGNORED => cross close for validator
  • ACCEPTED => valid validator
  • CANCELED => cancel validator
  • MAXIMIZED => click on maximize button for Reducer
  • MINIMIZED => click on minimize button for Reducer
  • LOADING => start load
  • FINISH => stop load

content

export interface ModalEvent<T extends ModalEventType> {
  type: T;
  name?: string; // id modal
}

listener event

  this.modalService.receiveEvent(): Observable<ModalEvent<ModalEventType>>
this.modalService.receiveValidator(): Observable<ModalEvent<ModalEventType.REFUSED | ModalEventType.ACCEPTED | ModalEventType.IGNORED>>
this.modalService.receiveLoad(): Observable<ModalEvent<ModalEventType.LOADING | ModalEventType.FINISH>>
this.modalService.receiveControl(): Observable<ModalEvent<ModalEventType.OPEN |ModalEventType.CLOSE>>
this.modalService.receiveReducer(): Observable<ModalEvent<ModalEventType.MAXIMIZED | ModalEventType.MINIMIZED>>

parameter

all parameters exist with format string: example > boolean = boolean | 'true' | 'false'

  • modal

name: ngp-modal

| name | type | description | default | |----------------------|------------------------|-------------------------------------------|---------| | title | string | title in header | | | style | string | put custom style on modal | '' | | id | string | id to modal | | | listen | Observable<OPEN/CLOSE> | could open and close modal | | | header | TemplateRef | template for header | | | event | signal | all interaction with modal | | | footer | TemplateRef | replace button close in footer | | | class | string | class add modal => .modal.add | '' | | body-enable | boolean | show body | true | | backdrop-enable | boolean | show backdrop | true | | event-service-enable | boolean | send event in modalService | true | | timeout | Timeout | time with unit to keep open modal | | | time | number | time to keep open modal default ms | | | unit | TimeoutUnit | unit to convert time | ms | | active | boolean | default open | false | | close-footer-enable | boolean | show button close in footer | true | | header-enable | boolean | show header | true | | close-enable | boolean | show cross in header | true | | decorator-enable | boolean | show only backdrop with transparent modal | false | | footer-enable | boolean | show footer | true | | center | boolean | center modal | true | | scrollable | boolean | content is scrollable | false |

  • validator

name: ngp-modal-validator

| name | type | description | default | |----------------|------------------------|--------------------------------|---------| | accepted | signal | click on button accept | | | canceled | signal | click on button cancel | | | ignored | signal | click on button ignored | | | accept | string | label button accepted | ok | | cancel | string | label button canceled | cancel | | ignored-enable | boolean | enable cross button to ignored | true | | title | string | title in header | | | id | string | id to modal | | | listen | Observable<OPEN/CLOSE> | could open and close modal | | | header | TemplateRef | template for header | | | class | string | class add modal => .modal.add | '' | | body-enable | boolean | show body | true | | event | send ModalEvent object | all interaction with modal | | | header-enable | boolean | show header | true | | active | boolean | default open | false | | center | boolean | center modal | true | | scrollable | boolean | content is scrollable | false |

  • reducer

name: ngp-modal-reducer

| name | type | description | default | |---------------------|------------------------|--------------------------------|---------| | title-reduce | string | title show when reduce | | | header-reduce | TemplateRef | template show when reduce | | | reducing | Event | throw when reduce modal | | | expanding | Event | throw when expand modal | | | title | string | title in header | | | id | string | id to modal | | | listen | Observable<OPEN/CLOSE> | could open and close modal | | | header | TemplateRef | template for header | | | class | string | class add modal => .modal.add | '' | | event | signal | all interaction with modal | | | footer | TemplateRef | replace button close in footer | | | active | boolean | default open | false | | footer-enable | boolean | show footer | true | | center | boolean | center modal | true | | scrollable | boolean | content is scrollable | false | | close-footer-enable | boolean | show button close in footer | true | | close-enable | boolean | show cross in header | true |