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-data-component

v1.0.0-alpha.45

Published

A straightforward Vue component to filter, sort and paginate data

Downloads

52

Readme

A straightforward Vue component to filter, sort and paginate data.

Latest Version on NPM Less than 6.5kb Software License Build Status npm

Work in progress!

vue-data-component is a renderless component to build data-driven interfaces. Especially interfaces that contain filterable, sortable, or paginated data. We wanted to build something that takes care of pesky little problems like loading indicators, debouncing, or mapping your interface's filters to an AJAX request.

A brief overview of what vue-data-component has to offer:

  • Filter, sort, and paginate data via AJAX or from any other data source
  • Sync the component state with the current URL's query string
  • Debounce asynchronous requests
  • Handle loading indicators. No unnecessary flashes, only display them if the request is taking too long
  • Pass initial data for the component's first render when fetching data asynchronously, avoids layout jumps on first render when the data isn't loaded yet
  • Renderless: build your own interface, we don't make any assumptions
  • Additional helper components for sorting, pagination, and facet filters

On their own, none of these features are super impressive, but together they enable you to build better interfaces in a uniform approach.

Changelog

Please see CHANGELOG for more information what has changed recently.

Installation

With npm:

npm install vue-data-component

With yarn:

yarn add vue-data-component

This package contains a few components. You can register them all globally by installing this package as a plugin.

import Vue from 'vue';
import VueDataComponent from 'vue-data-component';

Vue.use(VueDataComponent);

Alternatively, you can import the ones you need separately.

import {
    DataComponent,
    QueryComponent,
    DataSortToggle,
    DataFilter,
    DataPaginator,
} from 'vue-data-component';

Polyfills

vue-data-component expects the following browser API's to be available. If you expect wider browser support, you'll need to add a polyfill.

Usage

The main component exposed by this package is the

| Prop | Type | Default | Description | |------|------|---------|-------------| | source* | Function | (required) | This function will be called to fetch data. It receives an object parameter: { query, queryString }. The function should return a response object. The response object mayb be wrapped in a promise. | | query | Object | {} | A query object. A deep watcher will be registered on the query object to determine when new data should be fetched. | | initial | Object or null | null | An initial response object so the component can render as soon as possible. | | debounceMs | Number | 0 | Data wont be subsequently fetched until the debounce time has passed. | | slowRequestMs | Number | 0 | Requests that take longer than slowRequestMs will be considered slow. See Handling slow requests. | | useQueryString | Boolean | false | When true, the browser's query string will be updated based on the current query. See Query strings. This prop is currently not supported with SSR. | | queryStringDefaults | Object or null | null | The default values for the query string. When these values match the current query values, they will be omitted from the query string. For example, you generally don't want page=1 in your URL's, since it has the same effect as no page parameter. |

Query objects

Todo

Query strings

Response objects

Todo

Handling slow requests

Slow initial loads

Todo

Slow subsequent requests

Todo

Testing

yarn test

Contributing

Please see CONTRIBUTING for details.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

We publish all received postcards on our company website.

Security

If you discover any security related issues, please contact [email protected] instead of using the issue tracker.

Credits

Support us

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

License

The MIT License (MIT). Please see License File for more information.