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

moonshield-table

v1.0.26

Published

A table react component that will be used into the HRnet application

Downloads

63

Readme

Moonshield-Table

Created by Moonshield for the HRnet project - January 2024

This component has been created to replace a jQuery library used in the previous version of the HRnet application. It can however be used in any React application, as it adapts to the data it's given.

Installing Moonshield-Table

To use moonshield-table, you can use npm in your project with the following command :

npm install moonshield-table

Dependencies

| Name | Version | | :-: | :-: | | Node | 18.14.2 | | React | 18.2.0 |

Usage

Once the library is installed in your React application, create a component and import Custom Table :

import { CustomTable } from 'moonshield-table';

Then, declare the columns your table will require in an array of objects. Each column requires a label (the name that will be displayed in your table), an accessor (same as the label, in snake_case or camelCase), and two booleans : sortable and searchable. Your array of objects should look like this :

  const columns = [
    {label: 'First Name', accessor: 'firstname', sortable: true, searchable: true},
    {label: 'Last Name', accessor: 'lastname', sortable: true, searchable: true},
    {label: 'Start date', accessor: 'startday', sortable: true, searchable: true},
    {label: 'Department', accessor: 'department', sortable: false, searchable: false},
    {label: 'Birthday', accessor: 'birthday', sortable: false, searchable: true},
  ];

Finally, you can use the custom table in your component. It will always take 100% of the width of its container, so you can easily adapt the size of its container. You can enable or disable the search feature by changing the value of the boolean.

The data has to be provided in json format, with fields matching the accessors of the columns.

  return (
    <div className='your-table-container'>
      <CustomTable columns={columns} searchFeature={true} data={tableData} />
    </div>
  );

Features

  • Sort the columns : the columns having the sortable boolean to true will have the sort option active, which allows them to be ascendingly sorted on the first click on the header of the column, and descendingly sorted on second click of the column.
  • Search : if the searchFeature of the CustomTable is set to true, a search input will be displayed and will search the data of the columns having the searchable boolean to true.
  • Pages : this component is meant to display a lot of data, which is why a pages feature is implemented. You can select the amount of data that will be displayed per page thanks to the select on top of the table.
  • Responsive : the component is responsive and can be displayed on desktops and mobile screens without cropping, assuming there isn't an abusive amount of columns (up to 10).

License

This package is released under the MIT license. You are free to use, modify and distribute this software, as long as the copyright is left intact.