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

@s3_dse/v-tail

v0.3.8

Published

A component library for Vue2 using Tailwind CSS. A table component for Vue 2 that supports: ## Installation

Downloads

16

Readme

v-tail

A component library for Vue2 using Tailwind CSS. A table component for Vue 2 that supports:

Installation

Install the library via npm install --save @s3_dse/v-tail.

Add the following to your entry point (e.g. main.js):

import VTail from '@s3_dse/v-tail'
Vue.use(VTail)

Components

Table Component

A table that supports

  • filtering
  • pagination
  • custom column and cell rendering
  • fixed top row(s) (e.g. for comparisons)
  • fixed bottom row(s) (e.g. for summaries)

Usage

We will use the following lines to illustrate the usage of the table component:

<template>
    <table-component
        title="A Table"
        :items="data"
        :top-rows="topRows"
        :bottom-rows="summaryRows"
        :fields="header"
        :paginate="true"
        :configurablePageSize="true"
        :per-page="5"
        @after-sort="afterSort"
        @after-page-change="afterPageChange"
        @after-filter="afterFilter"
        :pagination-previous-label="'<'"
        :pagination-next-label="'>'"
    >
        <template #cell(ip_address)="{ value }">
            <p class="tw-text-navy-500">{{ value }}</p>
        </template>
        <template #pagination-label="{ perPage, currentPage, totalEntries }">
            I am currently showing entries 
            {{ perPage * currentPage - perPage + 1 }} to
            {{ perPage * currentPage }} of {{ totalEntries }} entries.
        </template>
        <template #page-size-label="data">
            Current Page Size: {{ data.pageSize }}
        </template>
    </table-component>
</template>
<script>
export default {
    name: 'App',
    data() {
        return {
            data: [
                { id: 1, name: 'John Doe', share: 0.51, ip_address: '111.222.47.186', last_login: '2023-01-31' },
                { id: 2, name: 'Jane Doe', share: 0.08, ip_address: '71.190.227.13', last_login: '2023-04-10' }
            ],
            topRows: [
                { id: 3, name: 'Patricia Smith', share: 0.89, ip_address: '25.7.58.72', last_login: '2023-04-10'},
                { id: 4, name: 'Douglas Holland', share: 0.72, ip_address: '105.171.14.146', last_login: '2023-03-24'}
            ],
            bottomRows: [
                {id: 5, name: 'Jordan Winsley', share: 0.81, ip_address: '141.147.221.67', last_login: '2023-04-28'}
            ],
            fields: [
                { key: 'id' }, 
                { key: 'name' },
                { key: 'share',
                  thClassList: 'tw-text-right tw-px-2',
                  tdClassList: 'tw-text-right tw-px-2',
                  tdTopRowClassList: 'tw-text-right tw-px-2 tw-italic',
                  tdBottomRowClassList: 'tw-text-right tw-px-2 tw-font-semibold',
                  formatter: value =>
                          value
                              ? (parseFloat(value) * 100).toLocaleString(navigator.language, {
                                  minimumFractionDigits: 0,
                                  maximumFractionDigits: 2
                              }) + '%'
                              : ''
                }
                { key: 'ip_address',
                  thClassList: 'tw-text-center tw-px-2',
                  tdClassList: 'tw-text-center tw-px-2',
                  tdTopRowClassList: 'tw-text-center tw-px-2 tw-italic',
                  tdBottomRowClassList: 'tw-text-right tw-px-2 tw-font-semibold'
                }
            ]
        }
    }
}
</script>
<style>
@import '@s3_dse/v-tail/dist/style.css';
</style>

We pass the table data as an array of objects via the :items attribute. The same applies to the optional :top-rows and :bottom-rows. The entries of all three data arrays need to have the same structure. The :fields attribute takes an array of objects with details regarding the rendering of particular fields. Field entries have a key to refer to a data entry's property. The remaining field properties are metadata to customize the rendering of the column:

  • thClassList: classes for styling the column's <th> content (only applied to :items records)
  • tdClassList: classes for styling the column's <td> content (only applied to :items records)
  • tdTopRowClassList: classes for styling the column's <td> content (only applied to :top-rows records)
  • tdBottomRowClassList: classes for styling the column's <td> content (only applied to :bottom-rows records)
  • formatter: a function defining a formatting logic for the values of that field/column

Only attributes present in the field array will be displayed in the resulting table, hence the `

Pagination

The page navigation can be enabled/disabled via the :paginate attribute. This will toggle pagination in general. The page size configurator can be enabled/disabled via the :configurable-page-size attribute. Both these attributes take boolean values and are true by default. They are part of the above example only for illustration.

Cell Rendering

The above example shows how to use the #cell() slot to customize the rendering of individual cells. The slot is dynamic and takes a field key as argument. It provides an object holding the actual cell value, the item (or record) of the :items array, and the field of the :fields array.

Credits

The component is heavily inspired by the Bootstrap Vue Table component. Have a look: https://github.com/bootstrap-vue/bootstrap-vue

Pagination Component

Dropdown Component

License

MIT License

Copyright (c) 2023 Sebastian Doerl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.