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

sdc-table

v0.5.4

Published

A versatile table module

Downloads

2

Readme

SDC Table

SDC Table is a versatile table module made with Angular Material 2's md-table.

Getting Started

Inputs:

displayObjects: Array<Object>      // Array of Objects to be displayed in table form
headings: Array<{               // Array of Objects with some details on how to display the objects.
    heading: "column heading",
    sortable?: boolean,         // determines if the column should be sorted on column header click
    filterable?: boolean,       // determines if this field should be included in filter searching
    editable?: boolean,         // enable inline editing on individual column
    key: string                 // where in the Objects to look for the value to fill this cell.
}>                              // Include one entry per column desired with the following fields
    
    (If excluded all keys will be displayed with heading title of their key name)
tableProperties: {                                              // object with more information for displaying the table.
        accordian: boolean = false,                             // true enables row expansion
        modal: boolean = false,                                 // true enables popup modal on row click
        pagination: {                                           // pagination settings
            supported: boolean = true,                                      
            itemsPerPage: number = 5,
            pageSizeOptions: Array<number> = [5, 10, 25, 50]
        },
        maxHeight?: number,                                     // max height of the table in pixels
        elevation: boolean = true,                              // true activates class mat-elevation-z8
        inlineEditing: boolean = true,                          // true enable inline editing on all cells
        headingStyles: Array<string>,
        tableStyles: Array<string>,
        headingCss: Array<string>,
        tableCss: Array<string>
    }                                                           //if anything not provided, default values in effect
factory: ComponentFactory;
    build this by using ComponentFactoryResolver to resolve the component of your choice. that component will need to be included in entryComponents of the module it's declared in.

Outputs:

change: {
    data: any,      // whatever was emitted from your component
    index: number   // the index in the array that the component was opened with.
}
    Any changes emitted from your component in the accordian or modal will be emitted from this output as well with in the form of this object

Using Accordian Rows

The component to expand must be included in the entry components of the module so that you can build a factory for it and pass that to sdc-table

In Wrapper Component:

import ( YourComponent ) from '...'
...
private factory: ComponentFactory;
...
constructor(... , private resolver: ComponentFactoryResolver) {
    this.factory = this.resolver.resolve(YourComponent);
}

In Wrapper Template:

<sdc-table ... [factory]="factory" (change)=handleChangeEvent($event)></sdc-table>

In Expanding Component

@Input() data: any;
@Output() change: EventEmitter<any> = new EventEmitter<any>();

Your component will be handed the Object in the array that was clicked on through the input 'data'.

Any changes you would like to pass up to your wrapper component should be output as changes, these will be forwarded up to the wrapped where you can modify the table data as you wish.

Using Inline Editing

changes will be emitted to change in the following object

{
    data: Object    // your updated objects
    index: numebr   // index in the input array that was edited
}

just include set the property inlineEditing to true in the tableProperties input or set editable to true on individual headings.

Authors

  • Robert Skakic - Initial work

  • Mark Joaquim - Initial work

License

Acknowledgments