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

@ksgl/treegrid

v0.0.11

Published

[![Deploy](https://github.com/ks-labs/vue-treegrid/actions/workflows/publish.yml/badge.svg)](https://github.com/ks-labs/vue-treegrid/actions/workflows/publish.yml/badge.svg) [![Teste](https://github.com/ks-labs/vue-treegrid/actions/workflows/test.yml/bad

Downloads

8

Readme

Vue Treegrid

Deploy Teste

This component was created using the tree-grid and bootstrap-table

How to install

  1. Install npm module
npm i @ks-labs/treegrid
  1. Import module
// main.js
import Vue from "vue";
import TreeGrid from "@ks-labs/treegrid";
import "@ks-labs/treegrid/src/assets/css/jquery.treegrid.css";

Vue.use(TreeGrid);
// public/index.html
<html>
  <head>
    ...

    <link href="https://unpkg.com/[email protected]/dist/extensions/sticky-header/bootstrap-table-sticky-header.css" rel="stylesheet">
    <link href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css" rel="stylesheet"/>

    ...
  </head>
  <body>

    ...

    <script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/bootstrap-table-vue.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/extensions/treegrid/bootstrap-table-treegrid.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js"></script>
  </body>
</html>

How to use

<template>
  <div>
    <treegrid
      styles="table table-bordered"
      :rows="rows"
      :columns="columns"
      :rowStyle="rowStyle"
      :formatNoMatches="formatNoMatches"
      @onPostBody="onPostBody"
      @onClickRow="onClickRow"
      @headerStyle="headerStyle"
    >
    </treegrid>
  </div>
</template>

<script>
  export default {
    name: "app",
    data() {
      return {
        columns: [
          {
            field: "name",
            title: "Projeto/Área",
            align: "left",
            cellStyle: (_, body) => {
              if (body.isConsolidation) {
                return { classes: "is-line-root" };
              }
              return { classes: "name-field" };
            },
          },
          {
            field: "media",
            title: "Média",
            align: "left",
            formatter: (value, row) => {
              if (!row?.total) return "";
              return this.formatCurrency(value ?? 0);
            },
            cellStyle: () => {
              return {
                classes: "column-media",
              };
            },
          },
        ],
        rows: [
          {
            id: 154,
            media: 6098.49,
            total: 6098.49,
            january: {
              total: 6098.49,
              isProjection: false,
              hasDuplicated: {
                value: true,
                duplicated: [
                  {
                    id: 70,
                    invoice_id: 950,
                    cost_center_id: 2922,
                    vehicle_id: 552,
                    traffic_ticket_id: null,
                    billing_month: "2023-01-01",
                    cost_type: "Rental",
                    value: 2033,
                    description: null,
                    created_at: "2023-01-23 19:02:46",
                    updated_at: "2023-01-23 19:02:46",
                  },
                  {
                    id: 65,
                    invoice_id: 945,
                    cost_center_id: 2003,
                    vehicle_id: 552,
                    traffic_ticket_id: null,
                    billing_month: "2023-01-19",
                    cost_type: "Rental",
                    value: 993.29,
                    description: null,
                    created_at: "2023-01-19 17:35:24",
                    updated_at: "2023-01-19 19:49:34",
                  },
                ],
              },
            },
            name: "Gastos Gerais",
            isConsolidation: true,
          },
          {
            id: 157,
            media: 2200,
            total: 2200,
            pid: null,
            january: {
              total: 2200,
              isProjection: true,
              hasDuplicated: { value: false, duplicated: [] },
            },
            name: "Diretoria de Logística",
            isConsolidation: true,
          },
        ],
      };
    },
  };
</script>

Below are some configurations supported by the component, if you need a new configuration please open a Pull Request

Props

| Name | Type | Default | Description | | --------------- | -------- | ------- | ------------------------------------------------------------------ | | Rows | Array | | All table body data | | Columns | Array | | All data on column headings | | idField | String | id | Overwrite the default idField to 'id' | | parentIdField | String | pid | Set the parent id field. | | treeShowField | String | | Set the treeShowField will auto enable the tree grid. | | rootParentId | String | null | Set the root parent id. | | treeEnable | Boolean | false | Set true to enable the tree grid. | | stickyHeader | Boolean | false | Set true to use sticky header. | | clickColor | String | | Color displayed in the background when clicking on a line | | rowStyle | Function | {} | The row style formatter function, takes two parameters: row, index | | formatNoMatches | Function | '' | Set message when the rows array is empty |

Events

| Name | Description | params | | -------------- | -------------------------------------------------------------------------------------------- | ------------------------------------- | | onPostBody | It fires after the table body are rendered and available in the DOM. The parameters contain: | element treegrid | | onClickRow | It fires when the user clicks a row | Object: {row, $element, field} | | onClickCell | It fires when the user clicks a cell | Object: {field, value, row, $element} | | onDblClickRow | It fires when the user double clicks a row | Object: {row, $element, field} | | onDblClickCell | It fires when the user double clicks a cell | Object: {field, value, row, $element} | | onExpandRow | It fires when you click the detail icon to expand the detail view | Object: { index, row, $detail} | | onCollapseRow | It fires when you click the detail icon to collapse the detail view | Object: {index, row, detailView} | | headerStyle | The header style formatter function | column |