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

virtualized-material-graph-table

v1.0.2

Published

virtualized material table whith filters, sort and pieGraph for columns

Downloads

1

Readme

virtualized-material-graph-table

A simple Grid for React based react-virtualized and Material-UI.

Features

  • Sort asc/desc per column.
  • Filter per column.
  • Select input for filter.
  • Date picker for date column filter.
  • Piegraph per column.
  • Custom rendering.

Demo

functional table demo

Props

| Props | Required | Default value | type | Note | | ------------- |:-------------:| :-------------:|:-----------:|:--------:| | customColumns | yes | none | Array | Array de objetos. | data | yes | none | Array | Array de objetos. | noFilters | no | false | boolean | render/no render filter row. | renderGraphBtn| no | true | boolean | render/no render graph and graph button. | rowHeight | no | 60 | number | height of grid rows ( only numbers, not dynamic). | tableHeight | no | 400 | number or string | height of Table Container rows. | noBottomTotal | no | false | boolean | render/no render total in bottom of the table.

Exemplos

customColumns: [
  {
    dataKey: 'nome_cli',
    label: 'Nome do Cliente',
    type: 'string'
  }
]

data: [
  {
    nome_cli: 'clodoaldo alves'
    idade: 20,
    data_nasc: '2020-06-04'
    ...
  }
]

<ShowRelatorio customColumns={customColumns} data={data} rowHeight={50}/>

customColumns Props

| Props | Required | Default value | type | Note | | --------|:---------| :-------------:|:-----------:|:-----------:| | dataKey | yes | none | object | object key. | | label | yes | none | object | Column label. | | type | no | string | enum | object type: string, bool, number, date... | | dateType| no | none | enum | 'dd/mm/yyyy', 'yyyy-mm-dd', 'iso'. (to prevent date format erros), all dates are formated in momen(date).format(date or date time + dateType). | | inputFilterSelect | no | none | array | render a select input over a text input. value, label pair for render data. | | render | no | none | func | func for custom rendering, receive {row, KEY}. | | renderGraph| no | true | boolean | render/no render graph for the column. | noFilter | no | false | boolean | render/no render filter input for the column. | width | no | 200 | number | column width.

Exemplos

customColumns: [
  {
    dataKey: 'hora_ligacao',
    label: 'Hora da ligação',
    type: 'datetime',
    dateType: 'iso',
    renderGraph: false,
    width: 220,
  },
  {
    dataKey: 'gender',
    label: 'Gênero',
    width: 150,
    //render exemple
    render: ({ row, KEY }) => <div>
      {row[KEY] == 'm' ? 'Male' : 'Female'}
    </div>
  },
  {
    dataKey: 'periodo',
    label: 'Período',
    //inputFilterSelect example
    inputFilterSelect: [
      { value: 'Tarde', label: 'Tarde label' },
      { value: 'Manhã', label: 'Manhã label' },
    ],
    renderGraph: true,
    width: 180,
  },
  {
    ...
  }
]

Get Started

1.Install package

npm install virtualized-material-graph-table --save npm i @material-ui/icons

Usage

Here is a basic example of using material-table within a react application.

import React, { Component } from "react";
import ReactDOM from "react-dom";
import VirtualizedMaterialTable from "virtualized-material-graph-table";
import WbSunnyIcon from '@material-ui/icons/WbSunny'
import Brightness2Icon from '@material-ui/icons/Brightness2'

class GraphTable extends Component {
  render() {
    return (
      <div style={{ height: 800 }}>
        <VirtualizedMaterialTable
          customColumns={[
             {
              dataKey: 'nome_cli',
              label: 'Client Name',
              type: 'string',
              width: 200,
            },
            {
              dataKey: 'data_nasc',
              label: 'Birtdhay',
              type: 'date',
              width: 200,
            },
            {
              dataKey: 'data_chegada',
              label: 'Arrival date',
              type: 'datetime',
              dateType: 'dd/mm/yyyy',
              width: 200,
            },
            {
              label: 'Gender',
              dataKey: 'gender',
              width: 180,
              renderGraph: true,
              inputFilterSelect: [
                { value: 'F', label: 'Female' },
                { value: 'M', label: 'Male' },
              ],
            },
            {
              label: 'Cycle',
              dataKey: 'periodo',
              width: 200,
              render: ({ row, KEY }) => {
                return (
                  <div>
                    {row[KEY] == 'Manhã' ? (
                      <div
                        style={{
                          display: 'flex',
                          alignItems: 'center',
                          justifyContent: 'center',
                          backgroundImage: 'linear-gradient(red, yellow)',
                          padding: 5,
                          borderRadius: 4,
                          color: '#fff',
                        }}
                      >
                        <WbSunnyIcon />
                        {row[KEY]}
                      </div>
                    ) : (
                      <>
                        {row[KEY] == 'Noite' && (
                          <div
                            style={{
                              display: 'flex',
                              alignItems: 'center',
                              justifyContent: 'center',
                              backgroundImage: 'linear-gradient(blue, black)',
                              color: '#fff',
                              padding: 5,
                              borderRadius: 4,
                            }}
                          >
                            <Brightness2Icon />
                            {row[KEY]}
                          </div>
                        )}
                      </>
                    )}
                  </div>
                )
              },
            },


          ]}
          data={[
            {
              nome_cli: 'André mesquita',
              data_nasc: '2021-06-04',
              data_chegada: '05/04/2021 15:42:21',
              periodo: 'Noite',
              gender: 'M'
            },
            {
              nome_cli: 'João das Couves',
              data_nasc: '1989-09-17',
              data_chegada: '05/04/2021 07:13:12',
              periodo: 'Manhã',
              gender: 'F'
            },

          ]}
        />
      </div>
    );
  }
}