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

simter-vue-thead

v0.4.2

Published

Simter thead component

Downloads

4

Readme

Vue Component simter-vue-thead

Define table's thead tag by structured data. Such as columns = ["X1", "X2"] or columns = ["X1", {label: "X2", children: ["X21", "X22"]}]. Demo or document is here.

Core properties:

| Name_________ | Require | ValueType | Description |---------------|---------|-----------|-------------------- | columns | true | [{}] | Define table columns | ├ label | true | String | The column's visible text | ├ width | false | String | The column's width, such as '2em' | ├ children | false | [{}] | The child group columns. id and width will be ignored if define this property | ├ headerClass | false | String | The specific class for this column's header cell th element | ├ headerStyle | false | String | The specific style for this column's header cell th element | classes | false | {} | Define component class | ├ thead | false | String | thead class, follow Vue Class Bindings | ├ row | false | String | thead/tr class, follow Vue Class Bindings | ├ cell | false | String | thead/tr/th class, follow Vue Class Bindings | styles | false | {} | Define component style | ├ thead | false | String | thead class, follow Vue Style Bindings | ├ row | false | String | thead/tr class, follow Vue Style Bindings | ├ cell | false | String | thead/tr/th class, follow Vue Style Bindings

Develop

yarn install  // or npm install
npm run dev

Use parcel to run the development debug.

Build

npm run build

Use rollup package the component to dist directory.

Usage

Example 1 : Simple Columns

Js:

import thead from 'simter-vue-thead'

new Vue({
  el: "#sample",
  data: {
    columns: ["X1", "X2", "X3"]
  },
  components: {
    "st-thead": thead
  }
})

Html template:

<table id="#sample">
  <thead is="st-thead" :columns="columns"></thead>
  ...
</table>

Generated html:

| X1 | X2 | X3 |
<table>
  <thead>
    <tr>
      <th>X1</th>
      <th>X2</th>
      <th>X3</th>
    </tr>
  </thead>
  ...
</table>

Example 2 : Group Columns

Use children key to define the group.

Js:

import thead from 'simter-vue-thead'

new Vue({
  el: "#sample",
  data: {
    columns: [
      "X1",
      {
        label: "X2",
        children: ["X21", "X22"]
      },
      {
        label: "X3",
        children: ["X31", "X32"]
      },
    ]
  },
  components: {
    "st-thead": thead
  }
})

Html template:

<table id="#sample">
  <thead is="st-thead" :columns="columns"></thead>
  ...
</table>

Generated html:

| X1 |    X2     |    X3     |
|    | X21 | X22 | X31 | X32 |
<table>
  <thead>
    <tr>
      <th rowspan="2">X1</th>
      <th colspan="2">X2</th>
      <th colspan="2">X3</th>
    </tr>
    <tr>
      <th>X21</th>
      <th>X22</th>
      <th>X31</th>
      <th>X32</th>
    </tr>
  </thead>
  ...
</table>

Example 3 : Complex Group Columns

Use children key to define any level nested group columns.

Js:

import thead from 'simter-vue-thead'

new Vue({
  el: "#sample",
  data: {
    columns: [
      { label: "X1" },
      {
        label: "X2",
        children: [
          { label: "X21" },
          { label: "X22" }
        ]
      },
      { label: "X3" },
      {
        label: "X4",
        children: [
          {
            label: "X41",
            children: [
              { label: "X411" },
              { label: "X412" }
            ]
          },
          { label: "X42" }
        ]
      }
    ]
  },
  components: {
    "st-thead": thead
  }
})

Html template:

<table id="#sample">
  <thead is="st-thead" :columns="columns"></thead>
  ...
</table>

Generated html:

| X1 |    X2     | X3 |        X4         |
|    | X21 | X22 |    |     X41     | X42 |
|    |     |     |    | X411 | X412 |     |
<table>
  <thead>
    <tr>
      <th rowspan="3">X1</th>
      <th colspan="2">X2</th>
      <th rowspan="3">X3</th>
      <th colspan="3">X4</th>
    </tr>
    <tr>
      <th rowspan="2">X21</th>
      <th rowspan="2">X22</th>
      <th colspan="2">X41</th>
      <th rowspan="2">X42</th>
    </tr>
    <tr>
      <th>X411</th>
      <th>X412</th>
    </tr>
  </thead>
  ...
</table>