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

tni-datagrid

v1.0.17

Published

An datagrid external library to be used for various projects which needs datagrid data display.

Downloads

4

Readme

An datagrid external library to be used for various projects which needs datagrid data display.

Table of contents

  1. Updates
  2. Getting Started
  3. Installation instructions
  4. Usage
  5. Contributing

Updates

1.0.17 - Work on DialogModal of deletion and configurin readme.md with some additional info;

Getting started

tni-datagrid contains a datagrid component library which works with pagination at the database level. It requires some extra packages, so they have to be installed as well.

Installation instructions

Install tni-library from npm

npm install tni-datagrid --save

You will need bootstrap styles (Bootstrap 3)

<!-- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

Or Bootstrap 4

<!--- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">

You will also need FontAwesome

<!--- index.html -->
<script defer src="https://use.fontawesome.com/releases/v5.0.10/js/all.js" integrity="sha384-slN8GvtUJGnv6ca26v8EzVaR9DC58QEwsIk9q1QXdCU8Yu8ck/tL/5szYlBbqmS+" crossorigin="anonymous"></script>

Usage

Import TniDatagridModule into your app.module project

import { TniDatagridModule } from 'tni-datagrid';

Than make an reference to the module

@NgModule(
    ...
    imports: [TniDatagridModule]
);

Into component html make reference to grid

  <tni-datagrid [Info]="infoDatagrid" [Columns]="columns" [DataSource]="storages" 
    [ShowDelete]=true
    (RefreshAction)="refresh()" (RecordAction)="recordAction($event)">
  </tni-datagrid>

Now, into your component ts make some imports from the module:

import { DataColumn, DataRow, eRecordAction, Info } from 'tni-datagrid';

Define info of the grid

  private infoDatagrid: Info;

Define columns configuration

columns: Array<DataColumn> = [
    {
      Key: "Title", Title: "Denumire",
      Link:
        {
          Action: eRecordAction.Detail
        }
    },
    { Key: "Path", Title: "Cale", Link: { Action: eRecordAction.Detail } },
    { Key: "Quota", Title: "Capacitate", Link: { Action: eRecordAction.Detail } },
    { Key: "Free", Title: "Liber", Link: { Action: eRecordAction.Detail } },
    { Key: "StrDate", Title: "Data", Link: { Action: eRecordAction.Detail } },
    { Key: "StrActive", Title: "Activ", Link: { Action: eRecordAction.Detail } },
  ];

on ngOnInit

ngOnInit() {
    this.infoDatagrid = new Info();
    this.infoDatagrid.Title = "Medii stocare";
    this.infoDatagrid.Friendly = "Title";
    //Title of the grid, will be shown at least in modal dialog of deletion
    //Friendly if specified indicate the column which will be used to display data on modal when deleting;
  }

Handle the record action triggered by grid

recordAction(dataRow: DataRow) {
    switch (dataRow.Link.Action) {
      case eRecordAction.Detail:
        //navigate to an detail component
        break;
      case eRecordAction.Delete:
        //call service to destroy the record
        break;
    }
  }

Translation can be proposed

    this.translationGrid = new Translation();
    this.translationGrid.Cancel = "Renunta";
    this.translationGrid.Commands = "Comenzi";
    this.translationGrid.Delete = "Sterge";
    this.translationGrid.DeleteConfirmationMessage = "Confirmati stergerea inregistrarii?";
    this.translationGrid.DisplayPage = "afiseaza pagina";
    this.translationGrid.FilterTooltip = "Arata filtrele pe datele curente";
    this.translationGrid.Records = "inregistrari";
    this.translationGrid.TotalRecords = "Total inregistrari";

Contribution

Are very welcome, thanks in advance!