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 🙏

© 2026 – Pkg Stats / Ryan Hefner

simpleng

v0.2.1

Published

SimpleNG is Angular library that contains several simple and easy-to-use components

Readme

SimpleNG Library

npm version

SimpleNG is Angular library that contains simple and easy-to-use components. Bootstrap css classes are used in the UI; however, the customization is possible by using component-specific css classes.

Available Components

  • Table
  • Alert

Dependencies

Angular 5+

Install

npm install simpleng --save

Setup

import { SimpleNGModule } from 'simpleng';

@NgModule({
  ...
  imports: [
    ...
    SimpleNGModule,
  ],
})
export class AppModule {}

Global configurations can be provided by importing SimpleNGModule.configure({...})

import { SimpleNGModule } from 'simpleng';

@NgModule({
  ...
  imports: [
    ...
    SimpleNGModule.configure({
      table: {...},
      pagination: {...},
      alert: {...}
    }),
  ],
})
export class AppModule {}

Table

SNGTable is a component that renders html table, with sorting and pagination user interface. Data should be passed manually instead of slicing and sorting them internally.

Usage

<sng-table (pageChange)="loadData($event)">
  <sng-table-column>
    <th *sngTableHeader>ID</th>
    <td *sngTableRow="let row">{{ row.id }}</td>
  </sng-table-column>
  <sng-table-column sort="title">
    <th *sngTableHeader>Title</th>
    <td *sngTableRow="let row">{{ row.title }}</td>
  </sng-table-column>
  <sng-table-column sort="body">
    <th *sngTableHeader>Body</th>
    <td *sngTableRow="let row">{{ row.body }}</td>
  </sng-table-column>
</sng-table>
@ViewChild(SNGTableComponent) table: SNGTableComponent<any>;
...
loadData(page: SNGTablePage) {
  this.dummyService.getPagedDummyData(
    page.pageNumber,
    page.pageSize,
    page.sortProp,
    page.sortDirection
  ).subscribe(pageResponse => {
    this.table.updateByPageResponse(pageResponse);
  });
}

SNGTableComponent instance should be updated after fetching new data. If the response comes as PageResponse object. Table properties can be updated by calling SNGTableComponent.update(data: T[], pageNumber?: number, pageSize?: number, totalRecords?: number). If the response comes as PageResponse object, a shorthand method can be used instead SNGTableComponent.updateByPageResponse(page).

SNGTableComponent.page contains current page properties. Note that Initial table page object is available in the lifecycle hook ngAfterViewInit().

import { AfterViewInit } from '@angular/core';
...
export class AppComponent implements AfterViewInit {
    @ViewChild(SNGTableComponent) table: SNGTableComponent<any>;
		...
    ngAfterViewInit() {
        this.loadData(this.table.page); // Initial load
    }
}

Pagination

Table components will render the pagination by default. It can be disabled by setting pagination="none" attribute to the component.

<sng-table pagination="none">
  ...
</sng-table>

Configurations

SNGTable component instance can be configured individually by passing [config] for table configuration, and [paginationConfig] for pagination configuration.

<sng-table [config]="{...}" [paginationConfig]="{...}">
  ...
</sng-table>

Table Options

| Option | Type | Default | Description | | ----------------- | ------- | ------- | ------------------------------------------------------------ | | responsive | boolean | true | Make the table responsive by adding responsive bootstrap class to the component | | style | object | ↓ | Object containing several options to style the table | | style.tableStyle | string | default | Table style which accepts one of the following values: default, bordered, borderless | | style.tableTheme | string | default | Table background color which accepts the following values: default, dark, light | | style.headerTheme | string | default | Table header background color which accepts the following values: default, dark, light | | style.small | boolean | false | true makes the table compact | | style.striped | boolean | false | Striped table rows | | style.hover | boolean | false | Highlight a row when hovering |

Pagination Options

| Option | Type | Default | Description | | :-------------- | -------- | ------------------ | ------------------------------------------------------------ | | zeroBased | boolean | true | Page data will start from zero | | pageSizes | string[] | [10, 50, 100, 200] | Page size options to allow users picking one of them | | visiblePages | number | 5 | Maximum number of pagination buttons that appears to the user | | defaultPageSize | number | 50 | Default page size |

Alert

SNGAlert makes it easy to show bootstrap alerts with different level using SNGAlertService.

Usage

<sng-alert context="general"></sng-alert>
// Injecting SNGAlertService
constructor(private alertService: SNGAlertService) { }
...
showMessage() {
    // Display success message in 'general' alert
    this.alertService.success('Success message', 'general');
    // Adding visibility timeout to the alert in millis
    this.alertService.warning('Warning message', 'general', 1000);
}
...
clearMessage() {
    this.alertService.clear('general');
}

context is optional. If not provided, the alert service will notify the components with no context. Available levels are success, warning, error, info.

Alerts can be sticky, remains at the top of the viewport, if sticky flag is set to true. Also, more than one alert message can appear at the same time in the same SNGAlertComponent instance by setting multi to true.

<sng-alert [sticky]="true" [multi]="true"></sng-alert>

Alert messages can be mapped to something else by creating a service that implements SNGAlertMessagesMapper and then injecting it with SNG_ALERT_MESSAGES_MAPPER token.

  ...
  providers: [
    { provide: SNG_ALERT_MESSAGES_MAPPER, useClass: AlertLocalizedMessages }
  ]
})
export class AppModule {}

Example of mapper service

@Injectable()
export class AlertLocalizedMessages implements SNGAlertMessagesMapper {

  private translations: any;

  constructor(@Inject(LOCALE_ID) localeId: string) {
    // Load translations
  }

  // Return translated message, for example
  getMessage(message: SNGAlertMessage): string {
    return this.translations[message];
  }

}

Configurations

SNGAlert component can be configured individually by passing [config] for alert configuration.

<sng-alert [config]="{...}"></sng-alert>

Options

| Option | Type | Default | Description | | ------------------ | ------- | ------- | ---------------------------------------------------- | | dismissable | boolean | true | Adds dismiss button on each alert | | animation | boolean | true | Enables show/hide animation | | style | object | ↓ | Object containing several options to style the table | | style.stickyShadow | boolean | true | Activates the shadow when alerts sticks at the top |