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

react-tablix

v1.1.11

Published

REACT TABLIX

Downloads

4

Readme

TABLIX

Tablix is the conversion of two-dimensional data into complex matrix table.

eg:

from:

id|school|grade|gradeID|schoolClass|scID|course|cid|score|std|teacher|gradeYear|gid ---|---|---|---|---|---|---|---|---|---|---|---|--- 1|我的学校|2019级|1|一班|1|语文|1|100|1.1657564|张洋|2017|1 2|我的学校|2019级|1|一班|1|语文|1|50|1.1657564|张洋|2017|1 3|我的学校|2019级|1|一班|1|语文|1|86|1.3|张张|2018|2 4|我的学校|2019级|1|一班|1|数学|2|79|1.2|冯大毛|2017|1 5|我的学校|2019级|1|二班|2|语文|1|92|2.1|张洋|2017|1 6|我的学校|2019级|1|二班|2|数学|2|98|1.5|李四|2017|1 7|我的学校|2018级|2|一班|2|语文|1|85|2.1|刘伟|2017|1

to:

Properties

- rowGroup

datatype: object

required

{
    by: 'field_name',
    sort: (a,b) => {},
    filter: dataSet => { return dataSet.filter(t => t.id > 2) },

    // option
    group: {
        
    }
}

- columns

datatype: array

前面几列定义必须按行组顺序对应!

required

[
    {
        field: 'file_name',
        name: 'show name',
        rowSpan: 3, 
        sort: (a,b) => {},
        style: '',
        className: '',
        render: (value, rowData) => {}
    },
    {
        // top group
        group: {
            by: 'field_name',
            name: 'Name',    // If you set the name, you will override the group values.
            sort: (a,b) => {},
            filter: dataSet => { return dataSet.filter(t => t.id > 2) },
            columns: [
                {
                    group: { 
                        by: 'field_name',
                        sort: (a,b) => {},
                        columns: [
                            {
                                field: 'field_name',
                                name: 'show name',
                                sort: (a,b) => {},
                                style: '',
                                className: '',
                                aggregate: Tablix.AGGREGATE_TYPE.AVG,
                                render: (value, rowData) => {},
                                hide: where => { return false; }
                            }
                        ]
                    }
                },
                // normal column
                {
                    name: 'show name',
                    columns: [
                        {
                            field: 'field_name',
                            name: '',
                        },
                        {
                            field: 'field_name',
                            name: '',
                        }
                    ]
                }
            ]
        }
    },
    {
        group: {
            by: 'course',       // group by
            field: 'score',     // show value
            rowSpan: 3,
        },
    },
    {
        name: 'show text',
        rowSpan: 2, 
        columns: [              // To solve multi-line merge mismatch, add a layer of columns, which can be adjusted according to the situation.
            {
                rowSpan: 0,     // 0 don't build cell
                    columns: [
                        {
                            field: 'field_name',
                            name: '',
                        },
                        {
                            field: 'field_name',
                            name: '',
                        }
                    ]
                }
            ]
        }
    ]

data

array

required

[
    {
        field_name1: value,
        field_name2: value,
        field_name3: value,
        field_name4: value,
    }
]

style

className

transported

row transport to column.

Aggregate Function

just use detail column, and have set field column

Tablix.AGGREGATE_TYPE

  • FIRST this is default
  • LAST
  • AVG
  • SUM
  • COUNT
  • MAX
  • MIN

Usage

import React from 'react';
import ReactDOM from 'react-dom';

import Tablix from './Tablix';

let opt = {
    rowGroup: {},
    columns: {},
    data: [

    ],
    style: {},
    className: '',
};

ReactDOM.render(<Tablix {...opt} />, document.getElementById('root));