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

vue-screener

v0.13.6

Published

Easily search and filter data in Vue3.

Downloads

861

Readme

Install

This package is hosted on npm. You can install it using npm or yarn:

npm install vue-screener
# or
yarn add vue-screener

Basic usage

<template>
  <vue-screener
    :data="[
      { category: 'Technology', product: 'Laptop', price: '£799', inStock: true },
      { category: 'Clothing', product: 'Sneakers', price: '£60', inStock: true },
      { category: 'Home Decor', product: 'Table Lamp', price: '£30', inStock: false },
      { category: 'Books', product: 'Adventure Novel', price: '£12', inStock: true },
      { category: 'Electronics', product: 'Smartphone', price: '£399', inStock: true },
      { category: 'Kitchen', product: 'Coffee Maker', price: '£65', inStock: false },
      { category: 'Clothing', product: 'Dress', price: '£40', inStock: true },
      { category: 'Technology', product: 'Headphones', price: '£49', inStock: true },
      { category: 'Home Decor', product: 'Throw Pillow', price: '£15', inStock: true },
    ]"
  />
</template>

<script lang="ts">
import { Screener } from 'vue-screener'
import 'vue-screener/style.css'
</script>

Options

Set the title:

<template>
  <vue-screener title="Product data" />
</template>

Pick fields to show:

<template>
  <vue-screener
    :data="data"
    :pick="['price', 'product', 'technology']"
  />
</template>

Omit fields:

<template>
  <vue-screener
    :data="data"
    :omit="['price', 'product', 'technology']"
  />
</template>

Add a sticky column on the right to put stuff in.

<template>
  <Screener
    :data="[
      { category: 'Technology', product: 'Laptop', price: '£799', inStock: true },
      { category: 'Clothing', product: 'Sneakers', price: '£60', inStock: true }
    ]"
    :columnDefs="{
      action: { field: 'action', isSticky: true }
    }"
    :pick=""
  >
    <template #head="props">
      <Head v-if="props.column.isSticky" v-bind="props">Actions</Head>
    </template>
    <template #data="props">
      <Data v-if="props.column.field === 'action'" v-bind="props">
        <button @click="handleClickEdit(props.item)">Edit</button>
        <button @click="handleClickDelete(props.item)">Delete</button>
      </Data>
    </template>
  </Screener>
</template>
<script setup>
import Screener, { Head, Data } from 'vue-screener'
</script>

Slots

Custom head cell renderer:

<template>
  <vue-screener :data="data">
    <template #head-cell="props">
      <HeadCell v-bind="props">
        {{ props.field }}
        <CurrencyPicker  v-if="props.field === 'price'" />
      </HeadCell>
    </template>
  </vue-screener>
</template>
<script>
import Screener, { HeadCell } from 'vue-screener'
import CurrencyPicker from './components/currency-picker'
</script>

Custom value cell renderer:

<template>
  <vue-screener :data="data">
    <template #data="props">
      <Data v-bind="props">
        <span v-if="props.field === 'price'">
          {{ formatPrice(props.value) }}
        </span>
        <template v-else>
          {{ props.value }}
        </template>
      </Data>
    </template>
  </vue-screener>
</template>
<script>
import Screener, { Data } from 'vue-screener'
import { formatPrice } from './utils/currency'
</script>

Theming

You can style components and their subcomponents by passing an object to the ui prop. The object reflects the hierarchical structure of the components, allowing you to apply TailwindCSS classes at different levels. Subcomponents inherit styles from higher levels unless explicitly overridden.

{ // VueScreener
  class?: string
  tableView?: { // TableView
    table?: { // Table
      class?: string
      header?: { // TableHead
        class?: string
        cell?: { // TableCell
          class?: string
          isFirstClass?: string
          isLastClass?: string
          isStickyClass?: string
          isStickyOverlappingClass?: string
          sortableClass?: string
          sortingClass?: string
          sortIcon?: { // SortIcon
            class?: string
            ascClass?: string
          }
        }
      }
      row?: { // TableRow
        class?: string
        cell?: { // TableCell
          class?: string
          isFirstClass?: string
          isLastClass?: string
          isStickyClass?: string
          isStickyOverlappingClass?: string
        }
      }
    }
  }
  noDataView?: { // NoDataView
    class?: string
  }
  badDataView?: { // BadDataView
    class?: string
  }
}


{ // ScreenerPagination
  class?: string
  leftSide?: {
    class?: string
  }
  rightSide?: {
    class?: string
    perPageInput?: { // Input
      class?: string
      errorClass?: string
    }
  }
  nav?: {
    class?: string
    button?: { // Button
      class?: string
      activeClass?: string
      disabledClass?: string
    }
  }
}

{ // ScreenerSearchOptions
  class?: string
  toggleButton?: { // ToggleButton
    class?: string
    activeClass?: string
    icon?: {
      class?: string
    }
  }
}

Roadmap

  • [x] Storybook documentation
  • [x] Search query highlighting
  • [x] Pagination
  • [x] Sort by field (GUI)
  • [ ] Add/remove table columns (GUI)
  • [ ] Resize table columns (GUI)
  • [ ] Full style customization
  • [ ] Support for images, numbers, links and more
  • [ ] Dark mode styling inspired by Mozilla Firefox JSON viewer
  • [ ] Extensible cell content (like VueTable)

Reading

https://medium.com/evodeck/responsive-data-tables-with-css-grid-3c58ecf04723

License

MIT