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

vue3-advanced-query-builder

v3.1.2

Published

A Query Builder written in Vue3

Downloads

154

Readme

vue3-advanced-query-builder

Install

via npm

npm install vue3-advanced-query-builder --save

Setup

register plugin globally via

import AdvancedQueryBuilder from "vue3-advanced-query-builder"
app.use(AdvancedQueryBuilder)
<style src="vue3-advanced-query-builder/dist/styles.css" />

The css shouldn't be imported globally. It could overwrite your basic css. Just put this directly into the component with the advanced query builder.

Usage

<advanced-query-builder :config="config"
                        v-model="currentQuery"
></advanced-query-builder>
const currentQuery = ref([])

const config = {
    levelOperators: [
        {
            name: 'and',
            identifier: 'AND'
        },
        {
            ...
        },
    ],
    ruleOperators: [
        {
            name: 'contains',
            identifier: 'contain',
            hasInput: false, // if ruleOperator is a Boolean as 'isEmpty'
        },
        {
            ...
        },
    ],

    rules: [
        {
            name: 'Name',
            identifier: 'name',
            type: "text", // input type - ignored, when custom input component
            component: componentName, // used to inlcude custom input field component
            icon: '#', // optional
            initialValue: "", // optional
            placeholder: "Placeholder", // optional
            operators: ['contain', ...], // shows only defined rule operators
            operators: false // if you don't want rule operators in this rule
        },
        {
            ...
        },
    ]

}

Output

{
    "levelOperators": [
        {
            "name": "or",
            "identifier": "OR",
            "level": 0
        },
        {
            "name": "and",
            "identifier": "AND",
            "level": 1
        }
    ],
    "rules": [
        {
            "index": 0,
            "value": "",
            "operator": "contain",
            "level": 0,
            "identifier": "name",
            "uuid": "7d9bd77c-4025-4b7e-ab59-b2e2d012d1a5",
            "ruleType": {
                "name": "Name",
                "identifier": "name",
                "type": "text",
                "icon": "#",
                "initialValue": "",
                "placeholder": "Placeholder"
            }
        },
        {
            "index": 1,
            "value": "",
            "operator": "contain",
            "level": 0,
            "identifier": "name",
            "uuid": "1b39b943-e9cc-412a-8c9d-e79625ac4421",
            "ruleType": {
                "name": "Name",
                "identifier": "name",
                "type": "text",
                "icon": "#",
                "initialValue": "",
                "placeholder": "Placeholder"
            },
            "isGroup": true,
            "children": [{
                "index": 0,
                "value": "",
                "operator": "contain",
                "level": 1,
                "identifier": "housenumber",
                "uuid": "857f1a30-a133-4293-99f0-7a35121926a0",
                "ruleType": {
                    "name": "Hausnummer",
                    "identifier": "housenumber",
                    "type": "Number",
                    "icon": "©",
                    "initialValue": "",
                    "placeholder": "Hausnummer"
                }
            }]
        }
    ]
}

Slots

  • addRule - "Add a new Rule" - Text
  • addGroup - Text of "Add a new Input Group" Field
  • removeRules - Text of the "Remove all Rules" Button

Input Components


<select v-model="value" 
        @change="$emit('emit-input', {value})" 
        class="form-control qb-select select">
        <option value="null">Select Value</option>
        <option v-for="option in options"
            :value="option" :key="option.id">
            {{ option.name }}    
        </option>
</select>
const value = ref(null)
const options = { 
            ...
    }

Every custom component gets the props value and placeholder. You need to assign those is your component.

changelog

changelog