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

rl-dialogs

v2.0.1

Published

This library is used to display custom Angular components as a dialog in Angular 12+ applications.

Downloads

4

Readme

RL Dialogs

This library is used to display custom Angular components as a dialog in Angular 12+ applications.

Installation

The library can be installed via npm:

npm install rl-dialogs --save

Usage

Add DialogsModule to your Angular module imports:

import { DialogsModule } from 'rl-dialogs'

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    DialogsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Dialog Anchor

Place the dialog anchor in the root of your app (app.component for example):

<div *rlDialogsAnchor></div>

Custom Dialog

To render your custom component as a dialog, create a new Angular component and extend it from the base dialog class DialogComponent. The base class provides all the required functionality to show/hide the dialog, set animation duration and so on. As result, you only need to implement the component template.

@Component({
  selector: 'app-dialog',
  templateUrl: './dialog.component.html',
  styleUrls: ['./dialog.component.scss']
})
export class Dialog extends DialogComponent {

  constructor(protected dialogRef: ElementRef) {
    super(dialogRef)
  }

}

Dialog component API

Properties

| Property | Type | Default | Description | | ------------- | ---- | ------- | ----------- | | animationDuration | number | 700 | Duration of the dialog show/hide animation in milliseconds. Use setAnimationDuration to set the duration after a dialog is created. | | position | DialogPosition | DialogPosition.Center | Dialog position on the screen. The possible options are DialogPosition.Left, DialogPosition.Right, DialogPosition.Center | | data | any | null | Data which can be passed to the dialog. Accessible after the dialog creation, so you should use NgOnInit lifecycle hook to initialize your component with a given data |

Methods

| Method | Description | | ------------- | ----------- | | setAnimationDuration | Sets the show/hide dialog animation duration in milliseconds | | hide | Hides the dialog |

Show a dialog using DialogsService

Use DialogsService.show() method to show the dialog:

dialogService.show<DialigOutputData>(id: string, dialogType: Type<IDialog>, data: any, options: IDialogOptions, injector: Injector): Promise<DialigOutputData | undefined>
Options

| Property | Type | Required | Description | | ------------- | ---- | ------- | ----------- | | id | string | true | Dialog ID. Can be generated using the static method DialogComponent.generateId() | | dialogType | Type | true | Dialog position on the screen. The possible options are DialogPosition.Left, DialogPosition.Right, DialogPosition.Center | | data | any | false | Data which can be passed to the dialog. Accessible after the dialog creation, so you should use NgOnInit lifecycle hook to initialize your component with a given data | | options | IDialogOptions | false | Dialog options, see the description below | | injector | Injector | false | Angular Injector. Can be provided to override a dialog dependencies |

IDialogOptions

| Property | Type | Default | Description | | ------------- | ---- | ------- | ----------- | | overlay | boolean | false | Defines whether to display dialog overlay or not. | | position | DialogPosition | DialogPosition.Center | Dialog position on the screen. The possible options are DialogPosition.Left, DialogPosition.Right, DialogPosition.Center | | closeOnClickOutside | boolean | false | Defines whether a dialog should be closed on click outside or not |

Close a dialog using DialogsService

To close a dialog using the service:

dialogService.close(id: string)

Close all the open dialogs using DialogsService

To close a dialog using the service:

dialogService.closeAll()

Overlay Customization

You can override the overlay class rl-overlay to customize the background color or other CSS properties.

Scrolling inside the dialog (iOS)

To disable body scrolling on iOS, the library prevents touchmove events, so scrolling on a child element in the dialog is also disabled. To enable scrolling on a child element in iOS, apply rl-dialog-scrollable class to the element.