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

tool-bar-hoc

v1.0.2

Published

A tool-bar-hoc component for vue-data-tables

Downloads

8

Readme

Introduction

A tool-bar-hoc component for vue-data-tables

中文文档

Basic Usage Demo

<template>
    <tool-bar
      v-model="filters"
      layout="action, radio, select, search" //Configuring layout options you need
      :actionOptions="actionOptions" // binding actionOptions
      :filterOptions="filterOptions" // binding filterOptions
    >
    </tool-bar>
    <data-tables-server
      ...
      :filters="filters"
      >
    </data-tables-server>
<template>
<script>
  ...
  import { ToolBar } from 'tool-bar-hoc'
  data(){
    return {
      filters: [
        {
          type: 'radio',
          prop: 'rent_type', // prop you want to filter by radio
          value: ''
        },
        {
          type: 'select',
          prop: 'building', // prop you want to filter by select
          value: ''
        },
        {
          type: 'search', // prop you want to filter by search
          prop: 'q',
          value: ''
        },
      ],
      filterOptions: {
        radioOptions: {
          items: [
            { label: 'radio1', value: '0' },
            { label: 'radio2', value: '2' },
            { label: 'radio3', value: '1' }
          ]
        }, //radio items
        selectOptions: {
          props: {
            placeholder: 'please select'
          },
          items: [
            ...
          ]
        },
        searchOptions: {
          colProps: {
            span: 8,
            offset: 2
          }, // other props that in accordance with the ElementUI rules
          props: {
            placeholder: '...'
          }
        }
      },
      actionOptions: {
        items: [
          {
            name: '', // button name
            handler: () => {
              //do something
            }
          }
          ....
        ]
      },
    }
  }
  components: {
    ToolBar
  }
<script>

Custom tool-bar

In addition to the ToolBar component, tool-bar-hoc also provides a createToolBar function that accepts a ComponentsAndProps array as a parameter.It can implement custom component insertion。 For example

  import { createToolBar } from 'tool-bar-hoc'
  let toolbar = createToolBar([{
    component: component1, // custom component
    props: {
      layout: 'province, city, district, custom', // Defines the layout option in the component1 , custom represents the component of the slot below
    },
    slot: component2 // Components not included in component1 but need to be used will be inserted into component1 as slots.
  }])


  The following is a detailed description of the parameters ComponentsAndProps

  @param {Array} ComponentsAndProps
    [
       {
         component: { VueComponent }
         props: { object } props that pass to the component,
         slot: { VueComponent } | Array<VueComponent> the default slot of the Component
       }
    ]

  The following is a detailed parameters for v-model

  @returns a hoc component,props of value and layout needs special introduction:
    value(v-model) { Array }
     [
       {
          type: { 'radio' | 'select' | 'checkbox' | 'search' } // If there is no type item, it is considered to be the corresponding incoming component.  没有type的项,则认为是其对应传入的组件(component)
          prop: { string | array } // For data-tables, prop is used to filter
          filterFn: { Function } // Custom filter function 自定过滤函数
       }
     ]
    layout: {string} 'action, radio, select, checkbox, search, confirm' //default value

      // If there is no `confirm` type, when (radio, select, checkbox, search) value changes, it will emit input directly

      // If there is 'confirm' type, the inner value change will be delayed until the confirm button is clicked.

Others

you could try more usage by reading the source code.