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

treematrix

v0.0.4

Published

## Implementation

Downloads

6

Readme

Tree Matrix - The simplest way to make HTML Tree Matrix

Implementation

  1. 70K lib size
  2. Wrapped jQuery treetable Plugin with a single library method treematrix.build(matrixModel)
  3. Easy to compose a tree matrix with pre-defined JSON model
  4. Built with webpack, so just add the following scripts in your HTML document
 <script src="https://unpkg.com/[email protected]/dist/jquery.min.js"></script>
 <script src="https://unpkg.com/treematrix@latest/dist/treematrix"></script>

Demo

http://htmlpreview.github.io/?https://github.com/vorachet/treematrix/blob/master/demo/indexCDN.html

or

demo/index.html

Dependencies

  1. jQuery ^3.2.1
  2. jQuery treetable Plugin ^3.2.0

Example

Output

Logo

HTML

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    <title>treematrix</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  </head>
  <body>
    <h1>TreeMatrix</h1>
    <h2>Demo</h2>
    <p>Github <a href="https://github.com/vorachet/treematrix">https://github.com/vorachet/treematrix</a></p>
    
    <div id="demo1"></div>
    <div id="demo2"></div>
    
    <script src="https://unpkg.com/[email protected]/dist/jquery.min.js"></script>
    <script src="https://unpkg.com/treematrix@latest/dist/treematrix"></script>
    <script src="models.js"></script>
    <script src="builders.js"></script>
  </body>
</html>

models.js

const satisfiedByIcon = '<i class="fa fa-level-up" aria-hidden="true"></i>';
const userIcon = '<i class="fa fa-user-circle" aria-hidden="true"></i>';
const taskIcon = '<i class="fa fa-tasks" aria-hidden="true"></i>';

const demo1Model = {
  caption: "Table 1. Requirements Traceability",
  cols: {
    b1: {label: "Block 1"},
    b2: {label: "Block 2"},
    b3: {label: "Block 3"},
    b4: {label: "Block 4"},
    b5: {label: "Block 5"},
    b6: {label: "Block 6"},
    b7: {label: "Block 7"},
    b8: {label: "Block 8"}
  },
  tree: [
    { id: 1, label: "Requirement1", colsMap: {b1: satisfiedByIcon}, children: [
        { id: '1.1', label: "Requirement1.1", children: 
          [
            {id: '1.1.1', label: "Requirement1.1.1", colsMap: {b2: satisfiedByIcon}},
            {id: '1.1.2', label: "Requirement1.1.2", colsMap: {b3: satisfiedByIcon}},
            {id: '1.1.3', label: "Requirement1.1.3", colsMap: {b4: satisfiedByIcon}}
          ]
        },
        { id: '1.2', label: "Requirement1.2", children:
          [
            {id: '1.2.1', label: "Requirement1.2.1", colsMap: {b5: satisfiedByIcon}},
            {id: '1.2.2', label: "Requirement1.2.2", colsMap: {b5: satisfiedByIcon}}
          ]
        }
      ]
    },
    { id: '2', label: "Requirement2", children: 
        [
          { id: '2.1', label: "Requirement2.1", colsMap: {b7: satisfiedByIcon}}
        ]
    },
  ]
};

const demo2Model = {
  caption: "Table 2. RACI (Responsible, Accountable, Consulted, and Informed)",
  cols: {
    Ann: {label: userIcon + " Ann"},
    Ben: {label: userIcon + " Ben"},
    Carlos: {label: userIcon + " Carlos"},
    Dina: {label: userIcon + " Dina"},
    Ed: {label: userIcon + " Ed"}
  },
  tree: [
    { id: 1, label: taskIcon + " Create charter",
      colsMap: {Ann: "A", Ben: "R", Carlos: "I", Dina: "I", Ed: "I"}
    },
    { id: '2', label: taskIcon + " Collect requirements",
      colsMap: {Ann: "I", Ben: "A", Carlos: "R", Dina: "C", Ed: "C"}
    },
    { id: '3', label: taskIcon + " Submit change request",
      colsMap: {Ann: "I", Ben: "A", Carlos: "R", Dina: "R", Ed: "C"}
    },
    { id: '4', label: taskIcon + " Develop test plan",
      colsMap: {Ann: "A", Ben: "C", Carlos: "I", Dina: "I", Ed: "R"}
    }
  ]
}

builders.js


treematrix.build("demo1", demo1Model, (selectedTree) => {
	console.log(selectedTree);
});

treematrix.build("demo2", demo2Model, (selectedTree) => {
	console.log(selectedTree);
});