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

@unriddle/react-grid

v0.0.8

Published

<h1 align="center"> react-virtualized-simple-grid </h1>

Downloads

7

Readme

How to use

import { Table } from "library-name";
import { colDef, data } from "./somewhere";

const App = () => <Table colDef={colDef} list={data} />;

Step by step

With this data below we want to have a table with id, name and age.

Data:

[
  {
    id: "1",
    name: "Steve",
    age: "29"
  },
  {
    id: "2",
    name: "Roger",
    age: "33"
  },
  {
    id: "3",
    name: "Sarah",
    age: "27"
  }
];

For this to work we will have to create a column definition.

Column Definition defines how we want to map the respective values from the data:

const columnDefinition = [
  {
    key: "id",
    label: "Id",
    size: 50
  },
  {
    key: "name",
    label: "User Name",
    size: 150
  },
  {
    key: "age",
    label: "User Age",
    size: 50
  }
];

As we can see from above it has three important characteristics: key, size and label.

| key | Description | required? | | --------- | --------------------------------------------------------------- | --------- | | key | What key we want to map with from the data. | YES | | size | the size of the column | YES | | label | The label in the header that will be shown for the mapped value | NO | | checkbox | if we want to render checkboxes for a column | NO | | component | to render a custom component with the data | NO |

Checkbox column and a custom component:

export const customColDef = [
  {
    key: "checkbox",
    size: 50
  },
  {
    label: "Hotel",
    key: "hotel",
    size: 250,
    component: ({ rowData }) => {
      return <a href={rowData.link}>{rowData.hotel}</a>;
    }
  }
];

Props

| key | Description | default | | ------------------ | ---------------------------------------------------------------- | ------------------- | | list | Your data. | | | colDef | Defines how to map the values into the grid | | | fixedRowCount | number | | | fixedColumnCount | number | | | fixedHeight | number | | | fixedWidth | number | | | rowHeight | number | | | headerHeight | number | | | isBoxShadow | boolean, | true | | hoverOnX | boolean | false | | hoverOnY | boolean | false | | isZebra | boolean | false | | isSortOn | boolean | false | | isEditable | boolean | false | | onCellChange | function callback with changed cell (only when using isEditable) | | | onLabelClick | function callback with clicked label info | | | footer | function | example: lib/footer |

CSS Classes

| key | Description | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------- | | Table | has to be set on style prop | | Row | .table--row-even .table--row-odd | | th | .c-table--th | | td | .c-table--td | | th when sorting (when active) | .c-table--th-sort .c-table--th-sort-active | | sort icon button (when active) | .c-sort-button .c-sort-button--active | | hover cell (when active) | .c-table--td-hover-cell | | Fixed rows styles (when active) | .c-table--top-left-grid .c-table--top-right-grid .c-table--bottom-left-grid .c-table--bottom-right-grid | | editable cell input (when active) | .c-editable-cell--input | | sub header (when active) | .c-table--sub-header .c-table--sub-header-title | | Checkbox (when active) | .c-checkbox-cell .c-checkbox-cell--input id="c-checkbox-label-checkboxKey for="c-checkbox-label-checkboxKey |

Build


npm run build