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

craft-table

v2.0.7

Published

table for angular2

Downloads

8

Readme

Crafte-table

Table UI for angular 2 that you can use it easily with component (style based on semantic ui) or you can custom it and make your own style. It support size and pagination.

It's still in active developement

Installation

npm install --save craft-table

you have to include semantic ui (css and js) and also jquery if you want to use craft-table component.

you need to import CFTableModule.

import { NgModule } from '@angular/core';
import { CFTableModule } from 'craft-table/craft-table';
import { AppComponent } from './app.component';

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

Getting started

There're 2 ways to use craft-table library.

1) Using craft-table by component.

app.component.html:

<cf-table [cfcontrol]="myTable"></cf-table>
<cf-pagination [cfpagination]="myTable.pagination" [(ngModel)]="currentPage" [class]="right"></cf-pagination>
<cf-sizination [cfsizination]="myTable.sizination" [(ngModel)]="currentSize"></cf-sizination>

app.component.ts:

import { Component } from '@angular/core';
import { CFTableControl,Ihead,Type } from 'craft-table';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  myTable:CFTableControl;
  header:Array<Ihead> = [
    {
      id:"member_code",
      type:Type.TEXT,
      label:"member code"
    },
    {
      id:"member_name",
      type:Type.TEXT,
      label:"member name"
    }
  ];
  data = [
    {
      member_code:"00001",
      member_name:"puttarak"
    },
    {
      member_code:"00002",
      member_name:"patty"
    },
    ...
   ];
   currentPage:number = 1;
   currentSize:number = 40;
   constructor(){
    this.myTable = new CFTableControl({
      header:this.header,
      navigating:true,
      date:this.data
    });
   }
}

2) Using craft-table by instantiate CFTableControl and make your own custom template.

your-own-table.comp.html:

  <table class="ui celled table">
    <thead>
      <th *ngFor="let header of cftable.getHead()"> 
          {{header.getLabel()}}
      </th>
    </thead>
    <tbody>
      <tr *ngFor="let row of cftable.getBodyRow() let i = index">
        <td *ngFor="let column of cftable.getColumn(i)">{{column.getValue()}} </td>
     </tr>
    </tbody>
  </table>

your-own-table.comp.ts:

import { Component } from '@angular/core';
import { CFTableControl,Ihead,Type } from 'craft-table';
@Component({
    selector: 'your-own-table',
    templateUrl: './your-own-table.comp.html',
    styleUrls:['./your-own-table.scss']
})
export class CFTableComp implements OnInit {
    cftable:CFTableControl;
    header:Array<Ihead> = [
      {
        id:"member_code",
        type:Type.TEXT,
        label:"member code"
      },
      {
        id:"member_name",
        type:Type.TEXT,
        label:"member name"
      }
    ];
    data = [
      {
        member_code:"00001",
        member_name:"puttarak"
      },
      {
        member_code:"00002",
        member_name:"patty"
      },
      ...
     ];
     constructor() {
        this.cftable =  new CFTableControl({
          header:this.header,
          navigating:true,
          date:this.data
        });
     }
}

Angular CLI configuration ( Webpack )

npm install jquery --save

Craft-table is based on Semantic UI (it's optional though). Download Semantic UI and add semantic.min.css, semantic.min.js, jquery to the angular-cli.json as follows:


...

"apps": [{
  ... 
  "styles": [
      "styles.css",
      "../path/to/semantic.min.css" // 
  ],
  "scripts": [
      "../node_modules/jquery/dist/jquery.min.js",
      "../path/to/semantic.min.js"
  ],
  ...
}]